Ernst79 / degree-days

Integration that determines (weighted) degree days, gas consumption per degree day and a gas prognose for the current year based on weather info from the KNMI and your gas consumption.
MIT License
7 stars 3 forks source link

Error setting up Degree Days #29

Closed JRouwhorst closed 4 months ago

JRouwhorst commented 5 months ago

After configuring the integration no entities are made, and an error comes up saying the configuration failed. The log file says the following:

2024-01-27 19:53:07.421 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Degree Days for degree_days
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/degree_days/__init__.py", line 28, in async_setup_entry
    coordinator = DegreeDaysData(hass, entry)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/degree_days/__init__.py", line 84, in __init__
    CONF_DHW_CONSUMPTION: data.pop(CONF_DHW_CONSUMPTION, DEFAULT_CONSUMPTION_USE_OTHER),
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'DEFAULT_CONSUMPTION_USE_OTHER' is not defined

I fixed this by adding the DEFAULT_CONSUMPTION_USE_OTHER constant to const.py:

DEFAULT_HEATPUMP = False
**DEFAULT_CONSUMPTION_USE_OTHER = 0**

And added the import in init.py:

CONF_STARTMONTH, CONF_WEATHER_STATION,
DEFAULT_CONSUMPTION_SENSOR, DEFAULT_DHW_CONSUMPTION, **DEFAULT_CONSUMPTION_USE_OTHER,**
DEFAULT_HEATING_LIMIT, DEFAULT_HEATPUMP,
Ernst79 commented 5 months ago

Thanks, I think we should change DEFAULT_CONSUMPTION_USE_OTHER to DEFAULT_DHW_CONSUMPTION in the init.py file

Ernst79 commented 4 months ago

Fixed in 1.2.0