I’ve got my automation for my outside lights to be disable when I manually turn the lights on and to be re-enable when I turn the lights of. My question is, when the automation activates the lights it then disables the automation. I’m pretty sure that I need to setup a script, just not sure about how.
Here’s my automations, firstly is the outside lights trigger from Blue Iris and the second part is the manual over ride.
- alias: Turn on south/sw lights when there is movement
trigger:
platform: state
entity_id:
- binary_sensor.blue_iris_frontclone
- binary_sensor.blue_iris_eastclone
- binary_sensor.blue_iris_garageclone
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
action:
service: switch.turn_on
entity_id:
- switch.front_door_switch
- switch.south_west_switch
- alias: Turn off south/sw lights 8 seconds after last movement
trigger:
platform: state
entity_id:
- binary_sensor.blue_iris_frontclone
- binary_sensor.blue_iris_eastclone
- binary_sensor.blue_iris_garageclone
to: 'off'
for:
seconds: 8
action:
service: switch.turn_off
entity_id:
- switch.front_door_switch
- switch.south_west_switch
and
- alias: Turn off Outside Lights Automations when Lights Manually Turned On
trigger:
- platform: state
entity_id:
- switch.south_west_switch
- switch.back_door_switch
- switch.front_door_switch
to: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.outside_lights_manually_on
- service : automation.turn_off
entity_id:
- automation.turn_off_northsw_lights_8_seconds_after_last_movement
- automation.turn_off_southsw_lights_8_seconds_after_last_movement
- alias: Turn on Outside Lights Automations when Lights Manually Turned Off
trigger:
- platform: state
entity_id:
- switch.south_west_switch
- switch.back_door_switch
- switch.front_door_switch
to: 'off'
action:
- service: input_boolean.turn_on
entity_id: input_boolean.outside_lights_manually_on
- service : automation.turn_on
entity_id:
- automation.turn_off_northsw_lights_8_seconds_after_last_movement
- automation.turn_off_southsw_lights_8_seconds_after_last_movement
I’m trying to understand what you’re doing here but I don’t get it.
Is it that you want to have an automation to turn lights on and off after sunset but only if you didn’t manually turn them on or manually turn them off?
I want the cameras to actuate the lights, if motion is detected ( this has worked well for 6 months) and the wife wants the lights to stay on, when she turns the switch on manually. As it is now, they’ll go off in 8 seconds because of the automation. So I setup an input boolean, which disables the automation when we manually turn the switch on and when we turn switch off, it enables the automation. The problem is when the automation turns the lights on, it then disables the automation and the lights stay on. Sorry if I was confusing in the initial description and hopefully not now, lol/
I think the best way to do it is to use input_boolean for lights automated rather than manual. If the motion detector sees movement and the lights are off, turn on lights and set input_boolean to on, then when motion stops, make sure that switch is on, if so turn it and the lights off.
Although this works, it does not let you manually control the lights when they are on by the automation.
ie. when the light is on and i want to keep it on, i will need to wait for the automation to turn them off, then turn them on again.
Right?
@motoolfan i have posted a revised option over there, which i think covers all the posibilities (including interupting the automatic operation with the manual switch), have a look if you want
Those don’t seem to he compatible, so you’d need some other source to tell them to stay on, possibly the lights in the room the switch is in? Or a dash button/z-wave remote.
you would use it as a keep on button, disabling your turn off automation, and you can have your turn_on automation turn it back on.
something along these lines, with an extra automation for the dash button to turn off the second automation.
- alias: Turn on south/sw lights when there is movement
trigger:
platform: state
entity_id:
- binary_sensor.blue_iris_frontclone
- binary_sensor.blue_iris_eastclone
- binary_sensor.blue_iris_garageclone
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: switch.front_door_switch
state: 'off'
- condition: state
entity_id: switch.south_west_switch
state: 'off'
action:
- service: switch.turn_on
entity_id:
- switch.front_door_switch
- switch.south_west_switch
- service: automation.turn_on
entity_id: automation.motion_on
- alias: Turn off south/sw lights 8 seconds after last movement
trigger:
platform: state
entity_id:
- binary_sensor.blue_iris_frontclone
- binary_sensor.blue_iris_eastclone
- binary_sensor.blue_iris_garageclone
to: 'off'
for:
seconds: 8
action:
service: switch.turn_off
entity_id:
- switch.front_door_switch
- switch.south_west_switch
- service: automation.turn_on
entity_id: automation.motion_on