Help setting up timed temperature automation

I’m new to home assistant so I’m sure I’m missing something simple. Anyway, I’m using Dyson Local and trying to setup an automation where the heat will turn on if it is below 66 degrees but only if it is between 7 PM and 8 AM.

I believe the way it is setup below it will only turn on if the temperature drops below 66 degrees while it is between 7 PM and 8 AM. Meaning if it is 64 degrees at 6:59 PM this automation won’t be triggered. How do I fix that?

A different automation turns it off at a set time.

alias: Heat Room
description: ''
trigger:
  - type: temperature
    platform: device
    device_id: xxxxxx
    entity_id: sensor.pure_hot_cool_temperature
    domain: sensor
    below: 66
condition:
  - condition: and
    conditions:
      - condition: time
        after: '19:00:00'
        before: '08:00:00'
action:
  - device_id: xxxxxx
    domain: climate
    entity_id: climate.pure_hot_cool
    type: set_hvac_mode
    hvac_mode: heat
  - type: turn_on
    device_id: xxxxxx
    entity_id: switch.pure_hot_cool_night_mode
    domain: switch
  - type: turn_on
    device_id: xxxxxx
    entity_id: switch.pure_hot_cool_front_airflow
    domain: switch
  - type: turn_on
    device_id: xxxxxx
    entity_id: switch.pure_hot_cool_auto_mode
    domain: switch
mode: single

Thanks,
Matt

Your assumption is correct if it is below 66 between 7pm and 8 am, it won’t trigger…
but your condition between 7PM and before 8AM is not correct neither… You have to build the condition to be after 7PM OR (and not AND) before 8AM… You have to think the condition for a day… 11 PM is after 7PM but not before 8AM…
So you have to check on regular basis (every minutes for example using platform: time_pattern for example) that your conditions are met:

Condition:
AND
temperature < 66
OR
time after 7Pm
time before 8AM

So this become:

alias: Heat Room
description: ''
trigger:
  - platform: time_pattern
    minutes: "/1"
condition:
  - condition: state
    entity_id: sensor.pure_hot_cool_temperature
    below: 66   
  - condition: or
    conditions:
      - condition: time
        after: '19:00:00'
      - condition: time
        before: '08:00:00'

Or better still (triggers a lot less often):

alias: Heat Room
description: ''
trigger:
  - platform: time
    at: '19:00'
  - platform: state
    entity_id: sensor.pure_hot_cool_temperature
condition:
  - condition: state
    entity_id: sensor.pure_hot_cool_temperature
    below: 66   
  - condition: or
    conditions:
      - condition: time
        after: '19:00:00'
      - condition: time
        before: '08:00:00'

Adding a home assistant start trigger can be worthwhile too.

1 Like

Install HACS and Scheduler component + Sceduler Card. That makes it easy to create schedules for anything - like temperature

Thank you for all of the suggestions. I’m new to Home Assistant but so far I’m loving all of the flexibility this provides. There doesn’t seem to be any “one” way to do anything.

I’m pretty new to this so I’m sure I’m wrong but the way I read that automation, the trigger at 7pm checks all the conditions are true and if so will heat the room. If so how does that work if the room’s at say 68 degrees at 7pm and only goes below 66 at 8pm, will the automation still be running at 8pm to detect that?

The second trigger is continuously monitoring the temperature sensor for state-changes. If the temperature changes, the first condition checks it is now less than 66. The second condition checks if the current time is within the desired range. If both conditions are met, the action is executed.

Ah excellent, learn something every day :slight_smile: