Also tooting on Mastodon: https://chaos.social/@ChristianHawkins

  • 0 Posts
  • 2 Comments
Joined 8 months ago
cake
Cake day: February 23rd, 2025

help-circle
  • 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```