mazekkkk / openhab

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

Plugwise binding - maximumSince and minimumSince problem #511

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying plugwise, and I want to view a graph with the power consumption of 
each plug, but the minimumSince doesn't return the correct value. 

What steps will reproduce the problem?
1. Install plugwise stick, a circle+ and a circle

2. Configure openhab.cfg like:
plugwise:stick.port=/dev/ttyUSB0
plugwise:circleplus.mac=000D6F00029C5223

3. Configure item
Group Power     (All)
Group GF_Living_Power_Chart     "Electricidad"  <socket>        (GF_Living)
Group GF_Office_Power_Chart     "Electricidad"  <socket>        (GF_Office)
/* Power */
Switch Power_GF_Living_Plug  "Regleta" <socket> (GF_Living)   { 
plugwise="[ON:000D6F00029C5223:state:30], [OFF:000D6F00029C5223:state:30]"}
Number Power_GF_Living_PlugPower  "Consumo: [%.1f W]" <socket> 
(GF_Living_Power_Chart) { plugwise="[circleplus:power:30]"}
Number Power_GF_Living_Max  "Consumo max: [%.1f W]" <socket> 
(GF_Living_Power_Chart)
Number Power_GF_Living_Min  "Consumo min: [%.1f W]" <socket> 
(GF_Living_Power_Chart)
Number Power_GF_Living_LastH  "Consumo Kw/h: [%.1f Kw/h]" <socket> 
(GF_Living_Power_Chart) { plugwise="[circleplus:lasthour:30]"}
Switch Power_GF_Office_Plug  "Regleta" <socket> (GF_Office)   { 
plugwise="[ON:000D6F0002907BDE:state:30], [OFF:000D6F0002907BDE:state:30]"}
Number Power_GF_Office_PlugPower  "Consumo: [%.1f W]" <socket> 
(GF_Office_Power_Chart) { plugwise="[000D6F0002907BDE:power:30]"}
Number Power_GF_Office_Max  "Consumo max: [%.1f W]" <socket> 
(GF_Office_Power_Chart)
Number Power_GF_Office_Min  "Consumo min: [%.1f W]" <socket> 
(GF_Office_Power_Chart)
Number Power_GF_Office_LastH  "Consumo Kw/h: [%.1f Kw/h]" <socket> 
(GF_Office_Power_Chart) { plugwise="[000D6F0002907BDE:lasthour:30]"}

4.- Configure the rules to update the max and the minimum value
rule "Update max and min power Living"
when
        Item Power_GF_Living_PlugPower changed
then
        postUpdate(Power_GF_Living_Max, Power_GF_Living_PlugPower.maximumSince(now.toDateMidnight).state)
        postUpdate(Power_GF_Living_Min, Power_GF_Living_PlugPower.minimumSince(now.toDateMidnight).state)
end
rule "Update max and min power Office"
when
        Item Power_GF_Office_PlugPower changed
then
        postUpdate(Power_GF_Office_Max, Power_GF_Office_PlugPower.maximumSince(now.toDateMidnight).state)
        postUpdate(Power_GF_Office_Min, Power_GF_Office_PlugPower.minimumSince(now.toDateMidnight).state)
end

What is the expected output? What do you see instead?
The minimun or maximun should return the min or max value of power consumption 
along the day, but it shows the same as the instant value

What version of the product are you using? On what operating system?
I have tried 1.3.0 and the last build 1.4.0 from 10/11/2013 on linux arch with 
raspberry pi

Original issue reported on code.google.com by angel.bu...@gmail.com on 10 Nov 2013 at 7:57

GoogleCodeExporter commented 9 years ago

Original comment by kai.openhab on 10 Nov 2013 at 8:11

GoogleCodeExporter commented 9 years ago
Angel,

can you post a bit of DEBUG logging, as from what you post here above it is not 
clear if the problem is in the binding, or in your persistence definitions. 
Does the instant value change over time or not, e.g. you are getting varying 
reading from the plugs?

Original comment by karel.go...@gmail.com on 12 Nov 2013 at 9:53

GoogleCodeExporter commented 9 years ago
Yes, I think the problem is in the binding. The event.log show this:

2013-11-11 00:00:32 - Power_GF_Living_PlugPower state updated to 6.5934076
2013-11-11 00:00:35 - Power_GF_Living_Max state updated to 6.5934076
2013-11-11 00:00:35 - Power_GF_Living_Min state updated to 6.5934076
2013-11-11 00:01:02 - Power_GF_Living_LastH state updated to 0.047300734
2013-11-11 00:01:02 - Power_GF_Living_Plug state updated to ON
2013-11-11 00:01:02 - Power_GF_Office_PlugPower state updated to 0.0
2013-11-11 00:01:02 - Temperature_GF_Raspberry state updated to 44.4
2013-11-11 00:01:03 - Power_GF_Office_LastH state updated to 0.0
2013-11-11 00:01:03 - Power_GF_Office_Plug state updated to OFF
2013-11-11 00:01:03 - Power_GF_Living_PlugPower state updated to 4.4508367
2013-11-11 00:01:03 - Power_GF_Living_Max state updated to 4.4508367
2013-11-11 00:01:04 - Power_GF_Living_Min state updated to 4.4508367

As you can see, after an update of Power_GF_Living_PlugPower, the max and the 
min value has been updated to the same value, but the max value (at the end of 
this example) should be 6.5934076, not 4.4508367. For the update I have clone 
the demo rule to update max and min temperature.

Original comment by angel.bu...@gmail.com on 12 Nov 2013 at 10:44

GoogleCodeExporter commented 9 years ago
Hum.... based on what I see the problem is not with the binding but with the 
persistence bit. Given that Power_GF_Living_PlugPower is updated (by the 
binding), and that binding's responsibility "stops" at that point, the problem 
must be elsewhere. 

Original comment by karel.go...@gmail.com on 12 Nov 2013 at 10:58

GoogleCodeExporter commented 9 years ago
I'm sorry if I make a very simple question, I'm newbie. When I get a new value 
from Power_GF_Living_PlugPower I execute 
Power_GF_Office_PlugPower.maximumSince(now.toDateMidnight).state (in a rule of 
course) and this function doesn't return the correct value (The update is with 
the last value not the max value). Is this not implemented in the binding?

Original comment by angel.bu...@gmail.com on 12 Nov 2013 at 11:05

GoogleCodeExporter commented 9 years ago

Original comment by teichsta on 17 Nov 2013 at 6:23

GoogleCodeExporter commented 9 years ago
This issue has been migrated to Github. If this issue id is greater than103 its 
id has been preserved on Github. You can open your issue by calling the URL 
https://github.com/openhab/openhab/issues/<issueid>. Issues with ids less or 
equal 103 new ids were created.

Original comment by teichsta on 17 Nov 2013 at 8:09

GoogleCodeExporter commented 9 years ago
Set status to "invalid" to show that these issues are not tracked here anymore 
- please refer to GitHub instead!

Original comment by kai.openhab on 2 Dec 2013 at 7:12