Filter / Transform energy meter readings to "delete" single readings for state machine

openHAB 4.2.0.M3
z-wave device and org.openhab.binding.omatic-4.0.0-BETA2

I do have an issue with a z-wave energy meter and lately and the “state-o-matic” binding. The bindings themself seems working fine, but I have a “problem” regarding the readings and rules afterwards.

What I like to accomplish:

  • Reading over X → state machine (washing machine) running
  • Readings under Z for Y seconds → state machine (washing machine) completed
    That works pretty good

I do have problems with my readings though, I get a lot of one-time readings completely off (maybe not, but the compromise what I want to accomplish):

In idle mode I get energy idling around 1-3 watts, then suddenly one time peak values

  • around 1000-2000 Watts (similiar to peak work state of washing machine)
  • around 10-15 Watts (more often)

So how would I filter them before triggering the state machine. I really don’t have a clue, because the only thing I’d think of would be like having at least 2 consecutive readings over X to trigger the state machine.

So where do I start? So readings around 12 Watts could be a proper value to start the state machine - or it couldn’t.

Looking forward to ideas here.

Based on the docs for State-o-matic, it looks like it gets the values from the Items linked to your z-wave device. That gives you some options.

  1. Change your first state to “Reading over X for Y seconds” which will ignore those momentary spikes reported by the sensor, assuming the reading remains high for Y seconds. You might need to lower X a bit.

  2. Use the following: Filter Profile (Note, when OH 4.2 is released OH core will support Marketplace transformations. Assuming MainUI get’s updated too this will be one of the first transformations I publish to the marketplace). This will filter out those spikes completely so they never reach the Item and threrefor the state machine.

  3. Use a rule and a proxy Item. The rule only updates the proxy Item if the new reading is reasonable (by what ever criteria of reasonableness you want to apply).

Awesome! Thank you for your quick response.

So I guess I will wait for 4.2 and the marketplace transformations and give it a shot.

There’s no guarantee that the UI portion of this will be available in the 4.2 release. We are less than a month away and the UI portion hasn’t been started yet.

Maybe the State Filter Profile could be an alternative? It was introduced by this pull request and will be part of 4.2:

No that profile wouldn’t work here. The only comparisons are EQ (i.e. ==) and NEQ (i.e !=) and it compares the value to the current state of some other Item (though I suppose you could use the current Item’s state).

To filter out single reading like OP is looking for requires GE (i.e. >) or LE (i.e. <) type comparisons and probably needs to be even more involved (e.g. filter out the value if the absolute value of the delta between it and the last value is above some threshold).

Maybe with this PR we are getting closer? I thought in any case you might be interested in this PR, @rlkoshak.

1 Like

I could add a way to check for delta in a separate pr later.

1 Like

State Filter PR to support DELTA:

Example:

Number:Power PowerUsage {
  channel="mybinding:mything:mychannel" [ profile="basic-profiles:state-filter", conditions="$DELTA > 10 W" ]
}
2 Likes