arjenhiemstra / ithowifi

Itho wifi add-on module (ESP32 wifi to itho I2C protocol)
GNU General Public License v3.0
181 stars 32 forks source link

Virtual C02 / Humidity sensor #196

Open henri98 opened 1 year ago

henri98 commented 1 year ago

Hi, First of all thnx for all for this project. I successfully assigned all the itho values via mqtt to home assistant. I have a question:

Is it possible to emulate the CO2 value or Humidity value through a virtual remote? If so, its possible to assign non itho sensors, for example a (zigbee) humidity sensor in bathroom to the speed control of the itho, this will result into step-less speed control, this is not possible when using (homeassistant) automations.

Maart3nL commented 1 year ago

A virtual CO2 sensor would be great! it would allow much more control over the speed the HRU units are running at and allow for much better control over the co2 levels in the house!

bkleef commented 1 year ago

This feature would be awesome. For me, Instead of a virtual remote, it would also be sufficient if the Itho Daalderop could use an MQTT topic to automatically determine the FAN speed. This MQTT topic could then automatically contain the highest CO2 value in the home with the help of Home Assistant, for example.

@henri98 with Home Assistant I made a sort of working speed control. It is based on CO2 levels + suddenly increased humidity in the bathroom (someone is showering). Maybe it will help you.

# Houd CO₂ onder 1.200 ppm.
# TODO: 1. Zodra de CO₂ omhoog gaat ventilatie 'preventief' aanslaan:
#         * Eventueel pas als deze verhoogt met een bepaald aantal of;
#         * Wanneer deze boven 800 komt.
- id: afzuiging
  alias: Afzuiging
  trigger:
    # Bij het bereiken van de ideale CO₂ waarde.
    - platform: numeric_state
      entity_id: sensor.co2_max
      below: 800
    # Bij het overstijgen van de ideale CO₂ waarde.
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 800
      below: 1000
    # Bij het overstijgen van de acceptabele CO₂ waarde.
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 1000
      below: 1200
    # Bij het overstijgen van de CO₂ bovengrens.
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 1200
      below: 1400
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 1400
      below: 1600
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 1600
    # Bij verhoogde luchtvochtigheid in badkamer.
    - platform: state
      entity_id: binary_sensor.badkamer_humidity_rising_5_min
      to: "on"
    # Wanneer gewenste luchtvochtigheid in badkamer is bereikt.
    - platform: template
      value_template: >
        {% if states('sensor.badkamer_humidity') | int(0) < states('input_number.badkamer_humidity_target') | int(0) %}
          True
        {% else %}
          False
        {% endif %}
  action:
    - service: fan.set_percentage
      data_template:
        percentage: >
          {% set co2 = states('sensor.co2_max') | int(0) %}

          {% if trigger.entity_id == 'binary_sensor.badkamer_humidity_rising_5_min' and trigger.to_state.state == 'on' %}
          100
          {% elif co2 > 800 and co2 <= 1000 %}
          20
          {% elif co2 > 1000 and co2 <= 1200 %}
          40
          {% elif co2 > 1200 and co2 <= 1400 %}
          60
          {% elif co2 > 1400 and co2 <= 1600 %}
          80
          {% elif co2 > 1600 %}
          100
          {% else %}
          0
          {% endif %}
      target:
        entity_id: fan.mechanical_ventilation
    # Stel luchtvochtigheid target enkel in bij verhoogde luchtvochtigheid in badkamer.
    - condition: and
      conditions:
        - condition: state
          entity_id: binary_sensor.badkamer_humidity_rising_5_min
          state: "on"
    # Stel gewenste luchtvochtigheid in op waarde op het moment van activeren afzuiging.
    - service: input_number.set_value
      target:
        entity_id: input_number.badkamer_humidity_target
      data:
        value: "{{ states('sensor.badkamer_humidity') | int(0) }}"
# Bepaal zonder code de momenteel hoogste CO₂ waarde in huis.
- platform: min_max
  # Laat naam niet eindigen op _co2 zodat deze sensor niet in Influx en Grafana komt!
  name: co2_max
  type: max
  entity_ids:
    - sensor.woonkamer_co2
    - sensor.slaapkamer_co2
    - sensor.babykamer_co2
# https://www.reddit.com/r/homeassistant/comments/t4hu42/track_difference_between_2_humidity_sensors/
- platform: trend
  sensors:
    # badkamer_humidity_rising_1_min:
    #   entity_id: sensor.badkamer_humidity
    #   friendly_name: Badkamer luchtvochtigheid stijgt (1 min.)
    #   max_samples: 15
    #   min_gradient: 0.008
    #   sample_duration: 60
    # badkamer_humidity_rising_3_min:
    #   entity_id: sensor.badkamer_humidity
    #   friendly_name: Badkamer luchtvochtigheid stijgt (3 min.)
    #   max_samples: 15
    #   min_gradient: 0.008
    #   sample_duration: 180
    # If the change is greater than 2,4%, evals to true: 2,4/(60*5)
    badkamer_humidity_rising_5_min:
      entity_id: sensor.badkamer_humidity
      friendly_name: Badkamer luchtvochtigheid stijgt (5 min.)
      max_samples: 15
      min_gradient: 0.008
      sample_duration: 300
Maart3nL commented 9 months ago

This feature would be awesome. For me, Instead of a virtual remote, it would also be sufficient if the Itho Daalderop could use an MQTT topic to automatically determine the FAN speed. This MQTT topic could then automatically contain the highest CO2 value in the home with the help of Home Assistant, for example.

@henri98 with Home Assistant I made a sort of working speed control. It is based on CO2 levels + suddenly increased humidity in the bathroom (someone is showering). Maybe it will help you.

# Houd CO₂ onder 1.200 ppm.
# TODO: 1. Zodra de CO₂ omhoog gaat ventilatie 'preventief' aanslaan:
#         * Eventueel pas als deze verhoogt met een bepaald aantal of;
#         * Wanneer deze boven 800 komt.
- id: afzuiging
  alias: Afzuiging
  trigger:
    # Bij het bereiken van de ideale CO₂ waarde.
    - platform: numeric_state
      entity_id: sensor.co2_max
      below: 800
    # Bij het overstijgen van de ideale CO₂ waarde.
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 800
      below: 1000
    # Bij het overstijgen van de acceptabele CO₂ waarde.
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 1000
      below: 1200
    # Bij het overstijgen van de CO₂ bovengrens.
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 1200
      below: 1400
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 1400
      below: 1600
    - platform: numeric_state
      entity_id: sensor.co2_max
      above: 1600
    # Bij verhoogde luchtvochtigheid in badkamer.
    - platform: state
      entity_id: binary_sensor.badkamer_humidity_rising_5_min
      to: "on"
    # Wanneer gewenste luchtvochtigheid in badkamer is bereikt.
    - platform: template
      value_template: >
        {% if states('sensor.badkamer_humidity') | int(0) < states('input_number.badkamer_humidity_target') | int(0) %}
          True
        {% else %}
          False
        {% endif %}
  action:
    - service: fan.set_percentage
      data_template:
        percentage: >
          {% set co2 = states('sensor.co2_max') | int(0) %}

          {% if trigger.entity_id == 'binary_sensor.badkamer_humidity_rising_5_min' and trigger.to_state.state == 'on' %}
          100
          {% elif co2 > 800 and co2 <= 1000 %}
          20
          {% elif co2 > 1000 and co2 <= 1200 %}
          40
          {% elif co2 > 1200 and co2 <= 1400 %}
          60
          {% elif co2 > 1400 and co2 <= 1600 %}
          80
          {% elif co2 > 1600 %}
          100
          {% else %}
          0
          {% endif %}
      target:
        entity_id: fan.mechanical_ventilation
    # Stel luchtvochtigheid target enkel in bij verhoogde luchtvochtigheid in badkamer.
    - condition: and
      conditions:
        - condition: state
          entity_id: binary_sensor.badkamer_humidity_rising_5_min
          state: "on"
    # Stel gewenste luchtvochtigheid in op waarde op het moment van activeren afzuiging.
    - service: input_number.set_value
      target:
        entity_id: input_number.badkamer_humidity_target
      data:
        value: "{{ states('sensor.badkamer_humidity') | int(0) }}"
# Bepaal zonder code de momenteel hoogste CO₂ waarde in huis.
- platform: min_max
  # Laat naam niet eindigen op _co2 zodat deze sensor niet in Influx en Grafana komt!
  name: co2_max
  type: max
  entity_ids:
    - sensor.woonkamer_co2
    - sensor.slaapkamer_co2
    - sensor.babykamer_co2
# https://www.reddit.com/r/homeassistant/comments/t4hu42/track_difference_between_2_humidity_sensors/
- platform: trend
  sensors:
    # badkamer_humidity_rising_1_min:
    #   entity_id: sensor.badkamer_humidity
    #   friendly_name: Badkamer luchtvochtigheid stijgt (1 min.)
    #   max_samples: 15
    #   min_gradient: 0.008
    #   sample_duration: 60
    # badkamer_humidity_rising_3_min:
    #   entity_id: sensor.badkamer_humidity
    #   friendly_name: Badkamer luchtvochtigheid stijgt (3 min.)
    #   max_samples: 15
    #   min_gradient: 0.008
    #   sample_duration: 180
    # If the change is greater than 2,4%, evals to true: 2,4/(60*5)
    badkamer_humidity_rising_5_min:
      entity_id: sensor.badkamer_humidity
      friendly_name: Badkamer luchtvochtigheid stijgt (5 min.)
      max_samples: 15
      min_gradient: 0.008
      sample_duration: 300

for the units that support a pwm fan speed that would you can already make this easily with home assistant using any co2 sensor you like. but for units like the HRU 350 you can only select the Auto, Auto Night, Low, Medium, High and while you can use that to respond on co2 levels (that's how Ive set it up right now) its very crude and you get giant leaps in RPM.

A virtual CO2 sensor enables the usage of any CO2 sensor you can connect to and at the same time gives the option to let the ventilation unit to keep the co2 levels much lower using the build-in algorithm controlling the speed.

by default the unit starts ramping the speed when co2 gets over 1050ppm, using a virtual sensor that takes the actual reading and add's 200ppm and sends it to the ventilation unit will lower that threshold to about 850ppm

ibjr commented 4 months ago

I agree: this feature would be awesome, especially for users with an HRU350.