No gas since daylight saving time change?
Closed this issue · 6 comments
Hi,
Thanks for this great tool! I've been using it a couple of weeks now. It was easy to implement on my Pi, thanks to the good documentation.
I've found that my gas readings turned to 0, since 2AM last sunday, when DST changed. The last successful readings were on 2016-10-30 02:55, then one on 2016-10-30 02:00, at 2016-10-30 02:05 the value returned was 0.
Now, when I run the smeterd command, both default and TSV output result in a gas reading of 0, while the raw output does give a meaningful gas output:
Raw output:
/KFM5KAIFA-METER
1-3:0.2.8(42)
0-0:1.0.0(161106184601W)
0-0:96.1.1(4530303235303030303531393734353135)
1-0:1.8.1(000608.303*kWh)
1-0:1.8.2(000598.271*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(01.263*kW)
1-0:2.7.0(00.000*kW)
0-0:96.7.21(00001)
0-0:96.7.9(00001)
1-0:99.97.0(1)(0-0:96.7.19)(000101000001W)(2147483647*s)
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(005*A)
1-0:21.7.0(01.263*kW)
1-0:22.7.0(00.000*kW)
0-1:24.1.0(003)
0-1:96.1.0(4730303332353631323639323539363136)
0-1:24.2.1(161106180000W)(00230.576*m3)
!65F2
Default output:
Total kWh High consumed 598271
Total kWh Low consumed 609156
Total gas consumed 0
Current kWh tariff 1
TSV output:
2016-11-06 19:09:43.188895 598271 609191 0 1
I can't figure out what to do to solve this. I am using version 2.5.0 and connect via serial (ttyAMA0) at 115200 baud rate.
Hi! Good to hear it's useful.
As soon as I have some time tomorrow I'll check the code using your P1 packet to detemine why you are getting 0 for gas usage.
Did you have time to check into it?
I've don some fiddling, in meter.py on rule 132 there is a regular expression that seems to be the culprit.
When I add the option to accept both 'S' and 'W' characters, the gas value seems to be read correctly. Perhaps this is an indicator for Summer/Winter time? :)
I think the code on line 132 should be:
keys['gas']['total'] = self.get_float(r'^(?:0-1:24\.2\.1(?:\(\d+[SW]\))?)?\(([0-9]{5}\.[0-9]{3})(?:\*m3)?\)$', 0)
But please check, as I tested it with a PHP script and have never done regular expressions before.
@bluethornnl Thanks for you comment. I found the same issue regarding the W and S and I am currently preparing a fix for this (including unit tests).
S
vs W
might indicate summer vs winter time but I am unable to find this in the specifications. We also have packets without an S
or W
at all.
I will prepare a pull request in the next hour or so.
@bluethornnl I have created a pull request and merged it to master.
I have also uploaded a new version 2.5.1
to pypi
here:
https://pypi.python.org/pypi/smeterd/2.5.1
This solved it indeed, thanks a lot!