Currently, I have an automation that turns on my air conditioner for 37 minutes, every 3 hours. However, during that time, I cannot do anything like update, HAOS, etc. Because it breaks the timer, and then I have to manually shut it off.

  • Christian Hawkins@feddit.org
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    22 days ago

    There are many ways how you could go about this.

    The easiest way with the fewest helpers imo is to execute it every minute, check if the ac should be on or off based on your time rules and then turn it to the state you want it, if it is not in that state.

    description: Turn AC on between minutes 0-37 of hours 0,3,6,9,12,15,18,21; off otherwise
    trigger:
      - platform: time_pattern
        minutes: "/1"  # runs every minute
    
    condition: []
    
    action:
      - choose:
          - conditions:
              - condition: template
                value_template: >
                  {% if now().hour in [0,3,6,9,12,15,18,21] and 0 <= now().minute <= 37 %}
                    true
                  {% else %}
                    false
                  {% endif %}
            sequence:
              - condition: state
                entity_id: switch.ac
                state: "off"
              - service: switch.turn_on
                target:
                  entity_id: switch.ac
        default:
          - condition: state
            entity_id: switch.ac
            state: "on"
          - service: switch.turn_off
            target:
              entity_id: switch.ac
    mode: single```