A few months ago I asked (again) for a priority installation for a new smartmeter. I did this before in my previous house and I want to have the old meters replaced here as well. A new Sagemcom T210D type is installed. More information about this meter can be seen here.
This smart meter has also the famous P1 port. The Plugwise Smile P1 can’t be used anymore with this newer type of smart meter, but the benefit here it that my home automation server is installed next to the smart meter. In this case, I’m able to use a P1-to-USB cable, and the exact type in my case is “NTA8130-P1 – P1 Converter Cable v2“, which can be bought in The Netherlands for around 20 euro.
My smart meter send every ~3 seconds a telegram update. An example of the layout is such a telegram could be like this:
034C
/Ene5\T210-D ESMR5.01-3:0.2.8(50)
0-0:1.0.0(181103191550W)
0-0:96.1.1(123456789123456789123456789123465798)
1-0:1.8.1(000286.979*kWh)
1-0:1.8.2(000179.813*kWh)
1-0:2.8.1(000000.089*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0001)
1-0:1.7.0(00.261*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00135)
0-0:96.7.9(00008)
1-0:99.97.0(3)(0-0:96.7.19)(180717122024S)(0000000479*s)(180717121129S)(0000003892*s)(180717110404S)(0000003869*s)
1-0:32.32.0(00005)
1-0:52.32.0(00003)
1-0:72.32.0(00003)
1-0:32.36.0(00000)
1-0:52.36.0(00000)
1-0:72.36.0(00000)
0-0:96.13.0()
1-0:32.7.0(225.0*V)
1-0:52.7.0(228.0*V)
1-0:72.7.0(226.0*V)
1-0:31.7.0(000*A)
1-0:51.7.0(000*A)
1-0:71.7.0(000*A)
1-0:21.7.0(00.102*kW)
1-0:41.7.0(00.005*kW)
1-0:61.7.0(00.152*kW)
1-0:22.7.0(00.000*kW)
1-0:42.7.0(00.000*kW)
1-0:62.7.0(00.000*kW)
0-1:24.1.0(003)
0-1:96.1.0(123456789123456789123456789123465799)
0-1:24.2.1(181103191500W)(00062.945*m3)
Representation of the P1 telegram
All OBIS (Object Identification System) objects in the telegram message have a code number, which correspond with a unique description, you can have easily ~50 codes in each telegram. All objects are based on the “P1 Companion Standard”, which is documented in the P1_Companion_Standard. I’ll explain an example from the telegram here:
1-0:1.7.0(00.261*kW)
- 1-0:1.7.0 = “Actual electricity power delivered (+P) in 1 Watt resolution,”
- (00.261*kW) = 0.261 kW = 261 Watt of realtime total power usage.
Some objects are not provided by the meter, so the values will be zero, like “1-0:2.7.0(00.000*kW)”. Because I don’t have solar panels, the smart meter don’t receive power.
Define com port in Homeseer
Because of the frequent telegram update, a stable connection is necessary. Check your device manager for the corresponding port number:
For a stable connection to the P1 USB cable, I’ll keep the com port open all time. To arrange this an “open comport statement” has to be added to the “Startup.vb” file from Homeseer. The file will run at every start of Homeseer. The following line, has to be added at the bottom of the script, but before the “End Sub” statement:
hs.closecomport(3)
Dim e=hs.OpenComPortTerm(3,”115200,N,8,1″,1,”P1smartmeter.vb”, “Main”, “!”)
- To be sure the comport is not already open, the comport will be closed first.
- Where “3” is the number of the com port.
- “P1smartmeter.vb” is the name of the script that can be downloaded at the bottom of the page
- “Main” is the name of the Sub statement in the “P1smartmeter.vb” script.
Save the “Statup.vb” file.
If you want to do it right, you should add a statement in “Shutdown.vb” script as well, corresponding to the earlier used com port:
hs.CloseComPort(3)
In this case, the com port will be closed when Homeseer will be stopped.
To have the settings fired up, a restart of Homeseer is necessary. Read the below text first, before restarting Homeseer.
Script explanation
In the first place, nothing has to be changed in the script. With the start of Homeseer, the com port will be opened and with every telegram update from the smart meter, the script will be run in Homeseer.
At lines 19-21 an extra comment is visible. It’s possible to save the telegram to a local file in the Homeseer HTML folder. This feature is not mandatory for running the script. it’s can be used to see what data is in the actual telegram. It’s up to your to enable it:
My.Computer.FileSystem.WriteAllText(save_telegram, data & ControlChars.CrLf, False, System.Text.Encoding.Unicode)
Be aware of the comment to add the mentioned “ScriptingReferences”:
- “System.Web.Extensions;System.Web.Extensions.dll”
When this is done, Homeseer needs a restart as well.
With the first script run, the virtual devices will be created automatically and can be shown like this:
Downloads:
P1smartmeter.vb (10.0 KiB, 1,899 hits)
Related Posts
September 7, 2017
Get Fibaro FGD-212 dimmer working in Homeseer
February 13, 2016
Control Spotify from Homeseer via Tasker
November 15, 2014
Good Morning
I’m lloking for to buy the electricity meter type T 210-D or 1 phase S210 of Sagemcom or new T211-D, S211.
It can be used meter or new meter.
I’m interesting to buy 1 or 2 pcs with sending to Poland.
Please for the information if is possible to buy by You.
You can to make a invoice . I have EU VAT Number
Thank you
Best regards
Artur Janicki
ART ENERGY
TEL. +48600686095
Hi Artur,
In The Netherlands we get our smartmeter for free via the energy supplier company. I’ve quickly looked around but I can’t find options to buy any of the mentioned smartmeters at all, event not on eBay or Amazon so I even can’t provide you an address where to buy it. Nowadays the Sagemcom isn’t installed anymore in NL but it will be an ISKRA or any other house brand of the energy supplier itself. The ISKRA is available on for example ebay.de.
Kind regards,
Rutg3r
No, I don’t think it’s correct. Although I agree a Linux timestamp would make more sense than what they’ve implemented here (I hate it when timestamps are still not Y2K proof)..
As I understand these DSMR timestamps are in the following format: YYMMDDhhmmssX, where X is an indicator of Daylight Saving Time (DST) – It’s either S for summer/DST or W for Winter/no DST. Source: https://www.netbeheernederland.nl/_upload/Files/Slimme_meter_15_a727fce1f1.pdf (page 16).
My Landis+Gyr meter only has 1 entry in the failure log, which is 000101010000W (2000 January 1st 01:00:00) and seems to be some sort of test/default value, considering how exact it is and DSMR being non-existent back then.
In the mean while I have written a small C# application to read my smart meter. My intention is to turn it into a plugin, but being new to C# I’m still trying to make sense of all the plugin examples. On the other hand it doesn’t seem to make sense to invest a lot of time in developing for HS3 with HS4 coming up.
My approach is different from yours:
1. I ignore every line that does not start with 0 or 1 to make sure it’s an OBIS code.
2. Then I take the first 10 characters, which turned out to be unique enough (at least for DSMR version 5) from each line and use a switch…case statement to figure out what it is.
This is my current output, each line will be one of 39 devices in Homeseer:
DSMR Version = 5.0
P1 Message Timestamp = 2020-03-31 23:52:54
DST Indication = S
Equipment Identifier = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Electricity Consumed Tariff 1 (kWh) = 1075.075
Electricity Consumed Tariff 2 (kWh) = 744.688
Electricity Returned Tariff 1 (kWh) = 0.000
Electricity Returned Tariff 2 (kWh) = 0.000
Tariff Indicator = 1
Actual Power P+ (kW) = 0.480
Actual Power P- (kW) = 0.000
Power Failures = 10
Long Power Failures = 5
Long Power Failure Log = 1
Last Failure Timestamp = 2000-01-01 01:00:00
Last Failure Duration (s) = 272
Voltage Sags Phase 1 = 8
Voltage Sags Phase 2 = 6
Voltage Sags Phase 3 = 4
Voltage Swells Phase 1 = 0
Voltage Swells Phase 2 = 0
Voltage Swells Phase 3 = 0
Text Message =
Voltage L1 (V) = 232.4
Voltage L2 (V) = 234.4
Voltage L3 (V) = 233.7
Current L1 (A) = 0
Current L2 (A) = 1
Current L3 (A) = 0
Power P+ L1 (kW) = 0.141
Power P+ L2 (kW) = 0.315
Power P+ L3 (kW) = 0.025
Power P- L1 (kW) = 0.000
Power P- L2 (kW) = 0.000
Power P- L3 (kW) = 0.000
M-Bus Device-Type = 3
Gas Meter Identifier = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Gas Meter Timestamp = 2020-03-31 23:50:09
Gas Meter Value (m³) = 1445.904
Nice script.
About your unknown, based on this line:
1-0:99.97.0(3)(0-0:96.7.19)(180717122024S)(0000000479*s)(180717121129S)(0000003892*s)(180717110404S)(0000003869*s)
There are 3 logged failures:
2018 July 17 12:20:24 during Summer, for 479 seconds
2018 July 17 12:11:29 during Summer, for 3892 seconds
2018 July 17 11:04:04 during Summer, for 3869 seconds
So you probably want to ignore this object, or only use the most recent entry for it to have some added value as a device.
I’m using the P1-wifi gateway, which uses power from the P1 port (http://www.esp8266thingies.nl/wp/p1-wifi-gateway-parasitic/).
Hi Bernold,
It’s a good one. And I see now also that the device got a bracket at the end…
In my case, 3 entries as well, where the timestamp is not officially in Epoch format. My latest entry = 180717122024S, which isn’t valid. When I add the digit 5, between “1” and “8” and remove the ending “S” ==> 1580717122024, will give me this timestamp: “maandag 3 februari 2020 09:05:22.024 GMT+01:00”.
Is my understanding correct? If yes, I’ll change the script accordingly.
Kind regards,
Rutg3r