Help with LHS of a rule


I am looking for suggestions on how to implement LHS of a rule so the RHS would be triggered only when the value of the sensor in the LHS changes from zero to something else. Application is plug-in power monitor and I want to trigger RHS only when the wattage changes from zero to anything I.e when the appliance plugged in to it turns on.

Currently I am using source == "sensor", value > 0

This triggers the RHS every time wattage changes ( appliance plugged in to it is a washing machine and value keeps wattage changes very frequently during the wash cycle)



Have you considered using a chain of rules?

Your energy counter state could toggle the state of an in-memory switch.

Then have a rule monitor the in-memory switch state to achieve what you're looking for?

For example :- (syntax is very wrong)

// This will trigger repeatedly
source == "energy_sensor", value > 0
Executecommand ("in-memory_on"):

// This will only trigger on a state change to on.

source == "in-memory state", =="on"
ExecuteCommand ("whatever you want done once"):

// Toggle in-memory state to off

source == "energy_sensor", value == 0
ExecuteCommand ("in-memory_off"):

Yes, this is a way to go. Create an in-memory varaiable with status on/off. Set this status with power >0 and ==0. Execute your RHS logic on the in-memory variable changes.

Thank you guys! Makes a lot of sense. I will give this a try and let you know.