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

Total Days and Last Invoice Amount Error + Gas Sensor Enquiry #9

Open
ad-ha opened this issue Dec 22, 2021 · 7 comments
Open

Total Days and Last Invoice Amount Error + Gas Sensor Enquiry #9

ad-ha opened this issue Dec 22, 2021 · 7 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@ad-ha
Copy link

ad-ha commented Dec 22, 2021

Hi,

My last invoice sensor is retrieving the Gas Invoice amount, not the last electricity bill.

image

image

The total days is reporting 0, though on the web it shows 22 days:

image

image

By the way, would it be possible to have a Gas sensor (including consumption and amount)? In my case, I have both consumptions under the same contract and everything comes together on the same page.

Thanks for the integration and your work on this.

@bzzoiro
Copy link
Owner

bzzoiro commented Dec 22, 2021

Thanks for the comments.

In my case, as I only have one contract (ELECTRICITY) I can't debug or test what is happenning.
I will try to make a workaround to get the proper amount / value.

@bzzoiro
Copy link
Owner

bzzoiro commented Dec 22, 2021

Creo que podemos cambiar de Ingles a Spanish :)

Acabo de hacer unos cambios en el código para recuperar apenas los contractos de Electricidad. Arreglaría tu problema.
Al mismo tiempo he aprovechado y he creado los Sensores de Electricidad / Monetarios para que Home Assistant pueda generar estadísticas con los "tipos" correctos.

Finalmente estoy haciendo pruebas para que el componente pueda funcionar con el nuevo modulo "ENERGY" de Home Assistant.

Ahora mismo lo he ejecutado en mi HA y si todo funciona correctamente, hare el release la próxima semana.

@bzzoiro bzzoiro self-assigned this Dec 22, 2021
@bzzoiro bzzoiro added bug Something isn't working enhancement New feature or request labels Dec 22, 2021
@ad-ha
Copy link
Author

ad-ha commented Dec 22, 2021

Sí, creo que podemos cambiar. Yo es por la costumbre.

Gracias por revisarlo y los cambios. En el panel de Energía estoy usando la integración que hice para sacar los datos del contador (Iberdrola Distribución).

Para el tema del gas, necesitarías algo de la fuente de la página para hacer el scrapping?

Un saludo

@bzzoiro
Copy link
Owner

bzzoiro commented Dec 22, 2021

Necesitaria que pararas tu HomeAssistant y añadas la siguiente entrada en configuration.yaml

logger:
default: debug

Luego puedes postear aquí el log de tu HomeAssistant (/config/logs).

Asi puedo ver como Repsol devuelve los contratos de Gas.

@ad-ha
Copy link
Author

ad-ha commented Dec 27, 2021

Buenas,

Te paso lo que me ha salido del log:

2021-12-27 14:54:29 DEBUG (SyncWorker_3) [custom_components.repsolluzygas.repsol_api] Login Data {'callId': '9486b4d579XXXXXXXXXX9e8857e95a', 'errorCode': 0, 'apiVersion': 2, 'statusCode': 200, 'statusReason': 'OK', 'time': '2021-12-27T13:54:29.025Z', 'registeredTimestamp': 1629379889, 'UID': '2bdc44b41ea74XXXX5ec2ca58ee1c', 'UIDSignature': 'UvI0Lk7XXXXXbR4Hlu3nVFdW1s=', 'signatureTimestamp': '1640XX3269', 'created': '2021-08-19T13:31:29.239Z', 'createdTimestamp': 162937XX889, 'isActive': True, 'isRegistered': True, 'isVerified': True, 'lastLogin': '2021-12-27T13:54:28.985Z', 'lastLoginTimestamp': 1640613268, 'lastUpdated': '2021-11-23T09:04:45.685Z', 'lastUpdatedTimestamp': 1637658285685, 'loginProvider': 'site', 'oldestDataUpdated': '2021-08-19T13:31:29.239Z', 'oldestDataUpdatedTimestamp': 1629379889239, 'profile': {'email': 'email@email.com'}, 'registered': '2021-08-19T13:31:29.456Z', 'socialProviders': 'site', 'verified': '2021-08-19T13:32:30.062Z', 'verifiedTimestamp': 16293XXX062, 'userInfo': {'UID': '2bdc44b4XXXXXXX5ec2ca58ee1c', 'UIDSig': 'R9f7mRDXXXXXXgUpZ1lHLKaY=', 'UIDSignature': 'UvI0Lk7mN2S73bXXXXXX3nVFdW1s=', 'signatureTimestamp': '1640613269', 'isSiteUser': True, 'isConnected': True, 'isTempUser': False, 'isLoggedIn': True, 'loginProvider': 'site', 'loginProviderUID': '2bdc44b41eXXXXXXXaa0e35ec2ca58ee1c', 'isSiteUID': True, 'identities': [{'provider': 'site', 'providerUID': '2bdc44b41ea74XXXXXXe35ec2ca58ee1c', 'allowsLogin': True, 'isLoginIdentity': True, 'isExpiredSession': False, 'lastUpdated': '2021-12-27T13:54:28.9859475Z', 'lastUpdatedTimestamp': 1640613268985, 'oldestDataUpdated': '2021-08-19T13:31:29.239Z', 'oldestDataUpdatedTimestamp': 1629379889239, 'email': 'email@email.com'}], 'email': 'email@email.com', 'capabilities': 'None', 'providers': 'site', 'oldestDataUpdatedTimestamp': 1629379889, 'oldestDataAge': 11233380, 'statusReason': 'OK', 'statusCode': 200, 'timestamp': '2021-12-27 13:54:29', 'time': '2021-12-27T13:54:29.018Z', 'errorCode': 0}, 'newUser': False, 'sessionInfo': {'login_token': 'XXXXXXXXXXXXXXX', 'expires_in': '0'}}
2021-12-27 14:54:29 DEBUG (SyncWorker_3) [custom_components.repsolluzygas.repsol_api] Contracts Data [{'code': 'a4j4I000002ZZZZZZZ', 'name': 'XXXX', 'ownerName': 'AXXXXX', 'ownerExtraConditionVersion': 1, 'contracts': [{'id': 'a2F4I000003ZZZZZZ', 'code': '43XXXXX', 'contractType': 'ELECTRICITY', 'cups': 'ES0021000010XXXXXXXXXX', 'address': 'Cl ZZZZZZZZ', 'status': 'ACTIVE', 'role': {'name': 'OWNER', 'commercialName': 'Titular'}, 'permissions': []}, {'id': 'a2F4I00000ZZZZZZZ', 'code': '43XXXXXXX', 'contractType': 'GAS', 'cups': 'ES02341500XXXXXXXXXX', 'address': 'Cl XXXXX', 'status': 'ACTIVE', 'role': {'name': 'OWNER', 'commercialName': 'Titular'}, 'permissions': []}], 'inhabitants': '4', 'houseType': '0', 'residenceType': '0', 'squareMeters': '3', 'constructionYear': '2', 'completedPercentage': '100', 'confirmConstructionYear': False, 'isDefault': True}]
2021-12-27 14:54:29 DEBUG (SyncWorker_3) [custom_components.repsolluzygas.repsol_api] Contracts Parsed {'house_id': 'a4j4I000002ZZZZZZZ', 'number_of_contracts': 2, 'information': [{'contract_id': '43ZZZZZZ', 'type': 'ELECTRICITY', 'active': True}, {'contract_id': '43ZZZZZZ', 'type': 'GAS', 'active': True}]}
2021-12-27 14:54:30 DEBUG (SyncWorker_3) [custom_components.repsolluzygas.repsol_api] Costs Data {'totalDays': 27, 'consumption': 346.36, 'amount': 56.77, 'amountVariable': 36.01, 'amountFixed': 20.76}
2021-12-27 14:54:32 DEBUG (SyncWorker_3) [custom_components.repsolluzygas.repsol_api] Invoices Data [{'idContract': 'a2F4I000003ZZZZZZZ', 'startDate': '20211007', 'endDate': '20211119', 'amount': 121.83, 'debt': 0, 'status': 'PAID', 'invoiceCode': '10GLS0300ZZZZZZ', 'invoiceNumber': '2160035XXXXX', 'subsizedConsumptionAmount': 0, 'subsizedConsumptionPercentage': 0, 'compensationStatus': 'NOT_COMPENSATED'}]
2021-12-27 14:54:32 DEBUG (SyncWorker_3) [custom_components.repsolluzygas.repsol_api] Sensor Data {'consumption': 346.36, 'amount': 56.77, 'amountVariable': 36.01, 'amountFixed': 20.76, 'last_invoice_amount': 121.83, 'last_invoice_paid': True}
2021-12-27 14:54:32 DEBUG (MainThread) [custom_components.repsolluzygas.sensor] Amount has value: 56.77
2021-12-27 14:54:32 DEBUG (MainThread) [custom_components.repsolluzygas.sensor] Last invoice was paid has value: True

Creo que con esto es lo que necesitas.

Un saludo

@bzzoiro
Copy link
Owner

bzzoiro commented Dec 28, 2021

Gracias @ad-ha.

Asi que tenga un hueco lo mirare, y intentare crear los sensores de gas.

@ad-ha
Copy link
Author

ad-ha commented Nov 12, 2022

Hola, @bzzoiro

Sigues haciendo algo de la integración?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants