Imitating the Power Consumption of Lights (and others)

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.

Regards, S

@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 :wink:

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:

  1. add your Items to groups
  2. trigger the rule on all Items (or Group updates if multiple execs of the rule per event isn’t a problem)
  3. pull the triggering Item from the Group based on lastUpdate
  4. 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 :tada: :wink:
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.

It can’t be as painful as the eviction from Google Groups was… :slight_smile:

1 Like

Now I have no excuse anymore, to not build a group-based rule for the above :wink:

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.

+1, they are great, I have 3 of them in my new house. Would be nice to have a binding some day.

@Seaside

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.

1 Like

Take a look at OpenEnergyMonitor - lots of ideas. And it integrates with Openhab…

hey guys. can you please show me, where i am able to find the complete tutorial as @Seaside ‘promised’?
i cannot find it.

This thread is really old. I don’t think I managed to post a tutorial. However I made a binding which can monitor power consumption, feel free to try it out.
https://community.openhab.org/t/state-o-matic-binding-monitor-your-washingmachine-dishwasher-electric-car-etc/

This thread is really old.

yes, i know, but this was exactly that, what I was looking for.

Thank you for you Info, I’ll try it.

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?

Regards, S

ok, thank you.
I’ll try it, when I have time for it.

I am using Openhab2.

See the Omatic thread for details, this work already, no need to implement anything:

Hello

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.

BR