dreautall / ha-stromnetzgraz

Home Assistant Custom Component for Stromnetz Graz
MIT License
15 stars 1 forks source link

'stromnetzgraz:energy_consumption:...' not present for second meter #15

Closed danilichti closed 4 months ago

danilichti commented 4 months ago

After installing and configuring the Stromnetz device, I only see one 'stromnetzgraz:energy_consumption:..' sensor/entity and am unable to add the second meter to the energy dashboard.

CleanShot 2024-03-02 at 08 10 03

CleanShot 2024-03-02 at 08 10 39

dreautall commented 4 months ago

Hi, do both meters have actual consumption values in the official web portal? "Empty" entities will not be added.

danilichti commented 4 months ago

Hi, yes both methers have actual values and IME enabled.

Here is the web portal data for the meter that can be added:

CleanShot 2024-03-02 at 08 27 39

Here the data for the meter that CAN'T be added:

CleanShot 2024-03-02 at 08 27 47

dreautall commented 4 months ago

Okay.. stuff like this is notoriously hard to debug :(

In the Integrations tab, click on Stromnetz Graz - can you please enable debug logging for the integration (lowest button on the left), reload the integration (behind the dot menu on the right next to the Stromnetz Mail Address), wait a bit, then disable logging again - it will automatically download a log file. Could you please provide that? It is a clear text file, so check through it and delete any sensitive stuff please.

Alternatively, if you know a bit of Python, you could check if the stromnetzgraz script properly returns data for both meters, a short snippet is available in the README: https://github.com/dreautall/stromnetzgraz

danilichti commented 4 months ago

home-assistant_stromnetzgraz_2024-03-02T07-42-18.512Z.log

danilichti commented 4 months ago

Sorry, no Python knowledge here. It seems, when starting up, the XXXX60 meter doesn't show any information. After the second fetch (6h), it shows data.

CleanShot 2024-03-02 at 08 52 04

danilichti commented 4 months ago

Just installed the 0.13 update and re-added the integration. This log file might be more relevant.

dreautall commented 4 months ago

Hi, you uploaded the same log two times, seems to be the old version (not that the version changed anything despite fixing the deprecated warning).

Could you maybe let the debug log run until the second fetch (~6 hours) occurs and both sensors at least show up in HA?

Thank you!

danilichti commented 4 months ago

home-assistant_stromnetzgraz_2024-03-02T15-53-40.864Z.log

Sorry, here is the log file I intended to upload. I'll have the debug log run until tomorrow.

dreautall commented 4 months ago

That log is strange, it only shows errors for the integration, not even one sensor was set up successfuly. looks like wrong login credentials. Was this from a successful attempt to add the integration?

danilichti commented 4 months ago

That might have been the case. I thought that it could help as well. Here is the log file which ran since yesterday:

home-assistant_stromnetzgraz_2024-03-03T08-47-11.232Z.log

No entries for the other meter at all.

danilichti commented 4 months ago

Hi @dreautall,

would there be anything to do from my side to make this work? Perhaps contacting Stromnetz Graz about the issues?

dreautall commented 4 months ago

Sorry for my absence - I was unavailable the last two weeks.

It is really hard to debug something like this, and there seems to be no one else with the issue :( It looks like for some reason the second meter is not fetched properly via the underlying stromnetzgraz python component. As the website shows the second meter and also only uses the API I guess it's a "me issue", not from Stromnetz Graz. It could be something very simple after all, but as there is no official API documentation I can't fix the issue without being able to reproduce it in my own account... which I can't.

The only thing that I can offer is that you send me the traffic log of the official website, so that I can check the responses. Login to the website, open the dev console (chrome: ctrl+shift+i), go to the network tab of the console, make sure "preserve log" is enabled, then get the 15min interval data for one meter for the last 7 days, switch meter, do the same, right-click any entry in the network tab and do "save all as HAR without context".

The .har file will again be a text file. Please delete anything private. What you should probably search for: your address, name, meter ID, installation ID, an authentication token (in every call, ctrl+f for the word "Bearer" - the long string afterwards). You could also email it to me (github[at sign]vogt.pw), I'll promise to delete it afterwards and not caring about who you are 😄