Open JohanKrab opened 3 months ago
I made the same mistake. You have to use sensors that represent kWh not kW. I used the merged daily in and out sensors from DSMR: sensor.dsmr_day_consumption_electricity_merged and sensor.dsmr_day_consumption_electricity_returned_merged
Log:
Logger: homeassistant.helpers.event Source: helpers/event.py:296 First occurred: 13:57:03 (665 occurrences) Last logged: 15:51:54
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 296, in _async_dispatch_entity_id_event hass.async_run_hass_job(job, event) File "/usr/src/homeassistant/homeassistant/core.py", line 691, in async_run_hass_job hassjob.target(args) File "/config/custom_components/battery_sim/init.py", line 337, in async_reading_handler new_state_value = float(new_state.state) conversion_factor ^^^^^^^^^^^^^^^^^ UnboundLocalError: cannot access local variable 'conversion_factor' where it is not associated with a value