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

Error adding entities for domain sensor with platform repsolluzygas #16

Open
silversegarra opened this issue Feb 15, 2022 · 21 comments
Open

Comments

@silversegarra
Copy link

silversegarra commented Feb 15, 2022

Hello to everyone, the integration is not working and entities are not present
Installed manually and trought HACS
Username and Password are correct
Home Assistant 2022.2.6
I dont have any invoice... maybe is that?
Any idea?

Thanks

**_Logger: homeassistant.components.sensor
Source: custom_components/repsolluzygas/sensor.py:61
Integration: Sensor (documentation, issues)
First occurred: 14:44:44 (2 occurrences)
Last logged: 14:44:44

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 614, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 782, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, 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'
*

@LeidenSpain
Copy link

Hi, same problem

@silversegarra
Copy link
Author

In my case, if the error is the bill, in a few days will be solved :)

@follares
Copy link

Mismo error por aquí.
Tampoco tengo la factura

@robertoclg
Copy link

Si el problema es que no existen facturas se puede solucionar editando el fichero repsol_api.py en la línea 183:
if len(invoices) > 0: #añadir esta línea
data['last_invoice_amount'] = invoices[0]['amount']
data['last_invoice_paid'] = invoices[0]['status'] == 'PAID'

@LeidenSpain
Copy link

LeidenSpain commented Mar 4, 2022

Hi,

I have this lines on my version:

        if len(contracts) > 0:
            invoices = self.get_invoices(uid, signature, tstamp, contracts['house_id'], contract['contract_id'])
            data['last_invoice_amount'] = invoices[0]['amount']
            data['last_invoice_paid'] = invoices[0]['status'] == 'PAID'

Ah, change contracts for invoices

@LeidenSpain
Copy link

LeidenSpain commented Mar 4, 2022

FUNCIONA
WORKS

Ups. it turns out that I already have an invoice, so my test is worthless

@sagatxxx
Copy link

sagatxxx commented Mar 5, 2022

sigue sin funcionar aun cambiando lo que dice @robertoclg
yo tampoco tengo la factura

me salen estos errores:

Logger: homeassistant.components.sensor
Source: custom_components/repsolluzygas/sensor.py:61
Integration: Sensor (documentation, issues)
First occurred: 11:19:27 (2 occurrences)
Last logged: 11:19:27

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 614, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 782, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 539, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 572, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, 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'


Logger: homeassistant.components.sensor
Source: custom_components/repsolluzygas/repsol_api.py:181
Integration: Sensor (documentation, issues)
First occurred: 11:19:25 (1 occurrences)
Last logged: 11:19:25

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 718, 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 181, in update
if len(invoices) > 0:
UnboundLocalError: local variable 'invoices' referenced before assignment

@sagatxxx
Copy link

sagatxxx commented Mar 5, 2022

ok funciona con el fork de @mmasipgu

@LeidenSpain
Copy link

ok funciona con el fork de @mmasipgu

Ok, verifica no vaya a ser que ya tengas una factura, como me ha pasado a mi

@sagatxxx
Copy link

sagatxxx commented Mar 5, 2022

Ok, verifica no vaya a ser que ya tengas una factura, como me ha pasado a mi

nop, no tengo todavía!
entré el último día :D

@mmasipgu
Copy link
Collaborator

mmasipgu commented Mar 5, 2022

Buenos días , en mi fork he quitado el sensor de última factura, por lo que los que somos nuevos clientes y no tenemos ninguna funciona sin problema.

@bzzoiro
Copy link
Owner

bzzoiro commented Mar 5, 2022

Buenos dias @mmasipgu y todos.

Si quieres, te doy acceso ADMIN a este repo y te encargas de mantenerlo.
Yo no tengo mas Repsol asi que no puedo ayudarte

@mmasipgu
Copy link
Collaborator

mmasipgu commented Mar 5, 2022

Por mí no hay problema , todo lo que sea por colaborar ;)

@silversegarra
Copy link
Author

silversegarra commented Mar 15, 2022

Por mí no hay problema , todo lo que sea por colaborar ;)

Buenas, puede ser que el fork, no muestre el gasto medio diario, ni el Repsol Total Days, cuando en la web, si que salen

@mmasipgu
Copy link
Collaborator

Aquí todos los valores en mi integración a día de hoy IMG_20220315_225249.jpg

@silversegarra
Copy link
Author

Pero en tu caso ya tienes una factura?

@silversegarra
Copy link
Author

image

@mmasipgu
Copy link
Collaborator

No, aún no , eso en mi fork es indiferente.

@silversegarra
Copy link
Author

He puesto tu fork... voy a desinstalarlo y volverlo a poner, a ver si se me ha mezclado ;(

@silversegarra
Copy link
Author

silversegarra commented Mar 15, 2022

Bueno, algo pasa con mi cuenta, he probado la de mi madre y salen todos los datos... A ver si se soluciona ;(
Gracias por el curro

@pedropalamos
Copy link

Yo me estoy volviendo loco con la configuración, hace varias semanas me descargue la versión y la instalé manualmente en la carpeta <custom_components>, he añadido el texto de configuración dentro del Configuration.yaml con las contraseñas y usuario entre <>, pero no acabo de avanzar nada más, no hay nada dentro de la sección de componentes ni tampoco dentro de las integraciones. No se como continuar la configuración.
Alguna ayuda? Muchas gracias!

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

8 participants