openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.69k forks source link

Plugwise binding - maximumSince and minimumSince problem #511

Closed openhab-bot closed 10 years ago

openhab-bot commented 10 years ago

From angel.bu...@gmail.com on November 10, 2013 20:57:26

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

  1. Configure openhab.cfg like: plugwise:stick.port=/dev/ttyUSB0 plugwise:circleplus.mac=000D6F00029C5223
  2. Configure item Group Power (All) Group GF_Living_Power_Chart "Electricidad" (GF_Living) Group GF_Office_Power_Chart "Electricidad" (GF_Office) /* Power */ Switch Power_GF_Living_Plug "Regleta" (GF_Living) { plugwise="[ON:000D6F00029C5223:state:30], [OFF:000D6F00029C5223:state:30]"} Number Power_GF_Living_PlugPower "Consumo: [%.1f W]" (GF_Living_Power_Chart) { plugwise="[circleplus:power:30]"} Number Power_GF_Living_Max "Consumo max: [%.1f W]" (GF_Living_Power_Chart) Number Power_GF_Living_Min "Consumo min: [%.1f W]" (GF_Living_Power_Chart) Number Power_GF_Living_LastH "Consumo Kw/h: [%.1f Kw/h]" (GF_Living_Power_Chart) { plugwise="[circleplus:lasthour:30]"} Switch Power_GF_Office_Plug "Regleta" (GF_Office) { plugwise="[ON:000D6F0002907BDE:state:30], [OFF:000D6F0002907BDE:state:30]"} Number Power_GF_Office_PlugPower "Consumo: [%.1f W]" (GF_Office_Power_Chart) { plugwise="[000D6F0002907BDE:power:30]"} Number Power_GF_Office_Max "Consumo max: [%.1f W]" (GF_Office_Power_Chart) Number Power_GF_Office_Min "Consumo min: [%.1f W]" (GF_Office_Power_Chart) Number Power_GF_Office_LastH "Consumo Kw/h: [%.1f Kw/h]" (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: http://code.google.com/p/openhab/issues/detail?id=511

openhab-bot commented 10 years ago

From kai.openhab on November 10, 2013 12:11:49

Owner: karel.go...@gmail.com

openhab-bot commented 10 years ago

From karel.go...@gmail.com on November 12, 2013 01:53:02

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?

openhab-bot commented 10 years ago

From angel.bu...@gmail.com on November 12, 2013 02:44:47

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.

openhab-bot commented 10 years ago

From karel.go...@gmail.com on November 12, 2013 02:58:25

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.

openhab-bot commented 10 years ago

From angel.bu...@gmail.com on November 12, 2013 03:05:05

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?

openhab-bot commented 10 years ago

From teichsta on November 17, 2013 10:23:54

Labels: To-Github

teichsta commented 10 years ago

any news on this issue?

kgoderis commented 10 years ago

Thomas, do you have any idea what might be causing this issue, as it goes beyond the scope of the binding itself, but rather has to do with the persistence stuff?

teichsta commented 10 years ago

Can you confirm that this issue still occurs? I am not sure but i think there bugfixes in that area some time ago.

teichsta commented 10 years ago

AFAIK this issue has been fixed meanwhile. Please feel free to reopen this issue in case.