Hi all!
Ok - this might be a bit simple, but i am fairly new to HA automations - as i have previously build all my automations in nodered.
I have build a simple automation, that turns on the outside light - when a motion is triggered,
it then waits for some time - and turns off the light again.
i have a condition that the sun should be down, to save some energy, and avoid turning on the lights during the day.
the automation mode is restart, so if people stay, the lights will keep on.
now - i want to to able to turn on the lights manually - if i want to.
this works - until motion is detected, and then it will turn of the lights.
so - my initial thought is to add a condition - that the light should be off.
is this the “right” way achieving this?
Personally I’d tackle this by requiring the light to be off, and then using a wait_for_trigger for the motion sensor being off for a given time. That’ll be cleaner than having the automation restart.
Something roughly like this:
trigger:
- platform: state
entity_id: binary_sensor.motion
to: 'on'
condition:
- condition: state
entity_id: light.outside
state: 'off'
action:
- service: light.turn_on
target:
entity_id: light.outside
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.motion
to: 'off'
for: '00:05:00'
- service: light.turn_off
target:
entity_id: light.outside
I’ve been trying the Entity Controller integration from HACS, which is designed for exactly this and makes automations much more compact. Working well so far. Excellent docs too.
Hi stiltkjack - that looks nice to.
I might look into that at some time. As of now - this is also a “learning progress” for me - so i will stick with some basic automations first