Increase ventilation when the Co2 value is high

Hello,

I would like to switch my ventilation to level 2 when the co2 value is over 800 ppm.
I tried this:

alias: "KWL: Co2 Steuerung"
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.co2_wohnzimmer
    above: "800"
condition: []
action:
  - service: switch.toggle
    data: {}
    target:
      entity_id: switch.kwl_stufe_2
mode: single

The trigger doesn´t work.
The Co2 Sensor is connected via KNX und sends the correct values to HA:

    - name: "CO2 Wohnzimmer"
      state_address: 2/5/150
      type: ppm

Can you help me please?

The trigger only fires if CO2 goes from below 800 to above 800. Did you actually see this happen while the automation was active, or was the value above 800 all the time?

Thank you. It´already over 800 (~921).

If you want to see it work you could either try setting it to 925 and start breathing heavily, or open a window to have CO2 levels drop. I reccoment the latter :smile:

I just did some situps to increase the co2 levels. but after 5 it was unfortunately over :rofl:

Forcing my kids to play inside an not in the garden helps me testing the roule. It works!

I would like to define the following rules for ventilation:

All rules should only be triggered if level 0 (absence) and party mode are not active. Both are switched manually. Party mode switches the ventilation to level 3 for 30 minutes

Rule Nr.1:
If the CO2 sensor during the day (5:30 a.m. - 10:58 p.m.) is over 800, switch to level 2:

alias: "KWL: Co2 Steuerung Stufe 2"
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.co2_wohnzimmer
    above: 800
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: switch.kwl_stufe_0
        state: "on"
  - condition: not
    conditions:
      - condition: state
        entity_id: switch.kwl_stufe_3
        state: "on"
  - condition: time
    after: "05:30:00"
    before: "22:58:00"
action:
  - service: switch.toggle
    data: {}
    target:
      entity_id: switch.kwl_stufe_2
mode: single

Rule Nr.2:
If the Co2 sensor is below 800 for 5 miuntes during the day, it should be switched to level 1:

alias: "KWL: Co2 Steuerung Stufe 1"
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.co2_wohnzimmer
    for:
      hours: 0
      minutes: 5
      seconds: 0
    below: 800
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: switch.kwl_stufe_0
        state: "on"
  - condition: not
    conditions:
      - condition: state
        entity_id: switch.kwl_stufe_3
        state: "on"
  - condition: time
    after: "05:30:00"
    before: "22:58:00"
action:
  - service: switch.toggle
    data: {}
    target:
      entity_id: switch.kwl_stufe_1
mode: single

Rule Nr.3:
At night (10:59 p.m. to 5:30 a.m.) the ventilation should be switched to level 2 if no windows are open.

alias: "KWL: Co2 Steuerung in der Nacht"
description: ""
trigger:
  - platform: time
    at: "23:00:00"
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: switch.kwl_stufe_0
        state: ""
  - condition: state
    entity_id: binary_sensor.fenster_kinderzimmer_sud_2
    state: "on"
  - condition: state
    entity_id: binary_sensor.fenster_kinderzimmer_west_2
    state: "on"
  - condition: time
    after: "22:59:00"
    before: "05:30:00"
action:
  - service: switch.toggle
    data: {}
    target:
      entity_id: switch.kwl_stufe_2
mode: single

I hope that works. Can someone please take a look at the code and think through it?

Unfortunately I have problems with rule 2 (code see above). The rule is not triggered if the CO2 level is already below 800. Rule 1 is acitve at night. The CO2 content is then below 800 in the morning and rule 1 is therefore probably not activated.
How can I change this?
Thanks!

If you add a second trigger to rule 2 with the start time, and add an extra condition that the co2 should be below 800 for more than five minutes, that should work.

1 Like