Then, when measurement should be changed, it can be valid or again broken, without any dependency or stable order.
Is this an issue with device itself or somehow connected with binding?
Does anybody also have such problem?
Used version: OH 2.5.0 release.
Reproduced on z-wave binding versions 2.5.0 and 2.5.1.201912260340
So, each second report has right value, but with wrongly set MSB in first byte in report value (f.e., 80 00 00 03).
I think, it’s an issue of device itself.
I have the same issues for sure and many people report it.
How can I just filter anything out that has this sort of reading? We can all assume that if it is below 0 then it is wrong. Does anyone have a way to read the incoming updated information and then if below 0, set the reading to the last reading value? I am sure it is possible but, what would that look like?
Hello. Yes, it’s possible.
The item, where i receive data and store data from plug, is named ZWaveNode006NASWR01ZEWallPlugSwitch_ElectricMeterKWh
First, i created a new item where i will store valid values. I named it PowerPlug_ElectricMeterKWh
Then i wrote such rule:
rule "correct received kwh values"
when
Item ZWaveNode006NASWR01ZEWallPlugSwitch_ElectricMeterKWh received update
then
if ((ZWaveNode006NASWR01ZEWallPlugSwitch_ElectricMeterKWh.state as Number) >= 0) {
PowerPlug_ElectricMeterKWh.postUpdate(ZWaveNode006NASWR01ZEWallPlugSwitch_ElectricMeterKWh.state)
}
end
And, of course, i show on sitemaps and store in influxdb the item with valid (positive) values
Nope, i don’t use simple mode This is default name, when you create an item and link it to the channel manually. And i don’t have so much devices now to think about individual names Let’s say, what i have now - is just a long-term first try or experiment
New system will be built from scratch, the question is only - when
thanks, I ended up writing something similar just before you replied. However, I did not store the state in another item and updated the original item with the last reading that was above 0. I am now going to change that because your rule is cleaner.
I use Aeon HEMs for monitoring power and energy. This is what I use to correct for random odd values, which has a little more in it than checking for >0.
from personal.utils import notification
from core.rules import rule
from core.triggers import when
POWER_ANOMALY = False
@rule("Power: Mains power monitor and cleanup")
@when("Item HEM1_Total_Power changed")
def mains_power_monitor_and_cleanup(event):
#mains_power_monitor_and_cleanup.log.debug("Power (mains): {}: start".format(event.itemState))
message = ""
global POWER_ANOMALY
if not POWER_ANOMALY and event.itemState > QuantityType("38400 W") and event.oldItemState > QuantityType("38400 W") and event.itemState < QuantityType("60000 W") and event.oldItemState < QuantityType("60000 W"):
POWER_ANOMALY = True
message = "Power (mains) is high: {} Watts.".format(event.itemState)
elif not POWER_ANOMALY and event.itemState >= QuantityType("0 W") and event.oldItemState >= QuantityType("0 W") and event.itemState < QuantityType("100 W") and event.oldItemState < QuantityType("100 W"):
POWER_ANOMALY = True
message = "Power (mains) is low: {} Watts.".format(event.itemState)
elif POWER_ANOMALY:
POWER_ANOMALY = False
message = "Power (mains) has returned to normal"
if not POWER_ANOMALY and event.itemState >= QuantityType("0 W") and event.itemState < QuantityType("60000 W"):
events.sendCommand("HEM1_Total_Power_Cleaned", str(event.itemState))
if message:
notification("Power (mains)", message)
@rule("Power: Mains energy monitor and cleanup")
@when("Item HEM1_Total_Energy changed")
def mains_energy_monitor_and_cleanup(event):
#mains_energy_monitor_and_cleanup.log.debug("Energy (mains): {}: start".format(event.itemState))
if event.itemState >= QuantityType("0 kWh") and (event.itemState >= event.oldItemState or event.itemState < QuantityType("60 kWh")) and event.itemState <= event.oldItemState.add(QuantityType("60 kWh")):
events.sendCommand("HEM1_Total_Energy_Cleaned", event.itemState.toString())
delta = event.itemState.subtract(event.oldItemState)
events.sendCommand("HEM1_Total_Energy_Delta", (delta if delta >= QuantityType("0 kWh") else event.itemState).toString())