tijsverkoyen / HomeAssistant-FusionSolar

Integrate FusionSolar into your Home Assistant.
MIT License
147 stars 27 forks source link

No data in kiosk mode since January 1st #125

Closed enorkus closed 9 months ago

enorkus commented 9 months ago

It seems that the entities became unavailable since January 1st. I've got a notification about some maintanance from FusionSolar around that time too, so maybe it's related.

image

My inverter is online, I can see the data in FusionSolar app as well as in the web browser. My kiosk url is just around 6 months old, but just in case I've tried adding it again and it says no devices or entities, even though the kiosk url is reachable and working.

image

How do I debug? There are no logs that I'm aware of.

silfax commented 9 months ago

Not sure it's related to the kiosk mode. All the entities became 'unavailable' for me as well on January 1st, 4am, local time (EET).

enorkus commented 9 months ago

Ok, I've got some debug logs. It seems that something's changed in the API:

2024-01-02 19:20:28.507 DEBUG (MainThread) [custom_components.fusion_solar.sensor] Finished fetching FusionSolarKiosk data in 0.446 seconds (success: False) 2024-01-02 19:30:28.060 DEBUG (MainThread) [custom_components.fusion_solar.fusion_solar.kiosk.kiosk] calculated API base url for xxxxxxxxxxxxxxxxxx: https://xxxxxx.fusionsolar.huawei.com 2024-01-02 19:30:28.060 DEBUG (MainThread) [custom_components.fusion_solar.sensor] fusion_solar 2024-01-02 19:30:28.061 DEBUG (MainThread) [custom_components.fusion_solar.sensor] AkvanzlDiD3tMKm994aQ2DiosoIewnG9 2024-01-02 19:30:28.488 ERROR (MainThread) [custom_components.fusion_solar.sensor] Unexpected error fetching FusionSolarKiosk data: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 256, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/fusion_solar/sensor.py", line 69, in async_update_kiosk_data data[f'{DOMAIN}-{kiosk.id}'] = await hass.async_add_executor_job(api.getRealTimeKpi, kiosk.id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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/fusion_solar/fusion_solar/kiosk/kiosk_api.py", line 37, in getRealTimeKpi jsonData[ATTR_DATA] = json.loads(html.unescape(jsonData[ATTR_DATA])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

tijsverkoyen commented 9 months ago

I have tested it with my personal kiosk url and this provides me with the correct data.

Can you check if the kiosk url is still working? And if so: could you try to remove an add the integration again? If that is not working could you mail (fusionsolar-ha [at] verkoyen [dot] eu) the kiosk url, so I can try to replicate the issue.

martinnj commented 9 months ago

@tijsverkoyen I have the same error, and the Kiosk URL does seem to have been invalidated judging by the Huawei interface.

I'm apparently not smart enough to find the configuration where the URL is stored in HomeAssistant to update the existing URL. I'd rather not delete and re-create it, as that would probably delete data as well, could you point me at how to update the URL?

It might be worth adding this description to this section as well.

Thanks for the extension though! It's been running flawlessly for a year! :)

Brandyellow commented 9 months ago

@tijsverkoyen I have the same error, and the Kiosk URL does seem to have been invalidated judging by the Huawei interface.

I'm apparently not smart enough to find the configuration where the URL is stored in HomeAssistant to update the existing URL. I'd rather not delete and re-create it, as that would probably delete data as well, could you point me at how to update the URL?

It might be worth adding this description to this section as well.

Thanks for the extension though! It's been running flawlessly for a year! :)

The configuration can be found in the configuration.yaml file (in my case stored in the secrets.yaml file, but that is up to personal preference):

martinnj commented 9 months ago

The configuration can be found in the configuration.yaml file (in my case stored in the secrets.yaml file, but that is up to personal preference):

- platform: fusion_solar_kiosk
  kiosks:
  - url: !secret fusion_solar_url
    name: "Solcellsanläggning"

Mine wasn't there, it didn't have it in any of the other config files. I tried adding it on a lark, and HA says fusion_solar_kiosk is an unknown platform, is that maybe another extension? :)

I tried changing it to just fusion_solar which let it load, but there is still more errors. I'll try and dive more into it.

martinnj commented 9 months ago

Some updates from my end:

I tried adding it on a lark, and HA says fusion_solar_kiosk is an unknown platform, is that maybe another extension? :)

I tried changing it to just fusion_solar which let it load, but there is still more errors. I'll try and dive more into it.

Was because fusion_solar_kiosk is the old extension.

It doesn't seem like this one reads from configuration.yaml, instead it seems to read from /config/.storage/core.config_entries. I updated the Kiosk URL there, and now it works again. :)

EDIT: Huge disclaimer, according to the forum posts on HA's own forum, the .storage folder is not supposed to be user edited, so take proper precautions if you mess with it. :)

TokraHun commented 9 months ago

The issue still persists with valid kiosk url. I see two relevant error in the logs, based on these I also think the kiosk API was changed:

`Logger: homeassistant Source: custom_components/fusion_solar/fusion_solar/power_entity.py:64 First occurred: 31 December 2023 at 12:45:54 (564 occurrences) Last logged: 10:37:28

Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 229, in _handle_refresh_interval await self._async_refresh(log_failures=True, scheduled=True) File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 374, in _async_refresh self.async_update_listeners() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in async_update_listeners update_callback() File "/config/custom_components/fusion_solar/fusion_solar/power_entity.py", line 64, in _handle_coordinator_update if self._data_name not in self.coordinator.data: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable`

`Logger: custom_components.fusion_solar.sensor Source: custom_components/fusion_solar/fusion_solar/kiosk/kiosk_api.py:37 First occurred: 31 December 2023 at 12:35:54 (564 occurrences) Last logged: 10:37:28

Unexpected error fetching FusionSolarKiosk data: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 283, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 242, in _async_update_data return await self.update_method() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/fusion_solar/sensor.py", line 79, in async_update_kiosk_data data[f'{DOMAIN}-{kiosk.id}'] = await hass.async_add_executor_job(api.getRealTimeKpi, kiosk.id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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/fusion_solar/fusion_solar/kiosk/kiosk_api.py", line 37, in getRealTimeKpi jsonData[ATTR_DATA] = json.loads(html.unescape(jsonData[ATTR_DATA])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) `

tijsverkoyen commented 9 months ago

If that is not working could you mail (fusionsolar-ha [at] verkoyen [dot] eu) the kiosk url, so I can try to replicate the issue.

TokraHun commented 9 months ago

Right after midnight it started working again... I didn't update anything in my HA, so maybe it was really a kiosk API change?

tijsverkoyen commented 9 months ago

@silfax

Not sure it's related to the kiosk mode. All the entities became 'unavailable' for me as well on January 1st, 4am, local time (EET).

Are you using Kiosk-mode? As I interpret your reply as you are not using kiosk mode. If so, there is another issue: https://github.com/tijsverkoyen/HomeAssistant-FusionSolar/issues/126

tijsverkoyen commented 9 months ago

The configuration can be found in the configuration.yaml file (in my case stored in the secrets.yaml file, but that is up to personal preference):

  • platform: fusion_solar_kiosk kiosks:

    • url: !secret fusion_solar_url name: "Solcellsanläggning"

This is not correct!

It might be worth adding this description to this section as well.

I have added a separate entry in the FAQ: I need to change the Kiosk URL

tijsverkoyen commented 9 months ago

Right after midnight it started working again... I didn't update anything in my HA, so maybe it was really a kiosk API change?

@enorkus, Can you check if the issue is resolved? If not: can you mail me your kiosk url?

enorkus commented 9 months ago

I have not changed any configuration and it just started working today. I've also got another maintenance message from FusionSolar, so I'm guessing they had messed something up with the API previously and now fixed it. My kiosk url was accessible and working this whole time. Hopefully it doesn't happen again. Thanks for your time - very useful integration :)