Giter VIP home page Giter VIP logo

degree-days's People

Contributors

ernst79 avatar nelbs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

degree-days's Issues

Error setting up Degree Days

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,

For Newbies

Could you give us /me :-) examples to copy how this integration works? I installed it using HACS this worked, but no sensors where made? I know, I shouls probelbly know how to. but I did not chose a UI system for the fun off it. I like things going by itself? or other people making it easy for me ;-). I am not a coder.

Prognosed gas not corresponding to mindergas.nl

Copied from #17 by @bakboord4

Noticed that the prognosed gas consumption shows about 60% what the dutch mindergas.nl website is prognosing.
I have to find out how your integration is working.
It would be helpful to me what is meant with 'year'. May I suggest to make in the documentation and in the sensor names everywhere explicit: calendar year (starting 1 jan) or billing year (date of year-gas-consumption is measured).
Especialy for prognosed gas consumption. Is this for the whole billing year or to 'year to date' (today)?
Thanks in advance for your reaction.

failed to calculate float divide by zero

This is the exception from the Hassio Logs

`Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.degree_days
Source: helpers/update_coordinator.py:300
Integration: Degree-Days
First occurred: 23:52:12 (15 occurrences)
Last logged: 23:59:07

Unexpected error fetching Degree Days data: float division by zero
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/degree_days/init.py", line 117, in _async_update_data
data = await self.hass.async_add_executor_job(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/degree_days/knmi/init.py", line 19, in init
data = self.get_degree_days()
^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/degree_days/knmi/init.py", line 90, in get_degree_days
gas_consumption_total = self.gas_usage * number_of_days_knmi / number_of_days_gas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
ZeroDivisionError: float division by zero
`

Sensor for current year gas consumption

As you mention in the readme, a Gas sensor entity with the total consumption this year should be feeded to the integration.

Is this a sensor of the last 365 days? Or a sensor from the 1st of january? What is needed by the integration?

Add possibility to register in kWh

If I may make a suggestion for 'product improvement':

Create an option to use the results of a kWh meter instead of the gas meter for consumers of a heat pump.

icoon in HACS?

Hi Ernst, leuk idee dit, hoop dat je integratie blijft werken en super dat je hem al zo hebt opgezet dat hij al in HACS past! Volgende stap natuurlijk dat hij niet meer custom hoeft te worden toegevoegd, maar automatisch in HACS komt én dat je dan ook een icoontje toevoegt :) Zie dat je er nu nog geen een hebt, in de lijst van HACS komt er daarom alleen een "image not available" bij de verwijzing (https://brands.home-assistant.io/_/degree_days/dark_icon.png) en daardoor zie je in bijvoorbeeld het repairs scherm niet waar het over gaat:

image

Voor meer info over hoe je je eigen icoon toevoegt, zie https://github.com/home-assistant/brands/tree/master/custom_integrations/

Thx man, ik ga er binnenkort eens mee stoeien!

wrong gas consumption per degree day

how can I compensate for the initial gas meter reading on Jan 1st? I think it just uses the meter reading.
I do not have a sensor for consumption only a gas meter reading since installation of the gas meter.

ValueError: Sensor sensor.gas_consumption_per_weighted_degree_day has device class 'gas', ..., but 'unavailable'

Unable to use this integration.
Sensors: sensor.gas_consumption_per_weighted_degree_day and sensor.gas_prognose are not available due to errors.

error log.

Logger: homeassistant.components.sensor
Source: components/sensor/init.py:585
Integration: Sensor (documentation, issues)
First occurred: 18 juni 2023 om 17:20:11 (2 occurrences)
Last logged: 18 juni 2023 om 17:20:11

Error adding entities for domain sensor with platform degree_days
Error while setting up degree_days platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 583, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: 'Unavailable'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 471, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 749, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 850, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 590, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 654, in _async_write_ha_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 596, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 585, in state
raise ValueError(
ValueError: Sensor sensor.gas_consumption_per_weighted_degree_day has device class 'gas', state class 'total' unit 'm³' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'Unavailable' (<class 'str'>)

System.
Home Assistant 2023.6.2
Supervisor 2023.06.2
Operating System 10.2
Frontend-versie: 20230608.0 - latest

Add possibility for a second integration

Suggestion for product improvement:

Create an opportunity to deploy the integration more than once so that more than one device can be monitored. This can be several gas boilers, but also several heat pumps, each with different characteristics.

Retrying setup: No columns to parse from file

Since a day or two this integration stopped working for me. I can't relate it to an upgrade of the component or Home Assistant.

In the devices -> integrations screen, I'm faced with the message Retrying setup: No columns to parse from file. In the Home Assistant log files I've this message

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/degree_days/__init__.py", line 113, in _async_update_data
    data = await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/degree_days/knmi/__init__.py", line 18, in __init__
    data = self.get_degree_days()
  File "/config/custom_components/degree_days/knmi/__init__.py", line 37, in get_degree_days
    df = self.get_daily_data_df(self.startdate.replace(str(year), str(int(year) - 20), 1), enddate, [station_code],
  File "/config/custom_components/degree_days/knmi/__init__.py", line 126, in get_daily_data_df
    df = self.parse_result_to_df(r)
  File "/config/custom_components/degree_days/knmi/__init__.py", line 206, in parse_result_to_df
    df = pd.read_csv(StringIO(r))
  File "/usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py", line 311, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 680, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 575, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 934, in __init__
    self._engine = self._make_engine(f, self.engine)
  File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1236, in _make_engine
    return mapping[engine](f, **self.options)
  File "/usr/local/lib/python3.10/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 75, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas/_libs/parsers.pyx", line 551, in pandas._libs.parsers.TextReader.__cinit__
pandas.errors.EmptyDataError: No columns to parse from file```

**What I've tried already**
- Reloading the integration
- Setting a different weather station
- Deleting the integration and re-adding it
- Redownloading the integration through HACS and re-adding the integration in HA

**My assumption**
It looks like the integration fails to retrieve data from KNMI. Following the URL from the code to https://www.daggegevens.knmi.nl/klimatologie/daggegevens brings me to a `503 Service Temporarily Unavailable` page. The site seems to be down.

Can you confirm my assumption? And do you know if it's a temporary thing or that the KNMI has shut it down for good (in which case the code needs a refactoring to another KNMI API).

Degree days integration will failfrom 2023.3 on....

Hi Ernst, my HA gives me this wearning in the log. As a rabid user of the degree days integration, I would kindly ask you if you would be willing to look into this?
"Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for degree_days using this method at custom_components/degree_days/init.py, line 41: hass.config_entries.async_setup_platforms(entry, PLATFORMS)"

Integration uses a deprecated constant.

Log messages:

  • 2024-01-06 17:59:45.074 WARNING (MainThread) [homeassistant.components.sensor] STATE_CLASS_MEASUREMENT was used from average, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorStateClass.MEASUREMENT instead, please create a bug report at https://github.com/Limych/ha-average/issues
  • 2024-01-06 17:59:45.080 WARNING (MainThread) [homeassistant.components.sensor] STATE_CLASS_MEASUREMENT was used from average, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorStateClass.MEASUREMENT instead, please create a bug report at https://github.com/Limych/ha-average/issues
  • 2024-01-06 17:59:45.109 WARNING (MainThread) [homeassistant.const] DEVICE_CLASS_TEMPERATURE was used from average, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorDeviceClass.TEMPERATURE instead, please create a bug report at https://github.com/Limych/ha-average/issues

Version 1.01

HA version: 2024.1.2

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

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'

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.