Boiler control

Looked to be a simple automation to bring on my boiler after zone valves opened but, boiler relay stays on no matter what. Am I missing something?

  alias: Boiler toggle
  description: ''
  trigger: []
  condition:
  - condition: state
    entity_id: switch.relay_channel_1_2
    state: 'on'
    for:
      hours: 0
      minutes: 3
      seconds: 0
  - condition: or
    conditions:
    - condition: state
      entity_id: switch.relay_channel_2_2
      state: 'on'
      for:
        hours: 0
        minutes: 3
        seconds: 0
    - condition: or
      conditions:
      - condition: state
        entity_id: switch.relay_channel_2
        state: 'on'
        for:
          hours: 0
          minutes: 3
          seconds: 0
      - condition: or
        conditions:
        - condition: state
          entity_id: switch.relay_channel_3
          state: 'on'
          for:
            hours: 0
            minutes: 3
            seconds: 0
        - condition: or
          conditions:
          - condition: state
            entity_id: switch.relay_channel_4
            state: 'on'
            for:
              hours: 0
              minutes: 3
              seconds: 0
          - condition: or
            conditions:
            - condition: state
              entity_id: switch.relay_channel_5
              state: 'on'
              for:
                hours: 0
                minutes: 3
                seconds: 0
            - condition: or
              conditions:
              - condition: state
                entity_id: switch.relay_channel_6
                state: 'on'
                for:
                  hours: 0
                  minutes: 3
                  seconds: 0
              - condition: state
                entity_id: switch.relay_channel_7
                state: 'on'
                for:
                  hours: 0
                  minutes: 3
                  seconds: 0
              - condition: or
                conditions:
                - condition: state
                  entity_id: switch.relay_channel_8
                  state: 'on'
                  for:
                    hours: 0
                    minutes: 3
                    seconds: 0
  action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.relay_channel_1
  mode: single

You’re missing a trigger to start the automation.

All of your conditions should be triggers.

Thanks, Tom. I got it with this one, just made a group and checked state. Seems to be working, turned off all relays and then turned one on, and it timed out, brought the relay on. Is there a way to and an “else” to this?

- id: '1643979406894'
  alias: Boiler toggle
  description: ''
  trigger:
  - platform: state
    entity_id: group.boiler_relays
    from: 'off'
    to: 'on'
    for:
      hours: 0
      minutes: 3
      seconds: 0
  action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.relay_channel_1

  mode: single

I’m not sure what you mean by this.

If the group is “off” to turn the switch off. Just added this, maybe it will work:

type or paste cod- id: '1643979406894'
  alias: Boiler toggle
  description: ''
  trigger:
  - platform: state
    entity_id: group.boiler_relays
    from: 'off'
    to: 'on'
    for:
      hours: 0
      minutes: 3
      seconds: 0
  action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.relay_channel_1
  trigger:
  - platform: state
    enitity_id: group.boiler_relays
    from: 'on'
    to: 'off'
  action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id: switch.relay_channel_1
  mode: single

Nope. That is not valid. You can only have one trigger block per automation. You could write two automations, or use this in one automation:

https://www.home-assistant.io/docs/scripts#choose-a-group-of-actions

That’s where I was going. If group state is on, toggle the relay on, else, toggle off.

- id: '1643979406894'
  alias: Boiler toggle
  description: ''
  trigger:
  - platform: state
    entity_id: group.boiler_relays
    from: 'off'
    to: 'on'
    for:
      hours: 0
      minutes: 3
      seconds: 0
  - platform: state
    entity_id: group.boiler_relays
    from: 'on'
    to: 'off' # did you want a 3 minute delay here like th above tirgger?
  action:
  - service: "switch.turn_{{ states('group.boiler_relays') }}"
    data: {}
    target:
      entity_id: switch.relay_channel_1
  mode: single

Jeez. I didn’t look at it that way, changing states. I guess I’ll stay with my day job. Thank you sir.

It’s the compact way of doing things. To do it with a choose action it would be:

action:
  - choose:
      - conditions: 
          - condition: state
            entity_id: group.boiler_relays
            state: 'on'
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.relay_channel_1
    default:
      - service: switch.turn_off
        target:
          entity_id: switch.relay_channel_1

As the trigger can only be to: ‘on’ or to: ‘off’ we don’t need to guard against the unknown or unavailable state of the group. This applies to the compact template version too.

Tom,

Just wanted to let you know everything works exactly the way I needed it. 3 minutes on a call for heat to allow zone valves to open before boiler and pump turn on, then shuts off the boiler and pump as soon as no call for heat is needed.

Learned quite a bit here. Moving on to the evaporative coolers as season approaches.

Thank you very much!

1 Like