martinarva / dynamic_energy_cost

35 stars 9 forks source link

Error adding entity #20

Closed jluyten closed 1 month ago

jluyten commented 1 month ago

Getting this error

2024-05-15 13:10:46.110 ERROR (MainThread) [homeassistant.components.sensor] Error adding entity sensor.boiler_daily_energy_cost for domain sensor with platform dynamic_energy_cost Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 892, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1358, in add_to_platform_finish await self.async_added_to_hass() File "/config/custom_components/dynamic_energy_cost/energy_based_sensors.py", line 114, in async_added_to_hass self._last_energy_reading = float(last_state.attributes.get('last_energy')) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Device is a shelly plug S socket.

JannikL87 commented 1 month ago

Fixed in

https://github.com/martinarva/dynamic_energy_cost/pull/27/commits/7ec7c11aa6846d669bfaba3d9cf60735b74111ec

martinarva commented 1 month ago

Also in fix is now in newesr 0.4.2 version