bzzoiro / repsolluzygas

Sensor for Home Assistant - Retrieve costs from Repsol Luz y Gas
MIT License
14 stars 8 forks source link

No funciona en HA 2024 #20

Open alexbartGTI opened 10 months ago

alexbartGTI commented 10 months ago

Alguien le está funcionando? he probado con el repsol_api modificado que encontrado en otra entrada pero tampoco funciona.

2024-01-22 18:10:32.727 ERROR (MainThread) [homeassistant.components.sensor] repsolluzygas: Error on device update! Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 573, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1218, in async_device_update await hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/repsolluzygas/sensor.py", line 73, in update self.client.update() File "/config/custom_components/repsolluzygas/repsol_api.py", line 186, in update data['last_invoice_amount'] = invoices[0]['amount']


IndexError: list index out of range
2024-01-22 18:10:33.100 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform repsolluzygas
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1003, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/repsolluzygas/sensor.py", line 61, in state
    data = self.client.data.get(self.variable, 0)
           ^^^^^^^^^^^^^^^^
AttributeError: 'RepsolLuzYGasSensor' object has no attribute 'data'
2024-01-22 18:10:33.108 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up repsolluzygas platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 368, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1282, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 945, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1066, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1003, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 951, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/repsolluzygas/sensor.py", line 61, in state
    data = self.client.data.get(self.variable, 0)
           ^^^^^^^^^^^^^^^^
**### AttributeError: 'RepsolLuzYGasSensor' object has no attribute 'data'**
Pacococo commented 10 months ago

No, no me funciona desde la actualización de diciembre de 2023

jesusperiago commented 8 months ago

Acabo de crear un PR para que actualice la rama principal. Si queréis podéis probar la nueva versión, https://github.com/jesusperiago/repsolluzygas.git

alexbartGTI commented 8 months ago

Acabo de crear un PR para que actualice la rama principal. Si queréis podéis probar la nueva versión, https://github.com/jesusperiago/repsolluzygas.git

Buenas Jesús, instalado y comprobado!! Funciona, mil gracias de verdad!!!

javmorarr commented 7 months ago

Esoty probande desde hace varios dias y no se que hago mal, no logro que funcione

jesusperiago commented 7 months ago

Esoty probande desde hace varios dias y no se que hago mal, no logro que funcione

Ok, estos dias lo reviso

EDIT: Lo acabo de revisar con la ultima version, y funciona correctamente. Añade esto a tu configuration.yaml `sensor:

javmorarr commented 7 months ago

Muchas gracias.Un saludo.Enviado desde mi iPhoneEl 17 abr 2024, a las 21:51, jesusperiago @.***> escribió:

Esoty probande desde hace varios dias y no se que hago mal, no logro que funcione

Ok, estos dias lo reviso

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>