carohauta / oma-helen-ha-integration

Home Assistant integration for Oma Helen data
MIT License
37 stars 7 forks source link

helen_energy: Error on device update! #11

Closed ylihemmo closed 1 year ago

ylihemmo commented 1 year ago

Not sure if this might be because I'm new customer to Helen and old data not found.

Running: Home Assistant 2023.8.4 Supervisor 2023.08.3 Frontend 20230802.1 - latest

`Logger: homeassistant.components.sensor Source: custom_components/helen_energy/sensor.py:153 Integration: Sensor (documentation, issues) First occurred: 17:13:30 (2 occurrences) Last logged: 17:13:36

helen_energy: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 576, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 940, in async_device_update await hass.async_add_executor_job(self.update) 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/helen_energy/sensor.py", line 512, in update _get_total_consumption_for_last_month(self._api_client) File "/config/custom_components/helen_energy/sensor.py", line 172, in _get_total_consumption_for_last_month return _get_total_consumption_between_dates(helen_api_client, start_date, end_date) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/helen_energy/sensor.py", line 153, in _get_total_consumption_between_dates helen_api_client.get_daily_measurements_between_dates(start_date, end_date) File "/usr/local/lib/python3.11/site-packages/cachetools/init.py", line 641, in wrapper v = func(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/helenservice/api_client.py", line 151, in get_daily_measurements_between_dates daily_measurement: MeasurementResponse = MeasurementResponse( ^^^^^^^^^^^^^^^^^^^^ TypeError: MeasurementResponse.init() got an unexpected keyword argument 'detail'`

2023-09-06 16:51:45.485 ERROR (MainThread) [homeassistant.components.sensor] helen_energy: Error on device update! File "/config/custom_components/helen_energy/sensor.py", line 750, in update File "/config/custom_components/helen_energy/sensor.py", line 178, in _get_total_consumption_for_current_month File "/config/custom_components/helen_energy/sensor.py", line 153, in _get_total_consumption_between_dates

carohauta commented 1 year ago

The JSON response from the Helen API seems to have some unexpected properties that the HA integration cannot handle. The response probably also does not have any measurement data as you said but perhaps an error is not the way to go here. Will implement a fix for the next release.

A new release should be coming in the very near future when I get around it!

ylihemmo commented 1 year ago

This seems to be fixed now.

carohauta commented 1 year ago

Yes, a fix has been pushed to the main branch.