Migrating from webCoRE and using 2 rules instead of 1


#1

Hi all

I have been migrating across from STT and webCoRE recently and am seeking advise regarding Rules.
Currently I have a lot of Triggered Rules, 1 for ON capability and 1 for OFF capability.
Here is an example, where I am encapsulating the change in power to determine if an outdoor PIR security light is either ON or OFF.


I am trying to simplify the number of Rules I have and wondering if I can do this via a single Rule?
If power_level > 5 then
turn ON
else
turn OFF
endif

Any suggestions would be greatly appreciated.


#2

Why a triggered rule?
CONDITIONS
Power Level Of Security xxxx Switch > 5.0

DEFINE RULE
Power Level Of Security xxxx Switch > 5.0

Select Actions For True.
On: Security Light

Select Actions For False.
Off: Security Light


#3

Yeah I see triggers rules as something for when you want it to only evaluate once ON the trigger for something like your set-up a standard rule is better. IE one of my rules is between 40 after sunset and 9am do close blind else open them. Where as I also have a z-wave contact that turns on a ZigBee device. So for that I need a trigger rule because
If contact opens or closes and switch is off do turn ON else turn OFF. In a standard rule this would make the lights flash ON and OFF in a never ending loop. Because the condition is always true then false then true.....(contact is always open or closed and light is always ON or OFF) it constantly evaluated.


#4

Yes, there's no need for you to check if the light is off before turning it on.


#5

Triggers are most often used when there is no False Action needed.

Rules are most often used when there are both True Actions and False Actions.

Triggered Rules are used when the conditions may switch between true and false and true BUT you care about their condition ONLY at the moment of a trigger event.

I have quite a few of my Lighting Rules split between Turn On and Turn Off. For example: I may get a motion event that would turn on the light in the evening or at night, but ignore motion during the day. However, 5 mins after Motion ends, I turn Off the light. Don't care if it was on, I want it off, if a human turned the physical switch on. On rules have 'restrictions', OFF rules, in these cases, do not. So I need two rules.

As I said, I have quite a few like that. The rest are done in single Rules. :slight_smile:


#6

Can you post a screenshot of that rule?

Being new to this I am struggling with trying to do something very similar. I am trying to turn a light on if a door sensor is opened and it is between sunset and sunrise, and turn off 5 minutes later.

TIA!


#7

First the Rule with True Action and False Action:

Light on with motion & "night" and then 5 min after the last motion, off

Pending Off is buried a couple clicks but it looks like:

02%20PM

For the case of, not Night, but someone turned the light on manually:

The words in brackets are the evaluation at the moment the page was drawn... [FALSE] means the multisensor (motion) was not active.


#8

Thank you! I can’t wait to give that a try.