jorgebooks / measureit

Automatically exported from code.google.com/p/measureit
0 stars 0 forks source link

Watts not recording correctly from EnviR #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
v115 Installed on Raspberry Pi manually.

test packet looks like this:

<msg><src>CC128-v1.29</src><dsb>00216</dsb><time>20:43:28</time><tmpr>25.5</tmpr
><sensor>0</sensor><id>01983</id><type>1</type><ch1><watts>00000</watts></ch1><c
h2><watts>00631</watts></ch2></msg>

measureit gives red "flash" in webpage, and displays temperature correctly, but 
not watts (which show as zero)

What is the expected output? What do you see instead?

Expect to see watts of 631 (in above message) - see zero.

What version of the product are you using? On what operating system?
browser is chrome on MacOS. measureit is on Raspbian 3.10.25+

Original issue reported on code.google.com by i...@glasgowfoundry.co.uk on 12 Mar 2014 at 8:54

GoogleCodeExporter commented 9 years ago
The problem is the regex parsing, definitely.

I did this, and it's now working for me - clearly, it's mangled to the point of 
being no use for your more general code, but it does show where the fault is...

                r = re.search(r"<tmpr>(.+?)</tmpr><sensor>(\d+)</sensor>.+<ch2><watts>(\d+)<\/watts><\/ch2>", line)
                if r:
                        #print r
                        tmpr = r.group(1)
                        watt_sum = int(r.group(3))
                        sensor_data_check( r.group(2), watt_sum, tmpr )

Original comment by i...@glasgowfoundry.co.uk on 13 Mar 2014 at 10:54

GoogleCodeExporter commented 9 years ago
More on this issue - it appears that the code handles the situation where 
clamps are connected in order, that is, the numbered ports on the underside of 
the EnviR are populated 1, then 2, then 3. 

If there is a "gap", or a lower numbered clamp is not populated, the regex 
fails to find the data.

Original comment by i...@glasgowfoundry.co.uk on 6 Apr 2014 at 7:38

GoogleCodeExporter commented 9 years ago

Original comment by lalelu...@gmail.com on 25 Jul 2014 at 9:30