MiguelAngelLV / balance_neto

Componente para Home Assistant que calcula el Balance Neto Horario para instalaciones fotovoltáicas.
34 stars 5 forks source link

BUG #19

Closed oomichalekoo closed 2 months ago

oomichalekoo commented 2 months ago

Rejestrator: homeassistant.helpers.frame Źródło: helpers/frame.py:190 Pierwsze zdarzenie: 14:00:30 (1 zdarzenia) Ostatnio zalogowany: 14:00:30

Detected that custom integration 'balance_neto' calls async_write_ha_state from a thread at custom_components/balance_neto/sensor.py, line 184: self.async_write_ha_state(), please report it to the author of the 'balance_neto' custom integration

suawekstw commented 2 months ago

Similar issue, but with more error messages at my side since HA 2024.5.0

Rejestrator: homeassistant Źródło: helpers/frame.py:203 Pierwsze zdarzenie: 20:29:25 (80 zdarzenia) Ostatnio zalogowany: 20:42:43

Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/balance_neto/sensor.py", line 67, in update_import grid_balance.update_import(new_state) File "/config/custom_components/balance_neto/sensor.py", line 190, in update_import self._update_value() File "/config/custom_components/balance_neto/sensor.py", line 173, in _update_value self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1008, in async_write_ha_state self.hass.verify_event_loop_thread("async_write_ha_state") File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread frame.report( File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report _report_integration(what, integration_frame, level, error_if_integration) File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration raise RuntimeError( RuntimeError: Detected that custom integration 'balance_neto' calls async_write_ha_state from a thread at custom_components/balance_neto/sensor.py, line 173: self.async_write_ha_state(). Please report it to the author of the 'balance_neto' custom integration.

mariuszxeno commented 2 months ago

Many more events ......

Rejestrator: homeassistant Źródło: helpers/frame.py:203 Pierwsze zdarzenie: 11 maja 2024 08:57:18 (10336 zdarzenia) Ostatnio zalogowany: 08:25:19

Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/balance_neto/sensor.py", line 76, in update_values grid_balance.update_values() File "/config/custom_components/balance_neto/sensor.py", line 216, in update_values self._update_value() File "/config/custom_components/balance_neto/sensor.py", line 184, in _update_value self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1008, in async_write_ha_state self.hass.verify_event_loop_thread("async_write_ha_state") File "/usr/src/homeassistant/homeassistant/core.py", line 440, in verify_event_loop_thread frame.report( File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 162, in report _report_integration(what, integration_frame, level, error_if_integration) File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 203, in _report_integration raise RuntimeError( RuntimeError: Detected that custom integration 'balance_neto' calls async_write_ha_state from a thread at custom_components/balance_neto/sensor.py, line 184: self.async_write_ha_state(). Please report it to the author of the 'balance_neto' custom integration.

and ....

Rejestrator: homeassistant.helpers.frame Źródło: helpers/frame.py:190 Pierwsze zdarzenie: 11 maja 2024 08:57:18 (10336 zdarzenia) Ostatnio zalogowany: 08:25:19

Detected that custom integration 'balance_neto' calls async_write_ha_state from a thread at custom_components/balance_neto/sensor.py, line 184: self.async_write_ha_state(), please report it to the author of the 'balance_neto' custom integration

suawekstw commented 2 months ago

Solution: In /config/custom_components/balance_neto/sensor.py replace async_write_ha_state() with schedule_update_ha_state()

mariuszxeno commented 2 months ago

@suawekstw Hi! Only in 184 line ?

oomichalekoo commented 2 months ago

new

Rejestrator: homeassistant.components.sensor Źródło: helpers/deprecation.py:206 integracja: Sensor (dokumentacja, Problemy) Pierwsze zdarzenie: 16:03:03 (4 zdarzenia) Ostatnio zalogowany: 16:03:03

STATE_CLASS_TOTAL_INCREASING was used from balance_neto, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorStateClass.TOTAL_INCREASING instead, please report it to the author of the 'balance_neto' custom integration DEVICE_CLASS_ENERGY was used from balance_neto, this is a deprecated constant which will be removed in HA Core 2025.1. Use SensorDeviceClass.ENERGY instead, please report it to the author of the 'balance_neto' custom integration

MiguelAngelLV commented 2 months ago

Solution: In /config/custom_components/balance_neto/sensor.py replace async_write_ha_state() with schedule_update_ha_state()

I will try update the next week the component. Thanks.

suawekstw commented 2 months ago

@suawekstw Hi! Only in 184 line ?

No, all of them

MiguelAngelLV commented 2 months ago

Update published :)

mariuszxeno commented 2 months ago

@MiguelAngelLV This is not update this is a disaster :-( balance

MiguelAngelLV commented 2 months ago

Fix published :disappointed:

mariuszxeno commented 2 months ago

Thank you very much, the fix solves the problem. Good job.

...but for a short time. Problem back.

net