Iâm on vacation right now, so I donât have easy access to the config (I only use yaml, and even though ssh is possible from the phone, it is a hassle to copy and paste the config etc.
But I can give you a bit more details, and you should be able to interpret and adapt the exact config suitable for your use I hope.
So letâs use the living room as an example, just because it has a few more interesting bits than the bedroom.
The living room has two motion sensors (fibaro zwave, but that is not important), a couple of lights and a TV (and other stuff of course, but again out of the scope right now).
I want everything to be as automated as possible, no apps, no messing around with the phone or a tablet to turn on lights or other basic stuff.
So I have two âtriggerâ-automations. One for each motion sensor.
#1
Trigger:
- binary_sensor.living_room_motion_1 to âonâ
Actions:
- Send event âmotion-sensor-livingroom-1â
- Send event âmotion-detected-livingroomâ
- Send event âmotion-detectedâ
#2
Trigger:
- binary_sensor.living_room_motion_2 to âonâ
Actions:
- Send event âmotion-sensor-livingroom-2â
- Send event âmotion-detected-livingroomâ
- Send event 'motion-detected
No conditions, no complexity. These events are always sent, no matter what (as long as the automations are enabled).
Then I have a few âactionâ-automations:
#livingroom_lights_auto_on
Trigger:
- Event âmotion-detected-livingroomâ
Action
- Lights turn-on livingroom
#tv_auto_on
Trigger:
- Event âmotion-detected-livingroomâ
Action
- TV on
But I obviously donât want both the lights and TV to always turn on, every time motion is detected.
So I add all my âconditionsâ as separate automations that turn those two automations on and off.
#1 - If the TV was just turned off, donât turn it back on immediately
Trigger:
- TV to state off
Action:
- disable automation tv_auto_on
#2 - Same for the lights if someone turns them off using the wall switch.
Trigger:
- Living room light switch to off
Action:
- disable automation living_room_lights_auto_on
On the other hand. If someone turns the lights on manually, we can safely re-enable the automation
#3
Trigger:
- Living room light switch to on
Action:
- enable automation living_room_lights_auto_on
This gives the least amount of surprise to anyone using the switches, while still keeping stuff as automatic as possible.
And we can disable and re-enable the TV auto on at reasonable times:
#4
Trigger:
- time is 23:00
Action:
- disable automation tv_auto_on
#5
Trigger:
- time is 18:00
Action:
- enable automation tv_auto_on
There are plenty more, also for turning the lights off etc.
So one of the important ones is that it should not turn off the lights automatically as long as the TV is on (while watching a movie, we frequently do not trigger the motion sensors for a long time).
Trigger:
- TV to state âonâ
Action:
- Disable automation livingroom_lights_auto_off
Trigger:
- TV to state âoffâ
Action:
- Enable automation livingroom_lights_auto_off
Of course this gives me a_lot of automations, but as they are all extremely simple, it is very easy to understand exactly why something happened. And it is very easy to see whether lights should be turned on or off at any point in time, and it is easy to add debug messages or notifications as the action-automations are enabled or disabled.
And I can enable and disable them based on all kinds of conditions, like the weather outside or who is home.
To top it off, I also use "input_number"s for stuff like dimmer levels, timeouts before lights are turned off again etc. And these inputs are also controlled by automations, so I have a shorter timeout and lower dimmer levels at night than in the morning of workdays etc.
Trigger:
- workday at 05:00
Action:
- set input_number.livingroom_dimmer_level to 100%
- set input_number.livingroom_lights_off_timer to 10 minutes
Trigger:
- workday at 09:00
Action:
- set input_number.livingroom_lights_off_timer to 2 minutes
Trigger:
- workday at 17:00
Action:
- set input_number.livingroom_dimmer_level to 75%
- set input_number.livingroom_lights_off_timer to 10 minutes
Trigger:
- time 23:00
Action:
- set input_number.livingroom_dimmer_level to 10%
- set input_number.livingroom_lights_off_timer to 2 minutes
Etc. You get the ideaâŠ
I donât say that this is the way to do it, but to me, the simplicity of each automation and how easy it is to monitor and mange exactly why something happened, outweights the issue with the number of automations.