This is a quite complex use case, and probably too specific to my house, but it might be interesting for some as it combines both Apilio and Smart Life automations.
Devices:
- 6 smart bulbs surrounding my house (Smart Life / Tuya compatible)
- 1 smart switch (no wire between the switch and the bulbs) (Smart Life / Tuya compatible)
What I want to achieve:
- Smart bulbs can be turned on by different ways, e.g. Alexa turning on only the 2 bulbs illuminating my pool, my alarm system turning on all smart bulbs upon detecting motion outside, etc.
- If any smart bulb is on, the smart switch must be on (blue status light on). Only when all smart bulbs are off, the smart switch must be off (blue status light off)
- When the smart switch is on (blue status light on), pressing on it should turn all smart bulbs off
- When the smart switch is off (blue status light off), pressing on it should turn all smart bulbs on
How I did it:
Apilio: I created 6 non-trigger conditions: Smart_bulb_1_off to Smart_bulb_6_off
Apilio: I created 1 trigger condition: Turn_smart_switch_on
AUTOMATION #1 in Apilio: I created a logicblock called āTurn_on_all_bulbs_if_I_press_on_smart_switchā:
- Condition linking: Smart_bulb_1_off AND Smart_bulb_2_off AND ā¦ Smart_bulb_3_off AND Turn_smart_switch_on
- Action: Trigger routine in Smart Life (Tuya) which turns all smart bulbs on
AUTOMATION #2 in Smart Life: I created an automation:
- Condition: (Smart bulb 1 is ON) OR (Smart bulb 2 is ON) orā¦ (Smart bulb 6 is ON)
- Action: Turn on Smart Switch
AUTOMATION #3 in Smart Life: I created an automation:
- Condition: (Smart bulb 1 is OFF) AND (Smart bulb 2 is OFF) ANDā¦ (Smart bulb 6 is OFF)
- Action: Turn off Smart Switch
AUTOMATION #4 in Smart Life: I created an automation:
- Condition: (Smart switch is OFF)
- Action: Trigger routine in Smart Life (Tuya) which turns all smart bulbs off
As you can imagine, there is some cross triggering between some of these automations. For example, if you press on the smart switch when it is ON, then AUTOMATION #4 is triggered => All smarts bulbs go off => AUTOMATION #3 is triggered
Thus you need to be very careful when designing the automations to avoid endless loops
For advanced users:
At first, I tried to implement AUTOMATION #1 with Smart Life like this:
AUTOMATION #1 in Smart Life:
- Condition: (Smart bulb 1 is OFF) AND (Smart bulb 2 is OFF) ANDā¦ (Smart bulb 6 is OFF) AND (Smart switch is ON)
- Action: Trigger routine in Smart Life (Tuya) which turns all bulbs on
But this does not work. If any smart bulb is on and I turn all smart bulbs via, for example, Alexa, then this automation detects that all smart bulbs are off but smart switch is on, and turns all bulbs back on. Iād need AUTOMATION #3 to be evaluated and executed before AUTOMATION #1, but you canāt control that.
Thatās why I implemented AUTOMATION #1 with Apilio and thatās also why the 6 conditions controlling smart bulbs are ānon-triggerā conditions. Otherwise Iād run into the same issue.