Generic hygrostat (thermostat for humidity)

Hi all!

I have for a while now been missing a component to control humidity as you can with sensors and switches for temperature. The generic thermostat component is fantastic in the way that it allows you to create a relatively intelligent climate control unit with no more than any kind of switch and any kind of sensor as long as the sensor reports temperature. I feel like this could be almost copy-pasted into a new component named generic hygrostat.

My use case is in a bathroom, where I have a multisensor reporting humidity and a switch that controls the fan. But as I am sure there are plenty of people out there without a fancy HAVC system that would like easy-to-access climate control, as with the generic_thermostat, I really think this makes sense!

Hi!

I like the idea. Currently I am doing this with an automation rule for a dehumidifier, but it probably would make sense to have an easy way to set the humidity for this room to different values. Here is my current rule: https://github.com/cyberkov/home-assistant-config/blob/master/config/automation/luftentfeuchter.yaml

Cheers Hannes

Thanks for support! :slight_smile: Glad this makes sense to more than myself!

I have also an automation set up, although not as pretty as it could be:

- platform: template
    sensors:
     bathroom_humidity:
      friendly_name: "bad fuktighet"
      value_template: >-
        {% set humidity = states('sensor.multisensor_bad_relative_humidity')|float(none) %}
        {% set bathroom_humidity = states.input_slider.bathroom_humidity_target.state|default(60)|float %}
        {% if humidity is none %}
          {{ states('sensor.multisensor_bad_relative_humidity') }}
        {% elif humidity > bathroom_humidity %}
          1
        {% else %}
          0
        {% endif %}
- alias: 'Badevifte auto on'
  trigger:
    platform: state
    entity_id: sensor.bathroom_humidity
    from: '0'
    to: '1'
  action:
    service: switch.turn_on
    entity_id: switch.badevifte_switch

- alias: 'Badevifte auto off'
  trigger:
    platform: state
    entity_id: sensor.bathroom_humidity
    from: '1'
    to: '0'
    for: 00:01:00
  action:
    - service: switch.turn_off
      entity_id: switch.badevifte_switch

As an old domoticz user I would love to have something like this: https://www.domoticz.com/wiki/Humidity_control

Itā€™ does not use hard limits, but rather looks at increases of the humidity over time and once it goes over a threshold (delta) it actives. It either stops when reached the original humidity or after a safety time-out.

I have a similar usecase as @magnus.overli and I support this request.
Already having the generic thermostat I guess it canā€™t be much work making a generic hygrostat.

There are some issues with this as you need to factor in ambient humidity to figure out target humidity.

Iā€™ve created a generic sensor which is the average of all humidity sensors in the house, and react on the delta between the average and my bathroom sensor(s) to trigger the level of the extractor fan. This seems to be working quite reliably where I donā€™t need to adjust the target during the year. (Winter is a ~10% dryer than summer.)

I may not understand you completely, but I donā€™t see the need to include ambient humidity into the calculations. The target maximum humidity should be a hard value, and the ambient humidity is not a factorā€¦

The functionality is identical to the generic thermostat, the input value simply has a different unit of measurement.

Iā€™m surprised to hear you say that. Between winter and summer ambient humidity varies up to about 20% where I live (StrĆømmen). I guess you could aim you bathroom for a level of humidity comparable with the highest ambient humidity in summer. There are two problems with this however; the highest ambient in summer might be higher than you prefer to have your bathroom at and if you set your target humidity lower than ambient humidity your extractor fan will run continuously as you try to dehumidify the worldā€¦

I am not disagreeing with you that this would be the best implementation in an ideal scenarioā€¦ But by that logic, the same rules would apply to a thermostat. I am not using any kind of logic on my thermostats, simply having an automation setting a target value based on time of day. For my level of control I would only need a similar function to the generic thermostat.

Possibly, it could be done as a differential based on the relative humidity in the rest of the house. That would make things simpler, no? Saying that the target relative humidity for the bathroom should be no more than 15% above the average level of all other measurements in the houseā€¦?

This is basically the same logic that you are currently using. My point is, that this is something should be easily implemented as a generic component, readily available to users that want to do home automation outside turning on/iff lights, but donā€™t have the skills or incentive to learn how to ā€œprogramā€ this functionality themselves.

I would say that ventilation and heating (where the house is not heated through ventilation) are quite different things. When you extract air from a room to lower the humidity you replace the air with air from outside the room. Therefore you can not have lower humidity than the average.
When heating (assuming doors are closed and heating source is sufficient) temperature should reach the set point. There can be reasons to do similar things with heating though. A very open house might for example set limitations on heating on lower floors based on heat at the top of the house, but this is quite outside the scope now I think. :smile:

Everything else you said I completely agree with you. I think a generic_hydrostat component makes a lot of sense and Iā€™ve seen a lot of people struggle to make meaningful hydrostats.

So, to sum things up, we agree for the most partā€¦? :wink:

Just to be clear, I tried to say that the target humidity for the bathroom (in this case) could be set to 15% ABOVE the average for the rest of the house. That, I think, also makes sense in respect to to your (correct) description about replacing the the air with new air from outside the room when pulling out humid air.

1 Like

Hi guys,

I am also interested! Iā€™m trying to code this, a first proposal:

https://github.com/home-assistant/home-assistant/pull/13046

Please test and shoot! :slight_smile:

1 Like

Nice work!

I fooled the generic_thermostat into being a hygrostat by using unit_of_measurement: ā€œĀ°Cā€ instead of unit_of_measurement: ā€œ%ā€ for my sensor.
It works, except that the hygrostat displays Ā°C, but I can live with that for now.

1 Like

Hi Bas,

Are you going to move forward on this? Or are you a bit discouraged by the PR feedback?

Interested in this!

However, the current code doesnā€™t seem to work in 0.85.1. The config check never finishes with the script enabled.

Would be very cool to get this in HA!

Would also love to have it. Currently using automations, but there should be an easier way.

Sorry to revive an old thread, did a hygrostat or generic humidstat ever get added into HA? I canā€™t seem to find any documentation on it if it didā€¦

Please be patient. I am doing a good attempt right now. You can subscribe to a github issue here: https://github.com/home-assistant/core/pull/36759

1 Like

@Shulyaka
I am so glad to see the work youā€™ve done! It looks very nice, and is completely in line with my initial idea! Looking forward to test it!
Thank you very much for your work! :slight_smile: