Hi guys,

I recently ordered a MH-Z19 CO2-sensor that i am going to use to control the mechanical ventilation in my house. I have the sensor connected to MQTT and i can see the values coming in fine. I have also ordered a Linknode R4 relay board (it is actually a board with a ESP8266 with four relays that i flashed ESPEasy on, so it can be controlled over MQTT, very nice board) which i want to use to control the different fan speeds of the ventilation unit (Itho Ecofan).

The ventilation unit has multiple wires:

Wire 1 is always connected to phase, so the box is always on the lowest speed to ensure minimal ventilation in the house

When wire 2 is connected to phase, the unit switches to medium speed

When wire 3 is connected to phase, the unit switches to high speed

However, how would i setup my rules?

I was thinking of something like this:

alias: 038 - Ventilation medium trigger: platform: numeric_state entity_id: sensor.co2 above: 600 action: - service: switch.turn_on entity_id: - switch.relay1

alias: 039 - Ventilation high trigger: platform: numeric_state entity_id: sensor.co2 above: 800 action: - service: switch.turn_on entity_id: - switch.relay2

But i’m getting a bit confused on how i can get it to switch back to lower speeds, without rules being conflicting each other? Can i just create two other rules with below: 800 + switch.turn_off to switch back to medium and another one ( below: 600 ) to switch back to low? Isn’t this going to conflict each other?

I don’t want the relays to be on/off/on/off quickly after each other, some hysterese would be nice but i guess i can create that by expanding the ppm trigger values a bit (650 for on, 600 off etc) so the setup will get less nervous.

For someone not knowing anything about CO2-levels inside a livingroom, a basic pattern looks like this:

Nighttime: low levels, around 400-500 ppm

Someone in the room: ppm level increases to 550-650

Multiple people in the room: 800-900 ppm

A lot of people in the room: 1200 - 2000+ ppm

I want HASS to think about which fan speed is needed so i always have optimal fresh air, but don’t ventilate too much (and lose warm air in the winter).