Turn Light on Home assistant Automation

HA Automation: Turn on Heater in the Office on Weekdays

Really simple Home Assistant automation I wanted to share that turns the heater on in my office at 5am every weekday morning if the temperature in the office is below 71 and shut if off once it gets above 70.

You could easily customize this for your your own use case, turning on a light, fan, coffee etc.

alias: Turn on Office Heater at 5am
description: ""
trigger:
  - platform: time
    at: "05:00:00"
condition:
  - condition: device
    type: is_off
    device_id: XXXX
    entity_id: XXXX
    domain: switch
  - condition: numeric_state
    entity_id: sensor.h5072_75_tempc_2
    below: 71
  - condition: time
    weekday:
      - tue
      - mon
      - wed
      - thu
      - fri
action:
  - type: turn_on
    device_id: XXXX
    entity_id: XXXX
    domain: switch
  - repeat:
      sequence:
        - delay:
            hours: 0
            minutes: 15
            seconds: 0
            milliseconds: 0
      while:
        - condition: numeric_state
          entity_id: sensor.h5072_75_tempc_2
          below: 70
  - type: turn_off
    device_id: XXXX
    entity_id: XXXX
    domain: switch
mode: single

This is setup this way because after it gets to temp the homes thermostat takes over and manage the heat. This electric heater just gives it a boost in the morning.

I’m sure the code could be improved but it works reliably every day.