TheRealWaldo / ha-optimal-humidity

Home Assistant Utility Sensor to assist with maintaining the optimal humidity in your home!
MIT License
22 stars 1 forks source link

Update import of hass temperature utilities #215

Closed mpkogli closed 10 months ago

mpkogli commented 11 months ago

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'
TheRealWaldo commented 11 months ago

Thanks for the contribution @mpkogli ! Running it through now.

TheRealWaldo commented 11 months ago

@mpkogli I'll need to rebase/reword the comment to fit the PR title I just posted. I use Conventional Commits to automate version bumps, releases, and release notes.

mpkogli commented 11 months ago

I'll look into that convention, thank you.

Hoping I can keep our whole home humidifier from causing condensation. Great project!

TheRealWaldo commented 11 months ago

@mpkogli It has been pretty good in my home thus far; wild swings are hard to keep on top of, but a combination of dehumidification and ventilation does keep it to a minimum!