bzzoiro / repsolluzygas

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

Error ¿changes in the api ? #19

Open cbolumar opened 1 year ago

cbolumar commented 1 year ago

In the last days i have errors and this integration is not working

2023-09-10 12:58:42.343 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 938, 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 166, in update contracts = self.get_contracts(uid, signature, tstamp) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/repsolluzygas/repsol_api.py", line 88, in get_contracts data = data[0]


**KeyError: 0**
2023-09-10 12:58:44.432 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 1002, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, 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'
2023-09-10 12:58:45.243 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 367, 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 1002, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, 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'
HassioAwi commented 1 year ago

Same problem.

cbolumar commented 1 year ago

Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip

victorcpascua commented 1 year ago

Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip

Porque no haces un PR o al menos un fork ya que parece que el usuario ya no esta manteniendo esto?

cbolumar commented 1 year ago

Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip

Porque no haces un PR o al menos un fork ya que parece que el usuario ya no esta manteniendo esto?

Estoy revisando el API para ver si es interesante publicar mas entidades y si cambio la integración para que pida los parametros de usuario y password por GUI y no tener que ponerlos en el yalm. Despues veré , como parece, el autor ya no mantiene la integración, si hago un fork .

simposiummm commented 1 year ago

Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip

Acabo de probarlo y funciona perfecto, muchas gracias por tu adaptacion :)

Pacococo commented 1 year ago

He cambiado mi archivo repsol_api, por el que has puesto y que me he descargado, y tachán. Funcionando!!! Muchas gracias y saludos.

alexbartGTI commented 10 months ago

Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip

Porque no haces un PR o al menos un fork ya que parece que el usuario ya no esta manteniendo esto?

Estoy revisando el API para ver si es interesante publicar mas entidades y si cambio la integración para que pida los parametros de usuario y password por GUI y no tener que ponerlos en el yalm. Despues veré , como parece, el autor ya no mantiene la integración, si hago un fork .

Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip

Esto funciona en 2024??? A mi no me funciona. Gracias.

cbolumar commented 10 months ago

A mi me funciona la versión que utilizo pero no sé si es la que os publiqué. Lo compruebo y os digo.

Enviado desde Yahoo Mail para iPhone

El miércoles, enero 24, 2024, 6:30 p. m., alexbartGTI @.***> escribió:

Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip

Porque no haces un PR o al menos un fork ya que parece que el usuario ya no esta manteniendo esto?

Estoy revisando el API para ver si es interesante publicar mas entidades y si cambio la integración para que pida los parametros de usuario y password por GUI y no tener que ponerlos en el yalm. Despues veré , como parece, el autor ya no mantiene la integración, si hago un fork .

Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip

Esto funciona en 2024??? A mi no me funciona. Gracias.

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

alexbartGTI commented 10 months ago

A mi me funciona la versión que utilizo pero no sé si es la que os publiqué. Lo compruebo y os digo. Enviado desde Yahoo Mail para iPhone El miércoles, enero 24, 2024, 6:30 p. m., alexbartGTI @.> escribió: Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip Porque no haces un PR o al menos un fork ya que parece que el usuario ya no esta manteniendo esto? Estoy revisando el API para ver si es interesante publicar mas entidades y si cambio la integración para que pida los parametros de usuario y password por GUI y no tener que ponerlos en el yalm. Despues veré , como parece, el autor ya no mantiene la integración, si hago un fork . Working with the Repsol api i had to add one new parameter in each call , maybe Repsol changed the api, after that all seen to be working . I attach the /config/custom_components/repsolluzygas/repsol_api.py with the changes i needed to fix the problem. repsol_api.zip Esto funciona en 2024??? A mi no me funciona. Gracias. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.>

@cbolumar Quedo a la espera ansioso a ver si me funciona con tu código!! Muchas gracias:)