I am having trouble with an automation. The automation I am trying to create will turn on a room light upon a motion trigger. It will remain on for 20 minutes after motion is no longer detected. This works well, however, I want to save the current state of brightness such that it returns to that brightness level the next time motion is triggered.
After some digging, I found that creating a dynamic scene might be the best solution. However, when trying this method, the scene.create section does not seem to update the current state of the brightness, although I figured it should since it is taking a snapshot.
Here is my automation, if anyone has some insights, that would help!
alias: Laundry Motion Light
description: Toggle laundry lights on motion. Turn off after 20 mins of no motion
triggers:
- type: motion
device_id: 96a680c00f992dcffddf51d98d3c8a38
entity_id: 1fc71aa165f80e1bdc654136bfab21a1
domain: binary_sensor
trigger: device
id: laundry-motion
- type: no_motion
device_id: 96a680c00f992dcffddf51d98d3c8a38
entity_id: 1fc71aa165f80e1bdc654136bfab21a1
domain: binary_sensor
trigger: device
for:
hours: 0
minutes: 1
seconds: 0
conditions: []
actions:
- if:
- condition: trigger
id:
- laundry-motion
then:
- action: scene.turn_on
metadata: {}
target:
entity_id: scene.laundry_ceiling_level
else:
- action: scene.create
metadata: {}
data:
scene_id: laundry_ceiling_level
snapshot_entities:
- light.laundry_ceiling
- type: turn_off
device_id: c7318f5706c3f0b5b1147d66ee251d7f
entity_id: 67434684424f283376cdd42c4e523c91
domain: light
mode: single