That example shows how to easily implement a motion activated light. In the actions instead of on / off use the scene create / restore services you have already used above to accomplish your needs. No input boolean or timers required.
In the on / motion detected automation save your temporary scene and then adjust the lights how you want.
In the off / no motion automation restore your saved scene. Set the for: trigger to the time you want this to last.
EDIT: actually that will overwrite the before scene with the bright settings when motion repeats. You will need to set an input boolean and use it as a condition to prevent this. I’ll help you write this later, hard to do on mobile.
EDIT 2: Try this:
Input booleans:
input_boolean:
name: scene_saved
Automations:
- alias: 'Brighten the Garden'
trigger:
platform: state
entity_id: binary_sensor.front_garden_motion_motion
to: 'on'
condition:
condition: state
entity_id: input_boolean.scene_saved # prevents overwriting the before scene with the bright scene on motion repeat
state: 'off'
action:
- service: scene.create
data:
scene_id: garden_before
snapshot_entities:
- light.garden
- service: hue.hue_activate_scene
data:
group_name: Garden
scene_name: Bright
- service: input_boolean.turn_on # to prevent overwriting the before scene with the bright scene on motion repeat
entity_id: input_boolean.scene_saved
- alias: 'No Motion Restore Garden Lights'
trigger:
platform: state
entity_id: binary_sensor.front_garden_motion_motion
to: 'off'
for:
minutes: 2
action:
- service: scene.turn_on
data:
entity_id: scene.garden_before
- service: input_boolean.turn_off # allow saving of the before scene again.
entity_id: input_boolean.scene_saved