bzzoiro / repsolluzygas

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

error despues de instalar 2021.12.1 #7

Closed divemasterjm closed 2 years ago

divemasterjm commented 2 years ago

No funciona despues de instalar 2021.12.1, desde entonces me da el siguiente error

Logger: homeassistant.components.sensor Source: custom_components/repsolluzygas/sensor.py:61 Integration: Sensor (documentation, issues) First occurred: 8:37:07 AM (2 occurrences) Last logged: 8:37:07 AM

Error adding entities for domain sensor with platform repsolluzygas Error while setting up repsolluzygas platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 613, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _async_write_ha_state state = self._stringify_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 511, 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'

ad-ha commented 2 years ago

Buenas,

A mi me pasa lo mismo. Yo tengo estos errores en el Log:

Logger: homeassistant.components.sensor
Source: custom_components/repsolluzygas/repsol_api.py:96
Integration: Sensor (documentation, issues)

repsolluzygas: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 684, in async_device_update
    await task
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, 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 96, in get_contracts
    info['product_name'] = contract['commercialName']
KeyError: 'commercialName'

Y luego este otro:

Logger: homeassistant.components.sensor
Source: custom_components/repsolluzygas/sensor.py:61
Integration: Sensor (documentation, issues)

Error adding entities for domain sensor with platform repsolluzygas
Error while setting up repsolluzygas platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 613, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _async_write_ha_state
    state = self._stringify_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 511, 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'
bzzoiro commented 2 years ago

Thanks for the feedback. Now that I'm on Holidays I will double check it and bring it on.

bzzoiro commented 2 years ago

This issue was fixed with release 1.1.1

ad-ha commented 2 years ago

This issue was fixed with release 1.1.1

Buenas. Ya funciona correctamente. Gracias por la rápida corrección.