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

"Update for sensor.meter00_power fails" si la météo est non-accessible #513

Closed
sm-Fifteen opened this issue Dec 19, 2024 · 3 comments
Closed

Comments

@sm-Fifteen
Copy link

Version of the custom_component

Dernière version sur HACS, v2024.10.2.

Describe the bug

Je viens d'installer Hilo aujourd'hui, donc il est possible que certaines fonctionnalités prennent un certain temps avant de s'activer, mais on dirait qu'un problème de capteur météo empèche meter00 de s'initialiser au complet (il n'y a que sensor.meter00_power dans les capteurs associés au compteur).

Debug log

Update for sensor.meter00_power fails

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 960, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1318, in async_device_update
    await self.async_update()
  File "/config/custom_components/hilo/__init__.py", line 858, in async_update
    await self.coordinator.async_request_refresh()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 274, in async_request_refresh
    await self._debounced_refresh.async_call()
  File "/usr/src/homeassistant/homeassistant/helpers/debounce.py", line 114, in async_call
    await task
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 355, in async_refresh
    await self._async_refresh(log_failures=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 478, in _async_refresh
    self.async_update_listeners()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 177, in async_update_listeners
    update_callback()
    ~~~~~~~~~~~~~~~^^
  File "/config/custom_components/hilo/__init__.py", line 822, in _handle_coordinator_update
    self.async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in async_write_ha_state
    self._async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1148, in _async_write_ha_state
    self.__async_calculate_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1085, in __async_calculate_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1029, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/hilo/sensor.py", line 924, in state
    return int(self._state)
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

C'est une propriété de HiloOutdoorTempSensor, une valeur qui est loin de m'être essentielle comparée à la consommation d'énergie cumulée. Il manquerait probablement un except TypeError ou un if _state is None.

@property
def state(self):
try:
return int(self._state)
except ValueError:
return STATE_UNKNOWN

@sm-Fifteen sm-Fifteen changed the title "Update for sensor.meter00_power fails" si la météo est non-initialisée "Update for sensor.meter00_power fails" si la météo est non-accessible Dec 19, 2024
@ic-dev21
Copy link
Collaborator

Je t'invite à faire une PR si tu as trouvé un fix, je ne suis pas en mesure de tester de mon bord car la météo marche sur mon installation.

@sm-Fifteen
Copy link
Author

Bon, ça a fini par rentrer avant que j'aie le temps de tester. De toute façon, ça semble pas avoir affecté le comportement de l'intégration, ça paraît juste dans les logs. Je pensais que le compteur de consommation totale était pas là à cause de ça, mais j'avais pas remarqué qu'il fallait l'activer dans la config.

Je vais juste fermer le billet.

@sm-Fifteen sm-Fifteen closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2024
@ic-dev21
Copy link
Collaborator

@sm-Fifteen merci pour l’update, dommage ça aurait ben faite!

Si t’es pas pire en python j’ai besoin d’aide au niveau de #486, ça avance mais j’pas programmeur pour deux cennes donc c’est pas tant facile pour moi de fixer.

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