I would like set my outside lights (Z-wave) brighter when the backdoor opens and return to the last setting when the door is closed again (with a delay). The ‘last setting’ can be set from Hass but can also be set with a switch. How can I set the lamps to the previous brightness setting?
personally I’d use an input_number to store the current brightness value before you change it, then you can restore it from that stored value.
1 Like
I do something similar to return the volume on my server back to it’s original value after TTS. I’ve modified it to the below basic automation which should work.
You will need to create the input_number.kitchen_3_brightness entity as @lolouk44 suggested.
Input Number
kitchen_3_brightness:
name: kitchen_3_brightness
initial: 0
mode: box
Automation
- alias: 'Backdoor: Let there be light'
initial_state: True
trigger:
platform: state
entity_id: binary_sensor.front_door_sensor
to: 'on'
action:
- service: input_number.set_value
data_template:
entity_id: input_number.kitchen_3_brightness
value: '{{ states.light.kitchen_3.attributes.brightness }}'
- service: light.turn_on
data:
entity_id: light.kitchen_3
brightness: 255
- alias: 'Backdoor: Dial it back down'
initial_state: True
trigger:
platform: state
entity_id: binary_sensor.front_door_sensor
to: 'off'
action:
- delay: '00:05:00'
- service: light.turn_on
entity_id: light.kitchen_3
data_template:
brightness: "{{ states('input_number.kitchen_3_brightness') | int }}"
2 Likes
Awesome. Thanks for the detailed response!