Help with LHS of a rule

8 views
Skip to first unread message

orct...@gmail.com

unread,
Jul 23, 2017, 5:32:18 PM7/23/17
to OpenRemote
Hi

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)

Thanks

Stuart Hanlon

unread,
Jul 24, 2017, 3:51:23 AM7/24/17
to OpenRemote
Hi

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
Then
Executecommand ("in-memory_on"):

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

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

// Toggle in-memory state to off

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

Michal Rutka

unread,
Jul 24, 2017, 4:26:23 AM7/24/17
to OpenRemote
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.

orct...@gmail.com

unread,
Jul 24, 2017, 7:41:08 AM7/24/17
to OpenRemote
Thank you guys! Makes a lot of sense. I will give this a try and let you know.
Reply all
Reply to author
Forward
0 new messages