Didn’t express myself very clear, was referring to the generic solution as a whole, it is possible that it can be done in a better way than what I was thinking, but my solution is messy.
I’ll try to write a small guide but any improvements and or generic suggestions would be good to see.
@rlkoshak it would actually be a very nice gesture of yours, if you could write a hands-on tutorial about how to best go from items-based rules to group-based ones. I believe many users would benefit from your experiences for best practices in that area. I’m not talking about a “Design Pattern” but a step by step guide
I think it still qualifies as a Design Pattern, but I’ll write it more like a tutorial than just an example.
I’ve already written most of it up in my own notes. I’ve transcribed it and beefed it up a bit here:
It ended up being difficult to provide a step by step guide as the steps are just:
add your Items to groups
trigger the rule on all Items (or Group updates if multiple execs of the rule per event isn’t a problem)
pull the triggering Item from the Group based on lastUpdate
code as usual
However, I did provide examples for and description of what all of the MyGroup.members.* methods do (at least all the ones I know) including map/reduce.
I’ve only looked at it briefly but Yes, that looks great!! Thank you
I should not forget to add your design patterns tag to this or something similar: https://github.com/openhab/openhab-docs/issues/205
I’m waiting for the forum restructure. That will be fun.
Another way to throw a different & larger lasso around the entire problem of energy monitoring is to go with a whole-house approach based on a multi-circuit-capable special-purpose hardware such as the Brultech GEM. I bought one of these units a few months ago & can now see per-circuit usage for the entire house. At around $500-$600 or so, not cheap, but perhaps a fair cost when compared to the time & coding investment required to try to piece together comprehehsive usage based on measurements of individual devices.
Hardware-level physical current monitoring also accounts for normal line-voltage variations in real time. (As much as +/- 7% from nominal 120V AC on heavily-loaded circuits.) A well-designed hardware solution also automatically measures & accounts for AC power factor, a very significant issue when dealing w/ inductive loads & switching power supplies.
IMO the GEM is a good piece of hardware, built-in web GUI is rudimentary but functional. Documentation is adequate but not super well-organized.
At some point I will work on getting the GEM hardware integrated w/ OpenHAB.
Would be great, if you could explain your rule/item/… file from above a little bit more.
I wanted to test the file and changed the item names to my installation, but it didn´t work and as i don´t know what this rule exactly does, i can´t see, where i made a mistake or what went wrong…
A small tutorial would be great! Including a few words, which groups i have to persist for this and which persistence i need.
@globramma@sipvoip I do not own a house myself but would just out of curiosity be interested to know how difficult that binding would be? Is only the web GUI available? Could it be parsed easily?
In the web GUI you can setup how you want the data exported. Today most of us are using the btmon.py script and mqtt to get the data into openHAB. I am not a programmer, but I don’t think it would be that complex to write a binding. If anyone is interested I can put one or more of my GEM units on the public internet for testing.
one more question…(or two)
can i use this binding to measure the power consumption of light bulbs based on the on-time?
in addition, i would like to preset the consumption of the respective light bulb as a variable.
and enter the multiplication value to calculate dimmed bulbs.
possible?
Hi!
The binding will work if you supply “simulated” power inputs at given intervals.
I can probably add functionality for just supplying ON/OFF and the binding should work.
Do you use Openhab2 or Openhab3?
I have a heat pump that always shows me the current operating status. Off, hot water, heating. An electricity meter measures the consumption of the heat pump. Now I would like to know how the consumption is divided between hot water and heating. I could imagineto calculate the divided consumption via the consumption or the power.
“Energie WP Heizung”
when
Item BSZ_Verdichter_Hzg changed
then
Energieverbrauch_WP_Hzg.postUpdate(((BSZ_Verdichter_Hzg.state as DecimalType)*1.78))
end
rule “Energie WP Warmwasser”
when
Item BSZ_Verdichter_WW changed
then
Energieverbrauch_WP_WW.postUpdate(((BSZ_Verdichter_WW.state as DecimalType)*1.78))
end
Unfortunately, the operating hours display no longer works (An issue with the pump not OH related), because that’s how I used to calculate it before.
Instead of the 1,78kW I would use the actual measured power.