google-code-export / measureit

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

Streaming Data seems to be coming but webpage is showing a static value #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I get a static value on the webpage. Temperature 14.8 Watts 52
2.
3.

What is the expected output? What do you see instead?
I started two ssh sessions and looking at the measureit.log I see no issue.
After a fresh reboot I stop the service with: svc -d /service/measureit
and then start the script with 
/usr/bin/python /usr/local/measureit/python/data-input.py test

I see the xml data coming but nothing shows on the webpage.
The xml has sensor 0 and I have configured sensor 0 with two clamps (1 and 2) 
which match the xml ch1 and ch2

What version of the product are you using? On what operating system?
This is on Raspbian downloaded from measureit.

Please provide any additional information below.

HELP!
PS, I'm not very good with Linux...

Original issue reported on code.google.com by agiang...@agwsoft.com on 15 Sep 2013 at 2:44

GoogleCodeExporter commented 9 years ago
This is a known and already fixed bug. Will be fixed in the next version

You can use the latest version from the measure it_functions.php 

https://measureit.googlecode.com/svn/trunk/measureit_public_html/php/measureit_f
unctions.php

Original comment by lalelu...@gmail.com on 16 Sep 2013 at 3:59

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thank you Thomas. I have updated the measureit_functions.php file but the 
result is the same.
I then checked every single RXX since 115 was released and found that maybe the 
database had a minor modification to work with sensor zero (Issue ID 34).
I then tried to add this line:
INSERT INTO measure_data_now (sensor_id, watt, tmpr) VALUES (10, 0, 0), (20, 0, 
0), (30, 0, 0);
After a few minutes I noticed that the only row that has watt and tmpr is 
sensor_id 0 and the values are 52 and 14.8 which is what I see on the web page.

I'm trying hard but I need help...
Thanks

Original comment by agiang...@agwsoft.com on 17 Sep 2013 at 2:26

GoogleCodeExporter commented 9 years ago
Hello Thomas,

The problem is in the setting of my EnviR (as suspected) which uses Fahrenheit 
instead of Celsius.
The data grabber is trying to match <tmpr> but my data stream comes in as 
<tempF>.

This is the part of the data grabber that I have modified:

509                 # parsing from history_output
510                 # data will not be used because of the data is buggy and 
not detailed enough :)
511                 # but saving them is not an error. maybe we can use the 
data later
512                 r = re.search(r"<hist>", line)
513                 if r:
514                         for s in sensors:
515                                 r = 
re.search(r"<data><sensor>"+str(s)+"</sensor>(.+?)</data>", line)
516                                 if r:
517                                         d = 
re.findall(r"<(m)(\d+)>(.+?)</.+?>", r.group(1) )
518                                         if d:
519                                          for f in d:
520                                                  history_update(s,f)
521
522                 r = 
re.search(r"<tmprF>(.+?)</tmprF><sensor>(\d)+</sensor>.+<ch1><watts>(\d+)<\/watt
s><\/ch1>(<ch2><watts>(\d+)    
<\/watts><\/ch2>)?(<ch3><watts>(\d+)<\/watts><\/ch3>)?", line)
523                 if r:
524                         #print r
525                         tmpr = r.group(1)
526                         watt_sum = int(r.group(3))
527                         # more than 1 clamp

Just two changes on line 522. However to do it right, it should be something 
like:
   r = re.search(r"<tmpr[F]?>(.+?)</tmpr[F]?><sensor>(\d)+</sensor>.+<ch1><watts>(\d+)<\/watts><\/ch1>(<ch2><watts>(\d+)    <\/watts><\/ch2>)?(<ch3><watts>(\d+)<\/watts><\/ch3>)?", line)

So that either Celsius or Fahrenheit are accounted for. Since I don't really 
know the Python syntax I leave it to you to code it correctly :)

To be totally clean, the web page should also change to reflect and "F" next to 
the temperature as it now shows a "C".

Lastly, this should probably be under the general settings > Temperature , C or 
F

Now it is time for beer!!!

PS: PVOUTPUT live output work fine as well

Hope this helps.
Andrea

Original comment by agiang...@agwsoft.com on 20 Sep 2013 at 1:14

GoogleCodeExporter commented 9 years ago
Solved in version 116 that is available to download

Original comment by lalelu...@gmail.com on 19 Apr 2014 at 9:10