Using two virtual switches as preconditions, not working

I’m currently using two virtual switches as preconditions to some lighting automation:

  1. ChristmasLights (on)
  2. BatteryPowered (off)

Precondtions:
If ChristmasLights turned on
If BatteryPowered turned off
Condition:
Time is 06:30
Action:
ChristmasLightGroup turn on

But it doesn’t trigger. If I remove the BatteryPowered precondition, it works.

Am I misunderstanding how preconditions work?

I guess that depends on how you think they work.

From your description of your Routine I would expect your ChristmasLightGroup to be turned on at 6:30 if at that time the ChristmasLights state is already on, and also the BatteryPowered state is already off.

You might like to bear in mind that each of your preconditions is evaluated whenever the relevant switch changes state. It isn’t clear whether the precondition is initialised to true by default, initialised to false by default, or if the correct state of the switch is looked up. So you might want to make a point of toggling each of your virtual switches to the correct state after saving the Routine, even if they were already correct. That way you know the Routine is in sync with reality.

2 Likes

Your assumptions are correct. I’ll try your suggestion though.