Ventilation automation with bypass

Hi

i am trying to make a ventilation automation based on VOC and Humidity with a bypass button.

i almost got it working :slight_smile:

1 fan on the roof.
I got 3 humidity sensors that starts the fan if one of them goes over 70% and turns off the fan again is all are under 50%

I got 2 VOC sensors that turn on the fan if the value is over 200 and off again if both are under 100. all 5 sensors in same automation :slight_smile:

i only have problems getting my sonoff button SNZB-01 to act as a bypass button for when i want to start a fire in the fireplace.
reason for bypass that i get a backdraft through the chimney and fills the whole house with smoke if the fan is running.

promlem is that SNZB-01 it is not a sensor and it only triggers an event and i cant seem to get it right :frowning:

alias: Fan Control Based on Humidity & Air Quality
description: ""
triggers:
  - entity_id:
      - sensor.bad_climate_01_humidity
      - sensor.bed_climate_01_humidity
      - sensor.kit_climate_01_humidity
    above: 60
    id: turn_on_humidity
    trigger: numeric_state
  - entity_id:
      - sensor.bed_climate_01_voc
      - sensor.hal_up_climate_01_voc
    above: 200
    id: turn_on_air_quality
    trigger: numeric_state
  - value_template: |-
      {{
        states('sensor.bad_climate_01_humidity') | float(0) < 50 and
        states('sensor.bed_climate_01_humidity') | float(0) < 50 and
        states('sensor.kit_climate_01_humidity') | float(0) < 50 and
        states('sensor.bed_climate_01_voc') | float(0) < 100 and
        states('sensor.hal_up_climate_01_voc') | float(0) < 100
      }}
    id: turn_off
    trigger: template
  - trigger: mqtt
    topic: zigbee2mqtt/KAMIN
    payload: action:"single"
    id: bypass
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: turn_on_humidity
        sequence:
          - target:
              entity_id: switch.pro2pm_h_01_switch_0
            action: switch.turn_on
            data: {}
      - conditions:
          - condition: trigger
            id: turn_on_air_quality
        sequence:
          - target:
              entity_id: switch.pro2pm_h_01_switch_0
            action: switch.turn_on
            data: {}
      - conditions:
          - condition: trigger
            id: turn_off
        sequence:
          - target:
              entity_id: switch.pro2pm_h_01_switch_0
            action: switch.turn_off
            data: {}
      - conditions:
          - condition: trigger
            id:
              - bypass
        sequence:
          - target:
              entity_id: switch.pro2pm_h_01_switch_0
            action: switch.turn_off
            data: {}
          - delay:
              hours: 0
              minutes: 0
              seconds: 10
              milliseconds: 0
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.pro2pm_h_01_switch_0
mode: restart

any ideas where i f… up ?

Greets
Thomas

got it sort of working.

alias: Fan Control Based on Humidity & Air Quality fixed with bypass
description: ""
triggers:
  - entity_id:
      - sensor.bad_climate_01_humidity
      - sensor.bed_climate_01_humidity
      - sensor.kit_climate_01_humidity
    above: 60
    id: turn_on_humidity
    trigger: numeric_state
  - entity_id:
      - sensor.bed_climate_01_voc
      - sensor.hal_up_climate_01_voc
    above: 200
    id: turn_on_air_quality
    trigger: numeric_state
  - value_template: |-
      {{
        states('sensor.bad_climate_01_humidity') | float(0) < 50 and
        states('sensor.bed_climate_01_humidity') | float(0) < 50 and
        states('sensor.kit_climate_01_humidity') | float(0) < 50 and
        states('sensor.bed_climate_01_voc') | float(0) < 100 and
        states('sensor.hal_up_climate_01_voc') | float(0) < 100
      }}
    id: turn_off
    trigger: template
  - topic: zigbee2mqtt/KAMIN
    value_template: "{{ value_json.action == 'single' }}"
    id: bypass
    trigger: mqtt
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: turn_on_humidity
        sequence:
          - target:
              entity_id: switch.pro2pm_h_01_switch_0
            action: switch.turn_on
            data: {}
      - conditions:
          - condition: trigger
            id: turn_on_air_quality
        sequence:
          - target:
              entity_id: switch.pro2pm_h_01_switch_0
            action: switch.turn_on
            data: {}
      - conditions:
          - condition: trigger
            id: turn_off
        sequence:
          - target:
              entity_id: switch.pro2pm_h_01_switch_0
            action: switch.turn_off
            data: {}
      - conditions:
          - condition: trigger
            id: bypass
        sequence:
          - target:
              entity_id: switch.pro2pm_h_01_switch_0
            action: switch.turn_off
            data: {}
          - delay:
              hours: 0
              minutes: 1
              seconds: 0
              milliseconds: 0
          - target:
              entity_id: switch.pro2pm_h_01_switch_0
            action: switch.turn_on
            data: {}
mode: restart