Need help to configure temp automation

Hello, i am trying to create automation in which the air conditioner is turned on if the temp is below 20 degree and the time interval is between 20:30 and 07:00 o’clock. I have created a time helper with schedule time interval from 20:30 to 07:00 for everyday which is trigger and for conditions i have set to check if temp in the room is under 20 degree and if we are at home of Sofia zone. The actions are to send me notification and to run scene for the air-conditioner.
I want my automation to check if the temp drop down below 20 degree in the schedule time interval to turn on air conditioner and also if the temp is below 20 degree when the schedule starts (for this situation at 20:30) to turn on air conditioner again.

alias: Turn on Valeri's air conditioner when temp is below 20
description: ""
trigger:
  - platform: state
    entity_id:
      - schedule.valeri_airconditioner
condition:
  - condition: and
    conditions:
      - condition: numeric_state
        entity_id: sensor.rm4_mini_temperature
        below: 20
      - condition: or
        conditions:
          - condition: numeric_state
            entity_id: zone.home
            above: 0
          - condition: numeric_state
            entity_id: zone.in_sofia
            above: 0
action:
  - service: scene.turn_on
    target:
      entity_id: scene.valeri_air_conditioner
    metadata: {}
  - device_id: 5a324c34182495672c52d180876f56b4
    domain: mobile_app
    type: notify
    message: Valeri's air conditioner is turned on
mode: single

The automation requires additional triggers and conditions to ensure the action is executed for all the correct circumstances.

alias: Turn on Valeri's air conditioner when temp is below 20
description: ""
trigger:
  - platform: state
    entity_id:
      - schedule.valeri_airconditioner
    to: 'on'
  - platform: numeric_state
    entity_id:
      - sensor.rm4_mini_temperature
    below: 20
  - platform: numeric_state
    entity_id:
      - zone.home
      - zone.in_sofia
    above: 0
condition:
  - condition: and
    conditions:
      - condition: state
        entity_id:
          - schedule.valeri_airconditioner
        state: 'on'
      - condition: numeric_state
        entity_id:
          - sensor.rm4_mini_temperature
        below: 20
      - condition: or
        conditions:
          - condition: numeric_state
            entity_id: zone.home
            above: 0
          - condition: numeric_state
            entity_id: zone.in_sofia
            above: 0
action:
  - service: scene.turn_on
    target:
      entity_id: scene.valeri_air_conditioner
    metadata: {}
  - device_id: 5a324c34182495672c52d180876f56b4
    domain: mobile_app
    type: notify
    message: Valeri's air conditioner is turned on
mode: single

thanks, i thinks it is working because i change the helper with earlier time to test it and in the schedule time the temp drop down below 20 and the air conditioner turned on. Thanks again.
I have one question why i need home and sofia zones as triggers and not only as condition ? :slight_smile:

In your version of the automation, when the schedule turns on but the temperature is above 20, the scene is not turned on. However, if a few minutes later the temperature sensor rises above 20, the scene should be turned on but it won’t be because the automation isn’t triggered by the temperature sensor.

Similarly, if the schedule turns on but you are no one is home, the scene is not turned on. However, if a few minutes later someone comes home, the scene should be turned on but it won’t be because the automation isn’t triggered by presence.

In addition, your original version of the automation triggers when the schedule turns on and when it turns off. I doubt you want the scene turned on when the schedule turns off.

got it. thanks again :slight_smile:

1 Like

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

1 Like