Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working entities get status not available #122

Open
JohanKrab opened this issue Mar 17, 2024 · 4 comments
Open

Not working entities get status not available #122

JohanKrab opened this issue Mar 17, 2024 · 4 comments

Comments

@JohanKrab
Copy link

Log:

Logger: homeassistant.helpers.event
Source: helpers/event.py:296
First occurred: 13:57:03 (665 occurrences)
Last logged: 15:51:54

Error while dispatching event for sensor.dsmr_reading_electricity_currently_returned to <Job track state_changed event ['sensor.dsmr_reading_electricity_currently_returned'] HassJobType.Callback <bound method SimulatedBatteryHandle.async_reading_handler of <custom_components.battery_sim.SimulatedBatteryHandle object at 0x7fcace901610>>>
Error while dispatching event for sensor.dsmr_reading_electricity_currently_delivered to <Job track state_changed event ['sensor.dsmr_reading_electricity_currently_delivered'] HassJobType.Callback <bound method SimulatedBatteryHandle.async_reading_handler of <custom_components.battery_sim.SimulatedBatteryHandle object at 0x7fcace901610>>>

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

@brugk000
Copy link

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

@masminl
Copy link

masminl commented Oct 22, 2024

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

I have the same issue. How did you merge the consumption and production sensor data?

@brugk000
Copy link

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

I have the same issue. How did you merge the consumption and production sensor data?

You can add the json in DSMR MQTT topics:

image

@masminl
Copy link

masminl commented Oct 22, 2024

Thanks for sharing. I don't use the DSM Reader, so I don't have the MQTT data.
But the problem seems to be solved now.
I used the UI to add the battery and could add Tarif_1 and Tarif_2 sensors for consumption and production which are in kWh.
Let's wait for the sun to shine so I can test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants