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
10 stars 5 forks source link

Received an "Unknown error occured" message when adding the degree-days integration #24

Closed jBRNDnl closed 9 months ago

jBRNDnl commented 9 months ago

Trying to add the degree-days integration results in an "Unknown error occured"

afbeelding

The following error is represented in the logs.

Jan 03 00:03:21: 2024-01-03 00:03:21.279 ERROR (MainThread) [aiohttp.server] Error handling request Jan 03 00:03:21 ha homeassistant[1068]: Traceback (most recent call last): Jan 03 00:03:21: File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request Jan 03 00:03:21: resp = await request_handler(request) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 543, in _handle Jan 03 00:03:21: resp = await handler(request) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 114, in impl Jan 03 00:03:21: return await handler(request) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware Jan 03 00:03:21: return await handler(request) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware Jan 03 00:03:21: return await handler(request) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware Jan 03 00:03:21: return await handler(request) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware Jan 03 00:03:21: return await handler(request) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 233, in auth_middleware Jan 03 00:03:21: return await handler(request) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware Jan 03 00:03:21: response = await handler(request) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle Jan 03 00:03:21: result = await handler(request, **request.match_info) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 63, in with_admin Jan 03 00:03:21: return await func(self, request, *args, **kwargs) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post Jan 03 00:03:21: return await super().post(request, flow_id) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper Jan 03 00:03:21: result = await method(view, request, data, *args, **kwargs) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post Jan 03 00:03:21: result = await self._flow_mgr.async_configure(flow_id, data) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 293, in async_configure Jan 03 00:03:21: result = await self._async_handle_step( Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 389, in _async_handle_step Jan 03 00:03:21: result: FlowResult = await getattr(flow, method)(user_input) Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/config/custom_components/degree_days/config_flow.py", line 59, in async_step_user Jan 03 00:03:21: invalid_station = await self._weather_station_in_configuration_exists( Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/config/custom_components/degree_days/config_flow.py", line 133, in _weather_station_in_configuration_exists Jan 03 00:03:21: if weather_station_entry in degree_days_entries(hass): Jan 03 00:03:21: ^^^^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: File "/config/custom_components/degree_days/config_flow.py", line 37, in degree_days_entries Jan 03 00:03:21: return { Jan 03 00:03:21: ^ Jan 03 00:03:21: File "/config/custom_components/degree_days/config_flow.py", line 38, in <setcomp> Jan 03 00:03:21: entry.data[CONF_WEATHER_STATION] for entry in hass.config_entries.async_entries(DOMAIN) Jan 03 00:03:21: ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ Jan 03 00:03:21: KeyError: 'weather station'

Ernst79 commented 9 months ago

I tried to install install the integration after deleting the integration first and a HA restart. I’m not facing the issue you have, even when using the same settings. Can you try to refresh your browser a couple of times and try it again. Or try a different weather station.

jBRNDnl commented 9 months ago

Ahh. Found out I had it already installed. Removed it and re-adding is working.

I have a question. The gas sensor does it need to be reset every year?

Ernst79 commented 9 months ago

ah, yes, only one instance is allowed.

Yes, the sensor needs to be reset every year. You can use a "utility meter" available in the "helpers" menu in HA for that. Add a utility meter, and make sure the meter reset cyclus is "yearly". You can use the offset function if you want a different date that 1st of January. Make sure the startdate and month in the degree days integration is the same.

https://www.home-assistant.io/integrations/utility_meter/