- id: do_random_actions_when_away alias: Activate Random Actions for Security mode: parallel # Enable parallel executions trigger: - platform: time_pattern minutes: /5 condition: alias: "Away routine active, nearly sunset, and all family not home" condition: and conditions: - condition: sun after: sunset after_offset: -00:30:00 #30 mins before - condition: state entity_id: input_boolean.away_occupied_routine state: "on" - condition: state entity_id: group.family_away state: "not_home" action: service: script.light_duration data: # Pass randomly selected light from "group.simulation_lights" as script variable "light" light: "{{states.group.simulation_lights.attributes.entity_id | random}}" # random value between 5 & 29 duration: "00:{{ '{:02}'.format(range(5,29) | random | int) }}:00"