Anyone have a good vacation lighting automation?

Have been busy with this script lately. Some syntax is not up to date to current implementation.

Calling a script as a service, e.g.:

- service: script.turn_on
  entity_id: script.your_script

Wait template for state sensor.time has changed, e.g.:

- wait_template: "{{ states('sensor.time') == '07:00' }}"

Using scripted logic for selecting an entity, e.g.:

    - service: script.turn_on
      data_template:
        entity_id: >
          {% if states('binary_sensor.dark_outside' , 'on') %} script.morning_mockupancy
          {% else %} script.mockupancy_loop {% endif %}

Check your semantics for the above errors and correct them, and your script will run.
I’ve also added an automation that runs the mockupancy script triggerd by input state ‘Extended Away’.

1 Like

Another addition to the script in terms of semantics update: setting the random mockupancy bedtime

 - service: input_datetime.set_datetime
      data_template:
        entity_id: input_datetime.mockupancy_bedtime
        time: "{{ (range(22, 23)|random|int) }}:{{ (range(10, 59)|random|int) }}:00"

Notice the change set_time --> set_datetime

@sentur and @RickTSD above changes will get your script running definitely. You can check for errors on the scripts page by pressing the play-button and watching for error messages.