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

issues with energy dashboard (calculating costs) #76

Open
Edwintenhaaf opened this issue Nov 17, 2023 · 5 comments
Open

issues with energy dashboard (calculating costs) #76

Edwintenhaaf opened this issue Nov 17, 2023 · 5 comments

Comments

@Edwintenhaaf
Copy link

Edwintenhaaf commented Nov 17, 2023

I'm having some issues with calculating the energy costs.
Also did a post on the HA community forum about this.
https://community.home-assistant.io/t/energy-costs-not-calculated/632253

Don't know if it's related to this Custom Component or HA itself
Using the zonneplan addon for the energy/gas prices

The eror in the log is:

`Logger: homeassistant.helpers.event
Source: helpers/event.py:293
First occurred: 3:31:03 AM (1644 occurrences)
Last logged: 8:16:46 AM

Error while dispatching event for sensor.toon_gas_used_cnt to <Job track state_changed event ['sensor.toon_gas_used_cnt'] HassJobType.Callback <function EnergyCostSensor.async_added_to_hass..async_state_changed_listener at 0x7fb827a420c0>>
Error while dispatching event for sensor.toon_p1_power_prod_cnt_low to <Job track state_changed event ['sensor.toon_p1_power_prod_cnt_low'] HassJobType.Callback <function EnergyCostSensor.async_added_to_hass..async_state_changed_listener at 0x7fb827a41f80>>
Error while dispatching event for sensor.toon_p1_power_prod_cnt_high to <Job track state_changed event ['sensor.toon_p1_power_prod_cnt_high'] HassJobType.Callback <function EnergyCostSensor.async_added_to_hass..async_state_changed_listener at 0x7fb827a41e40>>
Error while dispatching event for sensor.toon_p1_power_use_cnt_low to <Job track state_changed event ['sensor.toon_p1_power_use_cnt_low'] HassJobType.Callback <function EnergyCostSensor.async_added_to_hass..async_state_changed_listener at 0x7fb827a41d00>>
Error while dispatching event for sensor.toon_p1_power_use_cnt_high to <Job track state_changed event ['sensor.toon_p1_power_use_cnt_high'] HassJobType.Callback <function EnergyCostSensor.async_added_to_hass..async_state_changed_listener at 0x7fb827a418a0>>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 293, in _async_dispatch_entity_id_event
hass.async_run_hass_job(job, event)
File "/usr/src/homeassistant/homeassistant/core.py", line 659, in async_run_hass_job
hassjob.target(*args)
File "/usr/src/homeassistant/homeassistant/components/energy/sensor.py", line 421, in async_state_changed_listener
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 743, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in _async_write_ha_state
state, attr = self._async_generate_attributes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in _async_generate_attributes
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 749, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 634, in state
raise ValueError(
ValueError: Sensor sensor.toon_gas_used_cnt_cost has device class 'monetary', state class 'total' unit 'EUR' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-finite value: 'nan'`

@cyberjunky
Copy link
Owner

Does this still happen? The _cost sensors are generated by home assistant when a device has a certain type.

@Edwintenhaaf
Copy link
Author

Yes it does
data from today.
image

@cyberjunky
Copy link
Owner

I think I have to close it, since it's not related to this integration..

@Edwintenhaaf
Copy link
Author

Edwintenhaaf commented Dec 23, 2023 via email

@cyberjunky
Copy link
Owner

@Edwintenhaaf looking at it again (since another user posted a similar issue) I think it has to do with an invalid NaN value from my integration, and then the added cost sensor cannot calculate and throws an error. Have to see how other integration handle this.

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

2 participants