Automation to turn off a plug at 5am unless I'm home then turn off at 10am

Not quite sure why it’s having trouble using trigger_variables but it’s Friday evening here and I don’t have time to experiment with it. For now, simply use the entity_id directly where needed and eliminate the use of trigger_variables.

alias: Wall Heater Hall Schedule OFF
description: Control panel heater
trigger:
  - platform: time
    at: "09:13:00"
    variables:
      is_true: "{{ is_state('device_tracker.suzy_s_iphone_2', 'not_home') }}"
  - platform: time
    at: "09:14:00"
    variables:
      is_true: "{{ true }}"
condition:
  - condition: template
    value_template: "{{ is_true and is_state('switch.heater_socket', 'on') }}"
action:
  - service: switch.turn_off
    target:
      entity_id: switch.heater_socket
mode: single
1 Like