martinarva / dynamic_energy_cost

62 stars 13 forks source link

Generate unique sensor IDs #24

Closed jluyten closed 4 months ago

jluyten commented 4 months ago

Right now I am not able to add a second sensor for another price (but same energy) component:

2024-05-25 11:36:01.400 ERROR (MainThread) [custom_components.dynamic_energy_cost.energy_based_sensors] Failed to update energy costs due to an error: No entity id specified for entity Car Kwh Meter Daily Energy Cost Traceback (most recent call last): File "/config/custom_components/dynamic_energy_cost/energy_based_sensors.py", line 192, in async_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in async_write_ha_state self._async_verify_state_writable() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 993, in _async_verify_state_writable raise NoEntitySpecifiedError( homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity Car Kwh Meter Daily Energy Cost 2024-05-25 11:36:01.401 ERROR (MainThread) [homeassistant.components.sensor] Platform dynamic_energy_cost does not generate unique IDs. ID sensor.car_kwh_meter_energy_daily_cost already exists - ignoring sensor.car_daily_profit 2024-05-25 11:36:01.401 ERROR (MainThread) [custom_components.dynamic_energy_cost.energy_based_sensors] Failed to update energy costs due to an error: No entity id specified for entity Car Kwh Meter Monthly Energy Cost Traceback (most recent call last): File "/config/custom_components/dynamic_energy_cost/energy_based_sensors.py", line 192, in async_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in async_write_ha_state self._async_verify_state_writable() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 993, in _async_verify_state_writable raise NoEntitySpecifiedError( homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity Car Kwh Meter Monthly Energy Cost 2024-05-25 11:36:01.402 ERROR (MainThread) [homeassistant.components.sensor] Platform dynamic_energy_cost does not generate unique IDs. ID sensor.car_kwh_meter_energy_monthly_cost already exists - ignoring sensor.car_monthly_profit 2024-05-25 11:36:01.402 ERROR (MainThread) [custom_components.dynamic_energy_cost.energy_based_sensors] Failed to update energy costs due to an error: No entity id specified for entity Car Kwh Meter Yearly Energy Cost Traceback (most recent call last): File "/config/custom_components/dynamic_energy_cost/energy_based_sensors.py", line 192, in async_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1006, in async_write_ha_state self._async_verify_state_writable() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 993, in _async_verify_state_writable raise NoEntitySpecifiedError( homeassistant.exceptions.NoEntitySpecifiedError: No entity id specified for entity Car Kwh Meter Yearly Energy Cost

JannikL87 commented 4 months ago

fixed in https://github.com/martinarva/dynamic_energy_cost/pull/25/files

martinarva commented 4 months ago

Thank you @JannikL87

martinarva commented 4 months ago

Fixed in v0.4.2