GithubHelp home page GithubHelp logo

therealwaldo / ha-optimal-humidity Goto Github PK

View Code? Open in Web Editor NEW
20.0 1.0 1.0 307 KB

Home Assistant Utility Sensor to assist with maintaining the optimal humidity in your home!

License: MIT License

Python 99.17% JavaScript 0.46% Shell 0.37%
homeassistant hacs home-assistant homeassistant-integration homeassistant-sensor homeassistant-custom-component

ha-optimal-humidity's Introduction

ha-optimal-humidity

hacs GitHub Release GitHub Activity License

Home Assistant Sensor Integration to assist with maintaining the optimal humidity in your home!

Please see this Discussion on Humidity for a good overview of some of the terms used in this integration.

Many signs of inadequate humidity levels can occur, but here are a few common examples:

Too much humidity

  • Condensation on windows in winter
  • Uncomfortable feeling in summer
  • Moisture stains on walls
  • Musty smell
  • Mold

Not enough humidity

  • Itchy eyes, nose, and skin
  • Dry skin and chapped lips
  • Static
  • Damaged wood floors

Most systems use relative humidity as set-points for humidification systems, which of course, is relative to temperature. That means setting a fixed relative humidity would also require a fixed temperature. In an ideal world, we would maintain a fixed temperature, but in most environments, that comes at a high cost.

Apparent temperature, or the temperature we feel, is also impacted by humidity. Therefore, we can maintain a comfortable environment by controlling humidity more fluidly, and also control costs, as it is significantly less expensive to add humidity to the air than heat.

In addition to how we feel, other organisms love humid environments, such as mold. Mold can have detrimental effects on health and can do irreparable damage to your home. Condensation on windows is also a factor. This sensor also considers these factors by allowing one to assign a critical temperature sensor for the coldest point in your controlled location. For example, you can place critical temperature sensors at your window or on your basement floor.

Another factor that influences humidity that is not often considered is air pressure.

This sensor integration attempts to determine the optimal relative humidity set point for your humidifiers and dehumidifiers based on those factors.

Installation

MANUAL INSTALLATION

  1. Download the zip file from latest release.
  2. Unpack the release and copy the custom_components/optimal_humidity directory into the custom_components directory of your Home Assistant installation.
  3. Configure the optimal_humidity sensor.
  4. Restart Home Assistant.

Configuration

# Example configuration.yaml entry

sensor:
  - platform: optimal_humidity
    sensors:
      test_optimal_humidity:
        name: "Optimal Humidity"
        type: optimal_humidity
        indoor_temp_sensor: sensor.indoor_temp
        indoor_humidity_sensor: sensor.indoor_humidity
        critical_temp_sensor: sensor.critical_temp
        indoor_pressure_sensor: sensor.indoor_pressure

Main Options

Parameter Required Description
indoor_temp_sensor Yes Temperature sensor to use for calculations. Typically the warmest sensor in the room.
indoor_humidity_sensor Yes Humidity sensor to use for calculations. Typically in the same location as the indoor_temp_sensor.
critical_temp_sensor Yes Temperature sensor to use for calculations to avoid mold and condensation. Typically the coldest sensor in the room.
name No Friendly name Default: Optimal Humidity
type No The type of sensor to use for the primary state. Value can be any of the attributes listed below. Default: optimal_humidity
indoor_pressure_sensor No Pressure sensor to use for calculations. If not included, will use the elevation set in Home Assistant to calculate the Standard Air Pressure.
comfortable_specific_humidity No Overrides the comfortable specific humidity calculation. In milligrams of H₂O per gram of Air⁻¹ Default: Calculated based on indoor_pressure_sensor if available, or from Home Assistants elevation setting if not.

Attributes

Attribute Unit Description
dewpoint °C/°F Dewpoint from the indoor_temp_sensor and indoor_humidity_sensor and indoor_pressure_sensor combined.
optimal_humidity %RH The optimal set point in relative humidity for a humidifier or dehumidifier.
comfortable_specific_humidity milligrams of H₂O per gram of Air⁻¹ Calculated based on indoor_pressure_sensor or Home Assistants elevation setting, 21°C and 45%RH. Can be overridden by using the comfortable_specific_humidity option.
specific_humidity milligrams of H₂O per gram of Air⁻¹ Specific humidity from the indoor_temp_sensor and indoor_humidity_sensor and indoor_pressure_sensor combined.
critical_humidity %RH Calculated critical humidity at the coldest point in the room, using the critical_temp_sensor.
mold_warningr boolean Whether or not there is a risk of mold at either the critical point or the indoor sensor location.
humidex °C/°F Humidex using the Canadian standard.
humidex_comfort text An english statement describing the current human comfort level base on the humidex.
optimal_humidex °C/°F Humidex at the optimal_humidity with the current temperature from indoor_temp_sensor.
comfortable_humidity %RH Comfortable humidity, not taking into account the critical_temp_sensor.

Contributions are welcome!

If you want to contribute to this integration, please read the Contribution guidelines

ha-optimal-humidity's People

Contributors

dependabot[bot] avatar therealwaldo avatar trw-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mpkogli

ha-optimal-humidity's Issues

Update import of hass temperature utilities

Version of the custom_component

Latest, v2.0.6

Configuration

- platform: optimal_humidity
  sensors:
    test_optimal_humidity:
      name: "Optimal Humidity"
      type: optimal_humidity
      indoor_temp_sensor: sensor.inkbird_temperature
      indoor_humidity_sensor: sensor.inkbird_humidity
      critical_temp_sensor: sensor.ibs_th_0888_temperature

Describe the bug

In the latest release, I'm getting the below error message in the logs. Looks like HASS moved the temperature conversion functions to a different module. PR created: #214

Debug log


2023-10-11 13:10:20.199 ERROR (MainThread) [homeassistant.helpers.event] Error while dispatching event for sensor.inkbird_temperature to <Job track state_changed event ['sensor.inkbird_humidity', 'sensor.inkbird_temperature', 'sensor.ibs_th_0888_temperature'] HassJobType.Callback <function OptimalHumidity.async_added_to_hass.<locals>.critical_humidity_sensors_state_listener at 0x15441fd362a0>>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 293, in _async_dispatch_entity_id_event
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 636, in async_run_hass_job
hassjob.target(*args)
File "/config/custom_components/optimal_humidity/sensor.py", line 218, in critical_humidity_sensors_state_listener
if self._update_sensor(entity, old_state, new_state):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/optimal_humidity/sensor.py", line 283, in _update_sensor
self._indoor_temp = OptimalHumidity._update_temp_sensor(new_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/optimal_humidity/sensor.py", line 319, in _update_temp_sensor
return util.temperature.fahrenheit_to_celsius(temp)
^^^^^^^^^^^^^^^^
AttributeError: module 'homeassistant.util' has no attribute 'temperature'

Fatal error in logs

Version of the custom_component

1.3.9

Configuration

Any

Describe the bug

Fatal error in logs

Debug log


This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/optimal_humidity/sensor.py:597
Integration: optimal_humidity (documentation, issues)
First occurred: 4:40:59 PM (28 occurrences)
Last logged: 6:49:28 PM

Update for sensor.bathroom_optimal_humidity fails
Update for sensor.living_room_optimal_humidity fails
Update for sensor.kitchen_optimal_humidity fails
Update for sensor.basement_optimal_humidity fails
Update for sensor.master_bedroom_optimal_humidity fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 401, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 609, in async_device_update
    raise exc
  File "/config/custom_components/optimal_humidity/sensor.py", line 408, in async_update
    self._calc_optimal_humidex()
  File "/config/custom_components/optimal_humidity/sensor.py", line 597, in _calc_optimal_humidex
    optimal_humidex = self._humidex(self._indoor_temp, self._optimal_humidity / 100)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'


attributes are not available on home assistant startup

Logger: homeassistant.helpers.script
Source: helpers/script.py:650
First occurred: 9:26:58 PM (4 occurrences)
Last logged: 9:26:59 PM

Error in 'choose[0]' evaluation: In 'state': In 'state' condition: attribute 'mold_warning' (of entity sensor.master_bathroom_optimal_humidity) does not exist
Error in 'choose[0]' evaluation: In 'state': In 'state' condition: attribute 'mold_warning' (of entity sensor.bathroom_optimal_humidity) does not exist

Set up list of sensors to find critical temp + humidity

With a list of sensors that groups themselves by room and by location in that room, ha-optimal-humidity could identify the critical temperature/humidity/pressure/mold risk automatically.

# Example configuration.yaml entry

sensor:
  - platform: optimal_humidity
    rooms:
      - test_optimal_humidity:
           name: "Optimal Humidity"
           type: optimal_humidity
           sensors:
              - corner:
                - sensor.indoor_temp
                - sensor.indoor_humidity
                - sensor.indoor_pressure
              - window: 
                - sensor.critical_temp

Sensor shows no data

Version of the custom_component

2.0.3

Configuration

sensor:
  - platform: optimal_humidity
    sensors:
      test_optimal_humidity:
        name: "Optimale Luftfeuchtigkeit"
        type: optimal_humidity
        indoor_temp_sensor: sensor.lumi_lumi_weather_4ee65b04_temperature
        indoor_humidity_sensor: sensor.lumi_lumi_weather_4ee65b04_humidity
        critical_temp_sensor: sensor.lumi_lumi_weather_4ee65b04_temperature
        indoor_pressure_sensor: sensor.lumi_lumi_weather_4ee65b04_pressure

Describe the bug

After placing the sensor into the configuration.yaml file and restarting, it still does not show any data.
The Temperature/humindity sensors have data.

Debug log

I did not get Logs to work :(

image

Tempsensor:
image
image
image

Depracted constants

HASS log:
TEMP_FAHRENHEIT was used from optimal_humidity, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.FAHRENHEIT instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.