jorgebooks / measureit

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

Using Sensor 0 with 2 calmps -> no individual graps or costs per clamp #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Setup Sensor 0 to have no Price
Add Clamp 1
Add Clamp 2
Add Position to Sensor 0
Add Position to Clamp 1
Add Position to Clamp 2
Add price to Clamp 1  0.2425   (General Tariff)
Add price to Clamp 2  0.1510   (OffPeak Tarif)

Set Time Offset to 10 and Currency to $  for all Sensor and Clamps

CLAMP 1 and CLAMP 2 has no graph No Costs

Sensor 0 Displays a graph  No costs  (If I set a price then Costs are 
calculated and displayed)

Clamp 1 is reading Phase 1 (General House Power)  No graph no costs on website
Clamp 2 is reading Offpeak Hotwater service  No graph no costs on website

Is Sensor 0 Aggregating all the data?

What is the expected output? What do you see instead?
a per costs per channel (clamp) calculated using the correct tariff
A graph for each channel showing the watts over time

What version of the product are you using? On what operating system?
Download the latest RPi img  ( Version 115 ) 
https://mega.co.nz/#!WJcGibRA!RWjoBw7W3iJIGBepwmBI4QyepQomeQ0PYnBsuqziZCk

Please provide any additional information below.

XML -> Showing Sensor 0  with 2 channels   Ch1 Ch2
msg><src>CC128-v1.31</src><dsb>00425</dsb><time>05:13:48</time><tmpr>18.8</tmpr>
<sensor>0</sensor><id>00077</id><type>1</type><ch1><watts>00456</watts></ch1><ch
2><watts>00014</watts></ch2></msg>

Web Setup  ( I cant see any Price Info
{
    "0":
    {
        "sensor":
        {
            "x":"","sensor_id":"0","sensor_title":"PowerBox","sensor_clamp":"0","position_id":"10","position_time":"2013-07-13 06:55:53",
            "position_description":"Sensor0","position_sensor":"0","measure_history":"0","measure_currency":"$",
            "measure_sensor":"0","measure_range":"","measure_timeframe":"0","measure_timezone":"GMT0","measure_timezone_diff":"10",
            "measure_type":"0","measure_pvoutput_id":"0","measure_pvoutput_api":"","positions":
            {
                "10":
                {
                    "position":"10","time":"2013-07-13 06:55:53","description":"Sensor0"
                }
                }

            ,"clamps":
            {
                "10":"GeneralPower","20":"Offpeak2"
            }
        }
    }

    ,"10":
    {
        "sensor":
        {
            "x":"","sensor_id":"10","sensor_title":"GPower","sensor_clamp":"0","position_id":"11","position_time":"2013-07-13 07:09:32",
            "position_description":"GeneralPower","position_sensor":"10","measure_history":"0","measure_currency":"$",
            "measure_sensor":"10","measure_range":"","measure_timeframe":"0","measure_timezone":"GMT0","measure_timezone_diff":"10",
            "measure_type":"0","measure_pvoutput_id":"0","measure_pvoutput_api":"","positions":
            {
                "11":
                {
                    "position":"11","time":"2013-07-13 07:09:32","description":"GeneralPower"
                }
            }
        }
    }

    ,"20":
    {
        "sensor":
        {
            "x":"","sensor_id":"20","sensor_title":"OffPeak","sensor_clamp":"0","position_id":"9","position_time":"2013-07-13 06:54:36",
            "position_description":"Offpeak2","position_sensor":"20","measure_history":"0","measure_currency":"$",
            "measure_sensor":"20","measure_range":"","measure_timeframe":"0","measure_timezone":"GMT0","measure_timezone_diff":"10",
            "measure_type":"0","measure_pvoutput_id":"0","measure_pvoutput_api":"","positions":
            {
                "9":
                {
                    "position":"9","time":"2013-07-13 06:54:36","description":"Offpeak2"
                }
            }
        }
    }
}

Original issue reported on code.google.com by jimmy.ha...@gmail.com on 13 Jul 2013 at 10:02

GoogleCodeExporter commented 9 years ago
Changed
                        if r.group(5):
                                sensor = '2'+r.group(2)
to
                      if r.group(5):
                                sensor = int('2'+r.group(2))

Appears to fix it up.

Original comment by jimmy.ha...@gmail.com on 14 Jul 2013 at 2:52

GoogleCodeExporter commented 9 years ago
Sorry to be more precise  I changed all three sensor = int(....)

                        if r.group(5):
                                sensor = int('2'+r.group(2))
                        if sensors and sensors.has_key(sensor):
                                        watt = int(r.group(5))
                                        watt_sum += watt
                                        sensor_data_check( sensor, watt, tmpr )
                                        clamps = True

                        if r.group(7):
                                sensor = int('3'+r.group(2))
                                if sensors and sensors.has_key(sensor):
                                        watt = int(r.group(7))
                                        watt_sum += watt
                                        sensor_data_check( sensor, watt, tmpr )
                                        clamps = True

                        if clamps:
                                sensor = int('1'+r.group(2))
                                watt = int(r.group(3))
                                sensor_data_check( sensor, watt, tmpr )

                        sensor_data_check( r.group(2), watt_sum, tmpr )

Original comment by jimmy.ha...@gmail.com on 14 Jul 2013 at 3:01

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I just tried Jimmy's solution and it worked for me too.

Thanks,

Steve.

Original comment by wot...@gmail.com on 15 Jul 2013 at 11:06

GoogleCodeExporter commented 9 years ago
I spoke too soon I think. I'll see what the data looks like in the morning. But 
I don't think it updates both clamps at the same time.

Original comment by wot...@gmail.com on 15 Jul 2013 at 1:17

GoogleCodeExporter commented 9 years ago
Jimmy's fix was ok. That will solve the problem.

I add some more debuging information. So please try the new grabber file:

https://measureit.googlecode.com/svn/trunk/measureit_system_files/python/data-in
put.py

Original comment by lalelu...@gmail.com on 15 Jul 2013 at 6:44

GoogleCodeExporter commented 9 years ago

Original comment by lalelu...@gmail.com on 15 Jul 2013 at 6:45

GoogleCodeExporter commented 9 years ago
Looks good on mine so far. Now running the new grabber. Thanks guys.

Original comment by wot...@gmail.com on 16 Jul 2013 at 4:18

GoogleCodeExporter commented 9 years ago
hi, 

i have on device 0 a optismart working fine. also have on device 1 a CT with  3 
clamps. it seems like only clamp 1 data is in measureit. I did set them  up in 
measureit as it should, so first a new sensor and then added 3 clamps.

if i look in the sensors database i see the device has id 1 and the clamps 11, 
12, 13.
now when ik look at the data_now database i only see clamp 1 realtime data put 
in sensor_id 1 row. 

Shouldnt there be data in sensor_id 11, 12, 13 ? What script is responsible for 
putting the data in the data_now table ?

thanks

Richard 

ps

in what file this code is changed ?

========================================

Changed
                        if r.group(5):
                                sensor = '2'+r.group(2)
to
                      if r.group(5):
                                sensor = int('2'+r.group(2))

===========

Original comment by richardt...@gmail.com on 10 Aug 2013 at 5:47

GoogleCodeExporter commented 9 years ago
The data-input.py file is located at /usr/local/measureit/python

Use the link Thomas posted to get the latest version: 
https://measureit.googlecode.com/svn/trunk/measureit_system_files/python/data-in
put.py

Regards,

Steve.

Original comment by wot...@gmail.com on 10 Aug 2013 at 6:09

GoogleCodeExporter commented 9 years ago
it works, thanks !

Original comment by richardt...@gmail.com on 10 Aug 2013 at 6:20

GoogleCodeExporter commented 9 years ago
I have been struggling for weeks to try and get Measureit to show data from the 
second and third clamps of three clamps connected to a sensor.  So I 
immediately installed the new data-input.py file.  But unfortunately, it does 
not solve the problem completely.  There is some improvement, in that I can now 
see a graph of data from Clamp 1 on the Clamp 1 tab, but Clamps 2 and 3 are 
still invisible.   Does anyone have this new file working with three clamps on 
a single sensor?

Rod Tucker

Original comment by r...@lamont-tucker.com on 15 Dec 2013 at 7:12

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:06