saberone / pimatic-smartmeter

Read energy usage data from a "smartmeter" through it's P1 port
MIT License
0 stars 6 forks source link

Gasmeter not logging #11

Closed rutgerh closed 8 years ago

rutgerh commented 8 years ago

Hi All,

I'm struggling to get my gasmeter working, energy consumption is working correctly.

Output from smartmeter:

---BEGIN--
0DA4
/XMX5LGBBFG1009264202

1-3:0.2.8(42)
0-0:1.0.0(160206093352W)
0-0:96.1.1(4530303331303033313732393931323135)
1-0:1.8.1(000022.940*kWh)
1-0:1.8.2(000035.495*kWh)
1-0:2.8.1(000000.000*kWh)
1-0:2.8.2(000000.000*kWh)
0-0:96.14.0(0001)
1-0:1.7.0(00.349*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00001)
0-0:96.7.9(00000)
1-0:99.97.0(0)(0-0:96.7.19)
1-0:32.32.0(00000)
1-0:32.36.0(00000)
0-0:96.13.1()
0-0:96.13.0()
1-0:31.7.0(002*A)
1-0:21.7.0(00.349*kW)
1-0:22.7.0(00.000*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303235303033333236333939303135)
0-1:24.2.1(160206090000W)(00060.913*m3)
---END----

In p1meterdata.js I have this regex; var gasTotalUsage = returnRegExResult(data, /^0-1:24\.2\.1\(\d+[SW]\)\((\d+\.\d+)\*m3\)/m);

As far I can test the regex is working: https://regex101.com/r/kY1pE6/1

The status of gas usage is saying "Unknown" , any suggestions were to look ? I think i'm missing something.

zwollerob commented 8 years ago

you need to edit p1meterdata.js to :

var gasTotalUsage = returnRegExResult(data, /^0-1:24\.3\.0(.*)\(m3\)[\r]?[\n]?\(0+(\d+\.\d+)\)/m, 2);

watch the 2); :+1:

rutgerh commented 8 years ago

I did get it working with this regex; var gasTotalUsage = returnRegExResult(data, /^0-1:24.2.1(?:.*)(0+(\d+.\d+))/m, 1);

Thanks