New plugin for reading the gas and electricity usage from a Dutch Smart meter

I had the same problem. The gasmeter should be registered on the electricity meter. A call to the electricity company (Eneco) solved it. They had to pair them and give in some registration codes. After that they called in on the smart meter, 10 minutes later the p1 port started giving the gas usage output.

Verstuurd vanaf mijn ASUS Transformer Pad TF700T met Tapatalk 4

These new meters were recently installed in anticipation of solar energy. during the installation de technici did show me that the gasmeter was paired to the Kaifa. in addition he told me that if either one would fail both needed to be replaced since the are coupled.
one of these days i’ll phone the company to ask. I’ll try to get a log file as well and maybe some clever guy can shed some light.
how can i het some pictures from the Vera 3 dashboard to attach? import 1 and 2 (powermeter) and actual usage show values compatible with the Kaifa (exept the gas).

Thanks so far

Hi,
For me it took Stedin and Eneco 6 weeks to figure out how to get my meter linked to the network. Up to that point it only counted on the T1 and T1- tarrifs and no gas. Now it all works and I found I had to tweak the I_dutchSmartMeter.xml file as the codes seemed a little different. I changed this bit
– if (string.sub(data, 1, 10) == “0-1:24.3.0”) then
– luup.log(“Gas meter reading in next line”)
– indGasComming = 1
– else
---------------------------------------------------------------------------------------------
– Check if we have to process gas meter
---------------------------------------------------------------------------------------------
– if (indGasComming == 1) then
if (string.sub(data, 1, 10) == “0-1:24.2.1”) then
luup.log(“Gas meter: [” … string.match(string.match(data, “(%d+.%d+*m3)”), “%d+.%d+”) … “]”)
luup.variable_set(“urn:brutgrink-com:serviceId:dutchSmartMeter”, “Gas”, tonumber(string.match(string.match(data, “(%d+.%d+*m3)”), “%d+.%d+”)), THIS_DEVICE)
---------------------------------------------------------------------------------------------
– Check if we have to process energy IMPORT meter(s)
---------------------------------------------------------------------------------------------
elseif (string.sub(data, 1, 7) == “1-0:1.8”) then

I also took out the end statement that goes with the if (indGasComming == 1) then

I’m not posting the complete file as I made more changes to calculate my real usage accounting for my solar pannels.
Cheers Rene.

Hi Rene,

Tried to change wat I think you did but then my LUA doesn’t start up properly so that I’ve to revert back to the original xml file.

furthermore I don’t see a code in the what I suppose is there telegram content like “0-1:24.3.0” which might mean that the meter is not sending info from the gasmeter. I did speak to a chap from Enexis who told me that the meter could be read on their side.

50 03/23/14 15:26:02.878 luup_log:58: Meter data (not processed): “1-0:21.7.0(00.234kW)" <0x2d7e7680>
50 03/23/14 15:26:02.908 luup_log:58: Meter data (not processed): "1-0:22.7.0(00.000
kW)” <0x2d7e7680>
50 03/23/14 15:26:02.938 luup_log:58: Meter data (not processed): “1-0:41.7.0(00.021kW)" <0x2d7e7680>
50 03/23/14 15:26:02.968 luup_log:58: Meter data (not processed): "1-0:42.7.0(00.000
kW)” <0x2d7e7680>
50 03/23/14 15:26:02.998 luup_log:58: Meter data (not processed): “1-0:61.7.0(00.146kW)" <0x2d7e7680>
50 03/23/14 15:26:03.028 luup_log:58: Meter data (not processed): "1-0:62.7.0(00.000
kW)” <0x2d7e7680>
50 03/23/14 15:26:03.038 luup_log:58: Meter data (not processed): “!0844” <0x2d7e7680>
08 03/23/14 15:26:08.029 JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: LogIpRequest <0x2d5e7680>
08 03/23/14 15:26:08.030 JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1 <0x2d5e7680>
08 03/23/14 15:26:08.030 JobHandler_LuaUPnP::HandleActionRequest argument action=LogIpRequest <0x2d5e7680>
08 03/23/14 15:26:08.030 JobHandler_LuaUPnP::HandleActionRequest argument IpAddress=192.168.1.22 <0x2d5e7680>
08 03/23/14 15:26:08.031 JobHandler_LuaUPnP::HandleActionRequest argument MacAddress=68:9c:70:77:35:0d <0x2d5e7680>
50 03/23/14 15:26:11.828 luup_log:58: MeterType: [KFM5KAIFA-METER] <0x2d7e7680>
06 03/23/14 15:26:11.829 Device_Variable::m_szValue_set device: 58 service: urn:brutgrink-com:serviceId:dutchSmartMeter variable: MeterType was: KFM5KAIFA-METER now: KFM5KAIFA-METER #hooks: 0 upnp: 0 v:0xc2c650/NONE duplicate:1 <0x2d7e7680>
50 03/23/14 15:26:11.858 luup_log:58: Meter data (not processed): “1-3:0.2.8(40)” <0x2d7e7680>
50 03/23/14 15:26:11.889 luup_log:58: Meter data (not processed): “0-0:1.0.0(140323152614W)” <0x2d7e7680>
50 03/23/14 15:26:11.929 luup_log:58: Meter data (not processed): “0-0:96.1.1(4530303033303030303031363437363133)” <0x2d7e7680>
50 03/23/14 15:26:11.959 luup_log:58: Power meter ImportRate1: 227.128000 <0x2d7e7680>
06 03/23/14 15:26:11.959 Device_Variable::m_szValue_set device: 66 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: KWH was: 227.127 now: 227.128 #hooks: 0 upnp: 0 v:0xc10240/NONE duplicate:0 <0x2d7e7680>
50 03/23/14 15:26:11.989 luup_log:58: Power meter ImportRate2: 291.216000 <0x2d7e7680>
06 03/23/14 15:26:11.989 Device_Variable::m_szValue_set device: 67 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: KWH was: 291.216 now: 291.216 #hooks: 0 upnp: 0 v:0xc10240/NONE duplicate:1 <0x2d7e7680>
50 03/23/14 15:26:12.018 luup_log:58: Power meter ExportRate1: 0.000000 <0x2d7e7680>
06 03/23/14 15:26:12.019 Device_Variable::m_szValue_set device: 68 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: KWH was: 0 now: 0 #hooks: 0 upnp: 0 v:0xc10240/NONE duplicate:1 <0x2d7e7680>
50 03/23/14 15:26:12.048 luup_log:58: Power meter ExportRate2: 0.000000 <0x2d7e7680>
06 03/23/14 15:26:12.049 Device_Variable::m_szValue_set device: 69 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: KWH was: 0 now: 0 #hooks: 0 upnp: 0 v:0xc10240/NONE duplicate:1 <0x2d7e7680>
50 03/23/14 15:26:12.078 luup_log:58: Currently active tariff: [0001] <0x2d7e7680>
06 03/23/14 15:26:12.079 Device_Variable::m_szValue_set device: 58 service: urn:brutgrink-com:serviceId:dutchSmartMeter variable: ActiveTariff was: 1 now: 1 #hooks: 0 upnp: 0 v:0xc2c670/NONE duplicate:1 <0x2d7e7680>
50 03/23/14 15:26:12.108 luup_log:58: CurrentWattsImport: [00.400] <0x2d7e7680>
50 03/23/14 15:26:12.109 luup_log:58: CurrentActiveTariffImport: [1] <0x2d7e7680>
06 03/23/14 15:26:12.109 Device_Variable::m_szValue_set device: 58 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Watts was: 401 now: 400 #hooks: 1 upnp: 0 v:0xc0fce0/NONE duplicate:0 <0x2d7e7680>
50 03/23/14 15:26:12.110 luup_log:33: Entered getErgyRegKey_ui5 <0x2d7e7680>
50 03/23/14 15:26:12.204 luup_log:33: New customer ID3 <0x2d7e7680>
06 03/23/14 15:26:12.205 Device_Variable::m_szValue_set device: 33 service: urn:micasaverde-com:serviceId:EEM-Plugin1 variable: GotKey was: 1 now: 1 #hooks: 0 upnp: 0 v:0xc2e468/NONE duplicate:1 <0x2d7e7680>
06 03/23/14 15:26:12.210 Device_Variable::m_szValue_set device: 58 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Log was: 401,552,3015,1395584762,3363 now: 400,551,3015,1395584772,3373 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2d7e7680>
06 03/23/14 15:26:12.211 Device_Variable::m_szValue_set device: 66 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Watts was: 401 now: 400 #hooks: 1 upnp: 0 v:0xc0fce0/NONE duplicate:0 <0x2d7e7680>
50 03/23/14 15:26:12.212 luup_log:33: Entered getErgyRegKey_ui5 <0x2d7e7680>
50 03/23/14 15:26:12.305 luup_log:33: New customer ID3 <0x2d7e7680>
06 03/23/14 15:26:12.306 Device_Variable::m_szValue_set device: 33 service: urn:micasaverde-com:serviceId:EEM-Plugin1 variable: GotKey was: 1 now: 1 #hooks: 0 upnp: 0 v:0xc2e468/NONE duplicate:1 <0x2d7e7680>
06 03/23/14 15:26:12.310 Device_Variable::m_szValue_set device: 66 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Log was: 401,552,3015,1395584762,3363 now: 400,551,3015,1395584772,3373 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2d7e7680>
06 03/23/14 15:26:12.311 Device_Variable::m_szValue_set device: 67 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Watts was: 0 now: 0 #hooks: 1 upnp: 0 v:0xc0fce0/NONE duplicate:1 <0x2d7e7680>
50 03/23/14 15:26:12.312 luup_log:58: CurrentWattsExport: [00.000] <0x2d7e7680>
50 03/23/14 15:26:12.313 luup_log:58: CurrentActiveTariffExport: [1] <0x2d7e7680>
06 03/23/14 15:26:12.313 Device_Variable::m_szValue_set device: 68 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: Watts was: -0 now: -0 #hooks: 1 upnp: 0 v:0xc0fce0/NONE duplicate:1 <0x2d7e7680>
01 03/23/14 15:26:12.314 GetLuaInterface can’t find device type: 3/0xd48d60 str: -69 <0x2d7e7680>
01 03/23/14 15:26:12.314 luup_variable_set interface 0xcdb790 args 4 <0x2d7e7680>
50 03/23/14 15:26:12.315 luup_log:58: Meter data (not processed): “0-0:17.0.0(999.9kW)" <0x2d7e7680>
50 03/23/14 15:26:12.316 luup_log:58: Meter data (not processed): “0-0:96.3.10(1)” <0x2d7e7680>
50 03/23/14 15:26:12.318 luup_log:58: Meter data (not processed): “0-0:96.7.21(00010)” <0x2d7e7680>
50 03/23/14 15:26:12.319 luup_log:58: Meter data (not processed): “0-0:96.7.9(00007)” <0x2d7e7680>
50 03/23/14 15:26:12.321 luup_log:58: Meter data (not processed): "1-0:99.97.0(1)(0-0:96.7.19)(000101000036W)(2147483647
s)” <0x2d7e7680>
50 03/23/14 15:26:12.348 luup_log:58: Meter data (not processed): “1-0:32.32.0(00000)” <0x2d7e7680>
50 03/23/14 15:26:12.378 luup_log:58: Meter data (not processed): “1-0:52.32.0(00000)” <0x2d7e7680>
50 03/23/14 15:26:12.408 luup_log:58: Meter data (not processed): “1-0:72.32.0(00001)” <0x2d7e7680>
50 03/23/14 15:26:12.438 luup_log:58: Meter data (not processed): “1-0:32.36.0(00000)” <0x2d7e7680>
50 03/23/14 15:26:12.478 luup_log:58: Meter data (not processed): “1-0:52.36.0(00000)” <0x2d7e7680>
50 03/23/14 15:26:12.488 luup_log:58: Meter data (not processed): “1-0:72.36.0(00000)” <0x2d7e7680>
50 03/23/14 15:26:12.518 luup_log:58: Meter data (not processed): “0-0:96.13.1()” <0x2d7e7680>
50 03/23/14 15:26:12.590 luup_log:58: Meter data (not processed): “0-0:96.13.0()” <0x2d7e7680>
50 03/23/14 15:26:12.638 luup_log:58: Meter data (not processed): “1-0:31.7.0(001A)" <0x2d7e7680>
50 03/23/14 15:26:12.698 luup_log:58: Meter data (not processed): "1-0:51.7.0(000
A)” <0x2d7e7680>
50 03/23/14 15:26:12.768 luup_log:58: Meter data (not processed): “1-0:71.7.0(000A)" <0x2d7e7680>
50 03/23/14 15:26:12.798 luup_log:58: Meter data (not processed): "1-0:21.7.0(00.233
kW)” <0x2d7e7680>
50 03/23/14 15:26:12.828 luup_log:58: Meter data (not processed): “1-0:22.7.0(00.000kW)" <0x2d7e7680>
50 03/23/14 15:26:12.858 luup_log:58: Meter data (not processed): "1-0:41.7.0(00.021
kW)” <0x2d7e7680>
50 03/23/14 15:26:12.888 luup_log:58: Meter data (not processed): “1-0:42.7.0(00.000kW)" <0x2d7e7680>
50 03/23/14 15:26:12.918 luup_log:58: Meter data (not processed): "1-0:61.7.0(00.145
kW)” <0x2d7e7680>
50 03/23/14 15:26:12.948 luup_log:58: Meter data (not processed): “1-0:62.7.0(00.000*kW)” <0x2d7e7680>
50 03/23/14 15:26:12.949 luup_log:58: Meter data (not processed): “!63A0” <0x2d7e7680>
this is wat I see in a terminal . after this the whole process starts again

Thanks again

Thijs

Hi Thijs,

I have the exact same Kaifa meter as you and the line for the Gas meter looks something like this.
0-1:24.2.1(101209110000W)(12785.123*m3)

This is also how it shows per the DSMR 4 standard http://www.gpx.nl/pdf/poort-P1-voorbeeld-2012.pdf

I do not see a line like that in your output, so no idea where it is hiding at. You could connect the cable to a PC USB port and look at the full output to see if you can find a possible string for the Gas meter. Note that is you have Stadsverwarming or something like that things would be different.

Cheer Rene

hai Rene,

thanks for your input. i’ve got no stadsverwarming so that’s not the problem. i’ll phone enexis again since i really think the connection doesn’t connect as it should be.

in this part of the forum one of the members noted that after the meter was actually read by the company it started sending values for gas as well.

for bfromdruten thanks for your work and also for mfp for their work

;D ;D ;D ;D ;D ;D

I also have installed the device, and get nothing. I have a Landis & Gyr smart meter, newest version, DSMR4.0, so I set the serial port to 115200-8-N-1.

I have read through this topic and found the following:

I am a new Vera user, so I need to be sure. If I should see some action, I should see this on the page ‘My alerts’, right? I select the smart meter device and then the actions should show, right?
If this is the case, then I have a problem: no action at all. What can be the problem?

Thanks for any help.

the vera log can be viewed by:

http://Ipadres-Vera/port_3480/data_request?id=lr_al_info&fnc=getLog&app=localapp or install a log viewer plugin en filter on dutch.

Thanks! I will try this next week. Why not now? Because I found out that the ‘standard’ cable does not work with the newest Landis & Gyr smart meters. I need to have a different cable. I found and ordered that one on Smart Meter Dashboard.
Let’s hope that Landis did not change the data protocol as well …

Didn’t need to check the vera log, because the new cable did the trick: I get the data. Gas meter remains zero, but that is something I will check with the provider.
I think this is important info for new users of the plugin: when you get the Landis & Gyr E350 or ZCF110, you need to have another cable. Om Smart Meter Dashboard, it is called: ‘Type DSMR 2/3/4 (V2)’.

Hi everybody,

In the meantime I’ve had my stuff (smart meter) fixed since I’ve found out that my Landis Gyr did not send to the Kaifa. This was fixed yesterday and for information purpose, by cycling through the readings on the Kaifa one now sees a notice in the form " GAS + sr number of the Landys". via terminal(or Putty in a Windows environment) there is now a new line in the telegram indicating readout of the gasmeter.

So its important to check if the gasmeter is actually coupled.

Next step is to adjust the I-dutchsmartmeter.xml for readout of the line itself which is the following:
50 04/30/14 10:31:48.598 luup_log:58: Meter data (not processed): 0-1:24.2.1(140430100000S)(00241.036*m3)" <0x2e1dd680>
50 04/30/14 10:31:48.628 luup_log:58: Meter data (not processed): “0-1:24.4.0(1)” <0x2e1dd680>

Maybe Reneboer has the answer but adjusting like he suggested lets my Lua crash (stops functioning).

To Reneboer I’ve send a PM since he didn’t want to share the whole file but if somebody else got the solution please let me know.

in short:

[ol][li]Check with your “netbeheerder” if the gas can actually be read on their side[/li]
[li]on the Kaifa the serial number of the gasmeter(lands) must be visible otherwise its not correctly coupled[/li]
[li]Check with your "netbeheerdif the gas can actually be read on their side[/li]
[li]check whether there is a line in the telgram which is showing the gasreading[/li]
[li]maybe adjust the I-dutchsmartmeter.xml[/li][/ol]

I’ve bought a P1 cable from wireless wonen and this seems to work but they don’t mention anything about versions regarding DSMR 2/3/4 or something similar

Greetings Thijs

Thijs, whay version is your dsmr? Its noted on your meter.

My configuration:
Vera Lite.
E-meter: Kaifa MA305
Gas meter: Landis&Gyr G350
Cable: FTDI RS232 > USB

The telegram from the Dutch smart meter is:
/KFM5KAIFA-METER

1-3:0.2.8(40)
0-0:1.0.0(140430004552S)
0-0:96.1.1(4530303033303030303032313239313133)
1-0:1.8.1(000231.094kWh)
1-0:1.8.2(000277.981
kWh)
1-0:2.8.1(000066.164kWh)
1-0:2.8.2(000174.446
kWh)
0-0:96.14.0(0001)
1-0:1.7.0(02.104kW)
1-0:2.7.0(00.000
kW)
0-0:17.0.0(999.9kW)
0-0:96.3.10(1)
0-0:96.7.21(00030)
0-0:96.7.9(00018)
1-0:99.97.0(2)(0-0:96.7.19)?(140402084849S)(0000000535
s)?(000101000019W)(2147483647s)
1-0:32.32.0(00000)
1-0:52.32.0(00000)
1-0:72.32.0(00000)
1-0:32.36.0(00000)
1-0:52.36.0(00000)
1-0:72.36.0(00000)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(000
A)
1-0:51.7.0(007A)
1-0:71.7.0(001
A)
1-0:21.7.0(00.198kW)
1-0:22.7.0(00.000
kW)
1-0:41.7.0(01.705kW)
1-0:42.7.0(00.000
kW)
1-0:61.7.0(00.202kW)
1-0:62.7.0(00.000
kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303136353631323034373737313133)
0-1:24.2.1(140430000000S)(00235.232*m3)
0-1:24.4.0(1)
!A89C

In this telegram the gas reading works fine.
But, in Vera the readout for the electricity is working fine, the gas readout is 0.

This is the I_dutchSmartMeter.xml code:

– Data row has been received via serial. Process
---------------------------------------------------------------------------------------------
function dutchSmartMeterIncoming(data)
if (string.len(data) > 0) then
if (string.sub(data, 1, 10) == “0-1:24.2.1”) then
luup.log(“Gas meter reading in next line”)
indGasComming = 1
else
---------------------------------------------------------------------------------------------
– Check if we have to process gas meter
---------------------------------------------------------------------------------------------
if (indGasComming == 1) then
luup.log(“Gas meter: [” … string.match(data, “%d+.%d+”) … “]”)
luup.variable_set(“urn:brutgrink-com:serviceId:dutchSmartMeter”, “Gas”, tonumber(string.match(data, “%d+.%d+”)), THIS_DEVICE)

Here is a pice of the LuaUPnP log:
50 05/01/14 22:50:26.945 luup_log:91: MeterType: [KFM5KAIFA-METER] <0x2d8bf680>
06 05/01/14 22:50:26.946 Device_Variable::m_szValue_set device: 91 service: urn:brutgrink-com:serviceId:dutchSmartMeter variable: e[35;1mMeterTypee[0m was: KFM5KAIFA-METER now: KFM5KAIFA-METER #hooks: 0 upnp: 0 v:0xa19490/NONE duplicate:1 <0x2d8bf680>
50 05/01/14 22:50:26.975 luup_log:91: Meter data (not processed): “1-3:0.2.8(40)” <0x2d8bf680>
50 05/01/14 22:50:27.015 luup_log:91: Meter data (not processed): “0-0:1.0.0(140501225050S)” <0x2d8bf680>
50 05/01/14 22:50:27.036 luup_log:91: Meter data (not processed): “0-0:96.1.1(4530303033303030303032313239313133)” <0x2d8bf680>
50 05/01/14 22:50:27.065 luup_log:91: Power meter ImportRate1: 238.095000 <0x2d8bf680>
06 05/01/14 22:50:27.066 Device_Variable::m_szValue_set device: 98 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mKWHe[0m was: 238.095 now: 238.095 #hooks: 0 upnp: 0 v:0xa22400/NONE duplicate:1 <0x2d8bf680>
50 05/01/14 22:50:27.096 luup_log:91: Power meter ImportRate2: 284.732000 <0x2d8bf680>
06 05/01/14 22:50:27.096 Device_Variable::m_szValue_set device: 99 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mKWHe[0m was: 284.731 now: 284.732 #hooks: 0 upnp: 0 v:0xa22400/NONE duplicate:0 <0x2d8bf680>
50 05/01/14 22:50:27.125 luup_log:91: Power meter ExportRate1: 66.164000 <0x2d8bf680>
06 05/01/14 22:50:27.126 Device_Variable::m_szValue_set device: 100 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mKWHe[0m was: 66.164 now: 66.164 #hooks: 0 upnp: 0 v:0xa22400/NONE duplicate:1 <0x2d8bf680>
50 05/01/14 22:50:27.155 luup_log:91: Power meter ExportRate2: 188.066000 <0x2d8bf680>
06 05/01/14 22:50:27.156 Device_Variable::m_szValue_set device: 101 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mKWHe[0m was: 188.066 now: 188.066 #hooks: 0 upnp: 0 v:0xa22400/NONE duplicate:1 <0x2d8bf680>
50 05/01/14 22:50:27.175 luup_log:91: Currently active tariff: [0002] <0x2d8bf680>
06 05/01/14 22:50:27.176 Device_Variable::m_szValue_set device: 91 service: urn:brutgrink-com:serviceId:dutchSmartMeter variable: e[35;1mActiveTariffe[0m was: 2 now: 2 #hooks: 0 upnp: 0 v:0xa0be48/NONE duplicate:1 <0x2d8bf680>
50 05/01/14 22:50:27.205 luup_log:91: CurrentWattsImport: [00.579] <0x2d8bf680>
50 05/01/14 22:50:27.206 luup_log:91: CurrentActiveTariffImport: [2] <0x2d8bf680>
06 05/01/14 22:50:27.206 Device_Variable::m_szValue_set device: 91 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mWattse[0m was: 582 now: 579 #hooks: 0 upnp: 0 v:0xa22360/NONE duplicate:0 <0x2d8bf680>
06 05/01/14 22:50:27.207 Device_Variable::m_szValue_set device: 91 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mLoge[0m was: 582,639,963,1398977417,1218 now: 579,638,963,1398977427,1228 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2d8bf680>
06 05/01/14 22:50:27.208 Device_Variable::m_szValue_set device: 99 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mWattse[0m was: 582 now: 579 #hooks: 0 upnp: 0 v:0xa22360/NONE duplicate:0 <0x2d8bf680>
06 05/01/14 22:50:27.209 Device_Variable::m_szValue_set device: 99 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mLoge[0m was: 582,639,963,1398977417,1218 now: 579,638,963,1398977427,1228 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2d8bf680>
06 05/01/14 22:50:27.209 Device_Variable::m_szValue_set device: 98 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mWattse[0m was: 0 now: 0 #hooks: 0 upnp: 0 v:0xa22360/NONE duplicate:1 <0x2d8bf680>
50 05/01/14 22:50:27.235 luup_log:91: CurrentWattsExport: [00.000] <0x2d8bf680>
50 05/01/14 22:50:27.236 luup_log:91: CurrentActiveTariffExport: [2] <0x2d8bf680>
06 05/01/14 22:50:27.236 Device_Variable::m_szValue_set device: 101 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mWattse[0m was: -0 now: -0 #hooks: 0 upnp: 0 v:0xa22360/NONE duplicate:1 <0x2d8bf680>
06 05/01/14 22:50:27.237 Device_Variable::m_szValue_set device: 100 service: urn:micasaverde-com:serviceId:EnergyMetering1 variable: e[35;1mWattse[0m was: 0 now: 0 #hooks: 0 upnp: 0 v:0xa22360/NONE duplicate:1 <0x2d8bf680>
50 05/01/14 22:50:27.265 luup_log:91: Meter data (not processed): “0-0:17.0.0(999.9kW)" <0x2d8bf680>
50 05/01/14 22:50:27.295 luup_log:91: Meter data (not processed): “0-0:96.3.10(1)” <0x2d8bf680>
50 05/01/14 22:50:27.325 luup_log:91: Meter data (not processed): “0-0:96.7.21(00030)” <0x2d8bf680>
50 05/01/14 22:50:27.355 luup_log:91: Meter data (not processed): “0-0:96.7.9(00018)” <0x2d8bf680>
50 05/01/14 22:50:27.456 luup_log:91: Meter data (not processed): "1-0:99.97.0(2)(0-0:96.7.19)(140402084849S)(0000000535
s)(000101000019W)(2147483647s)" <0x2d8bf680>
50 05/01/14 22:50:27.485 luup_log:91: Meter data (not processed): “1-0:32.32.0(00000)” <0x2d8bf680>
50 05/01/14 22:50:27.515 luup_log:91: Meter data (not processed): “1-0:52.32.0(00000)” <0x2d8bf680>
50 05/01/14 22:50:27.545 luup_log:91: Meter data (not processed): “1-0:72.32.0(00000)” <0x2d8bf680>
50 05/01/14 22:50:27.575 luup_log:91: Meter data (not processed): “1-0:32.36.0(00000)” <0x2d8bf680>
50 05/01/14 22:50:27.605 luup_log:91: Meter data (not processed): “1-0:52.36.0(00000)” <0x2d8bf680>
50 05/01/14 22:50:27.635 luup_log:91: Meter data (not processed): “1-0:72.36.0(00000)” <0x2d8bf680>
50 05/01/14 22:50:27.665 luup_log:91: Meter data (not processed): “0-0:96.13.1()” <0x2d8bf680>
50 05/01/14 22:50:27.725 luup_log:91: Meter data (not processed): “0-0:96.13.0()” <0x2d8bf680>
50 05/01/14 22:50:27.785 luup_log:91: Meter data (not processed): "1-0:31.7.0(000
A)” <0x2d8bf680>
50 05/01/14 22:50:27.845 luup_log:91: Meter data (not processed): “1-0:51.7.0(000A)" <0x2d8bf680>
50 05/01/14 22:50:27.905 luup_log:91: Meter data (not processed): "1-0:71.7.0(001
A)” <0x2d8bf680>
50 05/01/14 22:50:27.945 luup_log:91: Meter data (not processed): “1-0:21.7.0(00.156kW)" <0x2d8bf680>
50 05/01/14 22:50:27.965 luup_log:91: Meter data (not processed): "1-0:22.7.0(00.000
kW)” <0x2d8bf680>
50 05/01/14 22:50:27.995 luup_log:91: Meter data (not processed): “1-0:41.7.0(00.074kW)" <0x2d8bf680>
50 05/01/14 22:50:28.045 luup_log:91: Meter data (not processed): "1-0:42.7.0(00.000
kW)” <0x2d8bf680>
50 05/01/14 22:50:28.055 luup_log:91: Meter data (not processed): “1-0:61.7.0(00.349kW)" <0x2d8bf680>
50 05/01/14 22:50:28.085 luup_log:91: Meter data (not processed): "1-0:62.7.0(00.000
kW)” <0x2d8bf680>
50 05/01/14 22:50:28.115 luup_log:91: Meter data (not processed): “0-1:24.1.0(003)” <0x2d8bf680>
50 05/01/14 22:50:28.146 luup_log:91: Meter data (not processed): “0-1:96.1.0(4730303136353631323034373737313133)” <0x2d8bf680>
50 05/01/14 22:50:28.266 luup_log:91: Gas meter reading in next line <0x2d8bf680>
50 05/01/14 22:50:28.295 luup_log:91: Gas meter: [0-1] <0x2d8bf680>
01 05/01/14 22:50:28.296 e[31;1mluup_variable_set interface 0xabfed8 no Gas/(null)e[0m <0x2d8bf680>
50 05/01/14 22:50:28.305

What pice of code do i have to change to read the gas value’s?
Thanks so far,
Wim

Hi SanderL

I’ve got a DSMR is 4
:slight_smile:

Hi,

I removed most of my cusomizations from this version. I have not tested it but it should help you when you have a DSMR 4 meter.

– Modified version of dutchSmartMeter from Brutgrink

	-- Service IDs we use
	MY_SERVICE_ID = "urn:brutgrink-com:serviceId:dutchSmartMeter"

    ---------------------------------------------------------------------------------------------
	-- Utility functions
    ---------------------------------------------------------------------------------------------
	-- Log wrapper so we can quickly turn it off and on for debugging
	function do_writeLog(sMessage)

– luup.log(sMessage)
end
– Do a optimized Get and Set function
local function luup_var_get(name, service, device)
return luup.variable_get(service or MY_SERVICE_ID, name, device or THIS_DEVICE)
end
– Only set variable when changed. This reduces Vera memory writes and logging.
local function luup_var_set (name, value, service, device)
service = service or MY_SERVICE_ID
device = device or THIS_DEVICE
local old = luup_var_get(name, service, device)
if tostring(value) ~= old then
luup.variable_set(service, name, value, device)
end
end
– Thanks to guessed for this snippet.
function findChild(parentDevice, label)
for k, v in pairs(luup.devices) do
if (v.device_num_parent == parentDevice and v.id == label) then
return k
end
end

        -- Dump a copy of the Global Module list for debugging purposes.
        for k, v in pairs(luup.devices) do
            do_writeLog("Device Number: " .. k ..
                   " v.device_type: " .. tostring(v.device_type) ..
                    " v.device_num_parent: " .. tostring(v.device_num_parent) ..
                    " v.id: " .. tostring(v.id))
        end 
    end


    ---------------------------------------------------------------------------------------------
	-- Module startup
    ---------------------------------------------------------------------------------------------
    function dutchSmartMeter_Startup(lul_device)
        THIS_DEVICE = lul_device
        do_writeLog("Starting dutchSmartMeter device: " .. tostring(lul_device))
        -- get child devices
        for k, v in pairs(luup.devices) do
            if (v.device_num_parent == lul_device) then
                do_writeLog( "Found child device, lets save! id " .. tostring(v.id) .. " device " .. tostring(v.device_type))
          
                if (tostring(v.device_type) == POWER_SERVICE_ID) then
                    powerMeterCount = powerMeterCount + 1
                    powerMeterDevice[powerMeterCount] = v.id
                end
            end
        end
          
		-- Assure device variables exist
        local gasMeter = luup_var_get("Gas")
        local activeTariff = luup_var_get("ActiveTariff")
        local meterType = luup_var_get("MeterType")
        if ((gasMeter or "") == "") then
            luup_var_set("Gas", 0)
        end
        if ((activeTariff or "") == "") then
            luup_var_set("ActiveTariff", 0)
        end    
        if ((meterType or "") == "") then
            luup_var_set("MeterType", "Unknown")
        end    
		
        -- Create devices needed if not exist
        addPowerMeterDevice("ImportRate1")
        addPowerMeterDevice("ImportRate2")
        addPowerMeterDevice("ExportRate1")
        addPowerMeterDevice("ExportRate2")
    end
  
    -- Add device is not yet found
    function addPowerMeterDevice(meterID)
        -- If we can't find a device add a new child meterID
        if findChild(THIS_DEVICE, meterID) == nil then
            local child_devices = luup.chdev.start(THIS_DEVICE);  

            -- First add all 'old' children to the tree
            for teller = 1, powerMeterCount do
                luup.chdev.append(THIS_DEVICE, child_devices, powerMeterDevice[teller], "Powermeter " .. powerMeterDevice[teller] , 
                POWER_SERVICE_ID,"D_PowerMeter1.xml","","",false)
            end

            -- Now add the new device to the tree
            do_writeLog("Tree buildup, now add " .. meterID)

            luup.chdev.append(THIS_DEVICE, child_devices, meterID, "Powermeter " .. meterID , 
              POWER_SERVICE_ID,"D_PowerMeter1.xml","","",false)

            powerMeterCount = powerMeterCount + 1
            powerMeterDevice[powerMeterCount] = meterID
        
            -- Synch the new tree with the old three
            do_writeLog("Start sync")
            luup.chdev.sync(THIS_DEVICE, child_devices)
            do_writeLog("End sync")       
        end        
    end

    ---------------------------------------------------------------------------------------------
    -- Smart Meter Data row has been received via serial. Process
    ---------------------------------------------------------------------------------------------
    function dutchSmartMeterIncoming(data)
		local meterGridUsage = 0
        if (string.len(data) > 0) then

            -- Check if we have to process gas meter. Tested only with DMSR 4 meter!
			if (string.sub(data, 1, 10) == "0-1:24.2.1") then
                do_writeLog("Gas meter: [" .. string.match(string.match(data, "(%d+.%d+*m3)"), "%d+.%d+") .. "]")
                luup_var_set("Gas", math.floor(tonumber(string.match(string.match(data, "(%d+.%d+*m3)"), "%d+.%d+"))))

				-- Check if we have to process energy IMPORT meter(s)
            elseif (string.sub(data, 1, 7) == "1-0:1.8") then
                local meterValue = tonumber(string.match(string.sub(data,10), "%d+.%d+"))
                local meterID = string.match(string.sub(data,9), "%d+")

                do_writeLog(string.format("Power meter ImportRate%s: %f",meterID,meterValue))
                luup_var_set("KWH", math.floor(meterValue), ENGERGY_SERVICE_ID, findChild(THIS_DEVICE,"ImportRate" .. meterID))
				-- Set meterstand afname value (T1 ot T2) value
				luup_var_set("meterT"..meterID, math.floor(meterValue))
                    
            -- Check if we have to process energy EXPORT meter(s)
            elseif (string.sub(data, 1, 7) == "1-0:2.8") then
                local meterValue = tonumber(string.match(string.sub(data,10), "%d+.%d+"))
                local meterID = string.match(string.sub(data,9), "%d+")

                do_writeLog(string.format("Power meter ExportRate%s: %f",meterID,meterValue))
                luup_var_set("KWH", math.floor(meterValue), ENGERGY_SERVICE_ID, findChild(THIS_DEVICE,"ExportRate" .. meterID))
				-- Set meterstand teruglever value (T1- ot T2-) value
				luup_var_set("meterT"..meterID.."m", math.floor(meterValue))
                    
            -- Check current tariff
            elseif (string.sub(data, 1, 11) == "0-0:96.14.0") then
                do_writeLog("Currently active tariff: [" .. string.match(string.sub(data,12), "%d+") .. "]")
                luup_var_set("ActiveTariff", tonumber(string.match(string.sub(data,12), "%d+")))

            -- Check current watts import
            elseif (string.sub(data, 1, 9) == "1-0:1.7.0") then
                -- get active tariff variable         
                local activeTariff = luup_var_get("ActiveTariff")

                do_writeLog("CurrentWattsImport: [" .. string.match(string.sub(data,10), "%d+.%d+") .. "]")
                do_writeLog("CurrentActiveTariffImport: [" .. activeTariff .. "]")

                -- Current Grid import value   
                if (tonumber(string.match(string.sub(data,10), "%d+.%d+"))*1000.0 > 0) then
					luup_var_set("Watts", tonumber(string.match(string.sub(data,10), "%d+.%d+"))*1000.0)
                end

				-- import rate 2
                luup_var_set("Watts", tonumber(string.match(string.sub(data,10), "%d+.%d+"))*1000.0, ENGERGY_SERVICE_ID, findChild(THIS_DEVICE,"ImportRate" .. activeTariff))
                -- import rate 1
                luup_var_set("Watts", 0, ENGERGY_SERVICE_ID, findChild(THIS_DEVICE,"ImportRate" .. (1+(activeTariff % 2))))

            -- Check current watts export
            elseif (string.sub(data, 1, 9) == "1-0:2.7.0") then
                -- get active tariff variable         
                local activeTariff = luup_var_get("ActiveTariff")

                do_writeLog("CurrentWattsExport: [" .. string.match(string.sub(data,10), "%d+.%d+") .. "]")
                do_writeLog("CurrentActiveTariffExport: [" .. activeTariff .. "]")

                -- Current Grid export value   
                if (tonumber(string.match(string.sub(data,10), "%d+.%d+"))*1000.0 > 0) then
					luup_var_set("Watts", tonumber(string.match(string.sub(data,10), "%d+.%d+"))*-1000.0)
                end

                -- export rate 2
                luup_var_set("Watts", tonumber(string.match(string.sub(data,10), "%d+.%d+"))*-1000.0, ENGERGY_SERVICE_ID, findChild(THIS_DEVICE,"ExportRate" .. activeTariff))
                -- export rate 1
                luup_var_set("Watts", "-0", ENGERGY_SERVICE_ID, findChild(THIS_DEVICE,"ExportRate" .. (1+(activeTariff % 2))))
                                                      
            -- Check meter type
            elseif (string.sub(data,1,1) == "/") then
                do_writeLog("MeterType: [" .. string.sub(data,2) .. "]")
                luup_var_set("MeterType", string.sub(data,2))
            else
				-- Do not log this unless really needed. New smart meters produce a lot of data.

– do_writeLog(string.format(“Meter data (not processed): %q”,data))
end
end
end

</functions>

I’m trying to get this working with a DSMR 4, but no luck so far. I’m using an FTDI cable, reversed the RX pin, programmed and cycled the port. I tried both the listed port settings as well as the settings recommended for this meter (115200, 8N1) but no data is coming through. The logs do not show anything that would indicate incoming data either.

I’ve also connected the cable to a laptop and tried reading the port directly via Putty. No joy either :frowning:

Any suggestions as to what to try next?

@Unikraan

Have you tried deleting your device and afterward recreating the device? When gas reading is disabled it will stay on zerro.

In have the same problem. DSMR 4 meter and I get electricity readings after changing the serial settings to 15200, 8, N,1 but no gas readings (stays at 0 in Vera).

I called the ‘netbeheerder’ and they say the gasmeter is linked and they get readings. When cycling trough the electricity meter I also get and entry GAS and an 8 digit number.

What would be the best next step in which order? Change the XML, re-install the plugin or discuss with the ‘netbeheerder’ again? If the lather; what should I ask them as it is difficult to discuss with them on the phone if they say all is ok on their side.

p.s. my understanding is that I can also read the raw data via Terminal on my Macbook. After connecting directly to the USB; how do I connect via Terminal?

UPDATE; Replaced i_dutchsmartmeter.xml with attached one and I now get Gas reading. I now see it is only total Gas consumption; I was actually hoping it was also actual gas consumption.

@ MFP:
Yes, I have deleted first the Smart Meter App.

Ok, strange.

After I had disconnected the USB hub (to move the Vera) and reconnected I have problems now getting electricity readings. After deleting and re-installing all (just to make sure) I get GAS reading but no electra readings anymore.

Any suggestions?