sockless-coding / panasonic_cc

Panasonic Comfort Cloud - Home Assistant Component
MIT License
176 stars 38 forks source link

Error fetching device data from API: (get_device: Expected status code 200, received: 403: {"code":4300,"message":"Have no authority to the request"} #273

Closed maurilloh closed 3 weeks ago

maurilloh commented 3 months ago

After upgrade from version 1.0.58 i have this issue, some one could help me? thanks.

AndreaMagis commented 3 months ago

Me too...

ddemarch commented 3 months ago

I also have the same problem following the update to version 1.1.16. I can’t downgrade to version 1.0.58, which was working fine before. It is not available in HACS. Thank you very much.

mtanasiewicz commented 3 months ago

Same here

image
sockless-coding commented 3 months ago

Hello, can you please provide some more detailed logs. That message just says that you do not have any permissions to access the device.

mtanasiewicz commented 3 months ago

Is this what you are looking for, or should I search elsewhere?

This error originated from a custom integration.

Logger: custom_components.panasonic_cc.coordinator Source: custom_components/panasonic_cc/coordinator.py:77 integration: Panasonic Comfort Cloud (documentation, issues) First occurred: 3:42:39 PM (175 occurrences) Last logged: 7:50:59 PM

Error fetching device data from API: (get_device: Expected status code 200, received: 403: {"code":4300,"message":"Have no authority to the request"} Traceback (most recent call last): File "/config/custom_components/panasonic_cc/coordinator.py", line 77, in _fetch_device_data self._device = await self._api_client.get_device(self._panasonic_device_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 121, in get_device json_response = await self.execute_get(self._get_device_status_url(device_info.guid), "get_device", 200) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicsession.py", line 144, in execute_get await check_response(response, function_description, expected_status_code) File "/config/custom_components/panasonic_cc/pcomfortcloud/helpers.py", line 32, in check_response raise exceptions.ResponseError( custom_components.panasonic_cc.pcomfortcloud.exceptions.ResponseError: (get_device: Expected status code 200, received: 403: {"code":4300,"message":"Have no authority to the request"}

sockless-coding commented 3 months ago

I would need the group/setup requests you need to activate debug logging for the integration to see in the log it should look like this:

2024-08-08 11:46:04.914 DEBUG (MainThread) [custom_components.panasonic_cc.pcomfortcloud.panasonicsession] GET url: https://accsmart.panasonic.com/device/group, response: {"uiFlg":false,"groupCount":1,"groupList":[{"groupId":<REDACTED>,"groupName":"My House","pairingList":[],"deviceList":[{"deviceGuid":"CS-HZ25UKE+<REDACTED>","deviceType":"3","deviceName":"Living Room","permission":2,"temperatureUnit":0,"summerHouse":2,"nanoeStandAlone":true,"autoMode":true,"modeAvlList":{"autoMode":1},"parameters":{"operate":0,"operationMode":2,"temperatureSet":20,"fanSpeed":3,"fanAutoMode":1,"airSwingLR":5,"airSwingUD":3,"ecoFunctionData":0,"ecoMode":0,"ecoNavi":0,"nanoe":1,"iAuto":0,"airDirection":0,"lastSettingMode":0},"deviceModuleNumber":"CS-HZ25UKE","deviceHashGuid":<REDACTED>,"modelVersion":1,"coordinableFlg":false}]}]}
2024-08-08 11:46:04.914 INFO (MainThread) [custom_components.panasonic_cc] Got 1 devices
2024-08-08 11:46:06.411 DEBUG (MainThread) [custom_components.panasonic_cc.pcomfortcloud.panasonicsession] GET url: https://accsmart.panasonic.com/deviceStatus/CS-HZ25UKE%2B<REDACTED>, response: {"timestamp":1723110366241,"permission":2,"summerHouse":2,"iAutoX":false,"nanoe":true,"nanoeStandAlone":true,"autoMode":true,"heatMode":true,"fanMode":true,"dryMode":true,"coolMode":true,"ecoNavi":false,"powerfulMode":true,"quietMode":true,"airSwingLR":true,"autoSwingUD":false,"ecoFunction":0,"temperatureUnit":0,"modeAvlList":{"autoMode":1},"nanoeList":{"visualizationShow":0},"clothesDrying":false,"insideCleaning":false,"fireplace":false,"pairedFlg":false,"parameters":{"ecoFunctionData":0,"insideCleaning":0,"fireplace":0,"lastSettingMode":0,"operate":0,"operationMode":2,"temperatureSet":20,"fanSpeed":3,"fanAutoMode":1,"airSwingLR":5,"airSwingUD":3,"ecoMode":0,"ecoNavi":0,"nanoe":1,"iAuto":0,"airDirection":0,"insideTemperature":21,"outTemperature":18,"airQuality":0},"deviceNanoe":1}
mtanasiewicz commented 3 months ago

How do I activate debug logging? Could you navigate me a bit?

sockless-coding commented 3 months ago

If the integration is listed under Devices, you can just click the "enable debug logging" image

If It's not there, you can edit your configuration.yaml

logger:
  default: info
  logs:
    custom_components.panasonic_cc: debug

The logger section might not be there so you have to add it.

mtanasiewicz commented 3 months ago

Here is the log file

home-assistant_2024-08-08T18-47-49.699Z.log

sockless-coding commented 3 months ago

@mtanasiewicz it's your Tobołowo device breaking everything... it doesn't look like a HVAC what type of device is it? I can probably add some checks so it doesn't try to access non HVACs

mtanasiewicz commented 3 months ago

We have couple of air conditioning devices, and there is one that is unknown type. However previous integration worked perfectly. If you could fix it, it would be perfect :)

mtanasiewicz commented 3 months ago

I think that handling of the 403 status by skipping the device would also be a viable choice. All other devices should work.

sockless-coding commented 3 months ago

Well, the previous version probably threw a few errors but since the strange device was the last one the other ones got added... I've added some checks in v1.1.7 give it a try

mtanasiewicz commented 3 months ago

1.1.7 fixed it, thanks!

sockless-coding commented 3 months ago

Hopefully it fixes it for the others as well. @mtanasiewicz that strange device looks like it could be a water heater since it has a tank status with a temp reading of 50C and some modes... does it show up in the CFC app?

maurilloh commented 3 months ago

I've upgraded to the 1.1.7 but now it can't find any devices. image

sockless-coding commented 3 months ago

@maurilloh I need some more info, please provide some debug logs.

maurilloh commented 3 months ago

after the message the integration is not loaded. I don't have any logs

sockless-coding commented 3 months ago

@maurilloh you need to go to the logs page https://my.home-assistant.io/redirect/logs/ and click load full logs

maurilloh commented 3 months ago

i've found this:

Home Assistant Core 2024-08-09 01:30:26.634 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration panasonic_cc which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2024-08-09 01:30:37.325 INFO (MainThread) [custom_components.panasonic_cc] https://github.com/sockless-coding/panasonic_cc/issues 2024-08-09 01:30:37.327 DEBUG (MainThread) [custom_components.panasonic_cc.pcomfortcloud.panasonicsession] Starting Session 2024-08-09 01:30:37.343 DEBUG (MainThread) [custom_components.panasonic_cc.pcomfortcloud.panasonicsettings] Loaded settings from '/root/.panasonic-settings' 2024-08-09 01:30:37.347 DEBUG (MainThread) [custom_components.panasonic_cc.pcomfortcloud.panasonicsession] Access token is valid 2024-08-09 01:30:38.234 DEBUG (MainThread) [custom_components.panasonic_cc.pcomfortcloud.panasonicsession] GET url: https://accsmart.panasonic.com/device/group, response: {"a2wStatus":{"statusCode":200},"uiFlg":false,"groupCount":1,"groupList":[{"groupId":1033015,"groupName":"My House","pairingList":[],"deviceList":[{"deviceGuid":"B192346444","deviceType":"2","deviceName":"casa","connectionStatus":0,"operationMode":1,"zoneStatus":[{"zoneId":1,"operationStatus":0,"temperature":23},{"zoneId":2}],"tankStatus":{"operationStatus":1,"temperature":44}}]}]} 2024-08-09 01:30:38.234 INFO (MainThread) [custom_components.panasonic_cc] Got 0 devices

sockless-coding commented 3 months ago

@maurilloh What type of device do you have? That response doesn't look like a HVAC. What do you see in the CFC app?

maurilloh commented 3 months ago

i have a water pump and 4 air conditioner, in the versione 1.0.58 i can see them

sockless-coding commented 3 months ago

@maurilloh the logs you provided only shows what looks like an aquarea device.

ddemarch commented 3 months ago

With version 1.1.7 it works! Thanks!

GennaroRASP commented 3 months ago

Good morning, many thanks for the development and update of the module, but since the update to the 1.1.7 release I receive the following error: Registratore: custom_components.panasonic_cc.coordinator Fonte: custom_components/panasonic_cc/coordinator.py:86 Integrazione: Panasonic Comfort Cloud (documentazione, problemi) Prima occorrenza: 08:50:41 (4 occorrenze) Ultima registrazione: 10:32:54

Error fetching device data from API: (try_update: Expected status code 200, received: 500: {"code":5005,"message":"Adapter Communication error"} Traceback (most recent call last): File "/config/custom_components/panasonic_cc/coordinator.py", line 86, in _fetch_device_data if await self._api_client.try_update_device(self._device): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 126, in try_update_device json_response = await self.execute_get(self._get_device_status_url(device_guid), "try_update", 200) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicsession.py", line 144, in execute_get await check_response(response, function_description, expected_status_code) File "/config/custom_components/panasonic_cc/pcomfortcloud/helpers.py", line 32, in check_response raise exceptions.ResponseError( custom_components.panasonic_cc.pcomfortcloud.exceptions.ResponseError: (try_update: Expected status code 200, received: 500: {"code":5005,"message":"Adapter Communication error"}

Questo errore ha avuto origine da un'integrazione personalizzata.

Registratore: custom_components.panasonic_cc.coordinator Fonte: helpers/update_coordinator.py:386 Integrazione: Panasonic Comfort Cloud (documentazione, problemi) Prima occorrenza: 08:50:41 (4 occorrenze) Ultima registrazione: 10:32:54

Error fetching Panasonic Device Coordinator data: Invalid response from API: (try_update: Expected status code 200, received: 500: {"code":5005,"message":"Adapter Communication error"}

since I have some automations that warn me when the machine is unavailable, the notification starts, but after a second it returns to being reachable. How can I avoid the inconvenience, thank you very much

sockless-coding commented 3 months ago

@GennaroRASP Hi, the 5005 Adapter Communication error is usually caused when the Panasonic Servers cant reach the HVAC, you could go over your wifi settings and see if something is interfering / switching channels. Or you can change the update interval of the integration to something higher to see if helps

ParadiseComputing commented 3 months ago

Hello, Also getting "Failed setup, will retry: Invalid response from API: (get_device: Expected status code 200, received: 500: {"code":5005,"message":"Adapter Communication error"}" when updating to 1.1.7

Logger: custom_components.panasonic_cc.coordinator Source: custom_components/panasonic_cc/coordinator.py:77 integration: Panasonic Comfort Cloud (documentation, issues) First occurred: 10:27:56 (14 occurrences) Last logged: 10:32:11 Error fetching device data from API: (get_device: Expected status code 200, received: 500: {"code":5005,"message":"Adapter Communication error"}

Traceback (most recent call last): File "/config/custom_components/panasonic_cc/coordinator.py", line 77, in _fetch_device_data self._device = await self._api_client.get_device(self._panasonic_device_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/panasonic_cc/pcomfortcloud/apiclient.py", line 121, in get_device json_response = await self.execute_get(self._get_device_status_url(device_info.guid), "get_device", 200) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/panasonic_cc/pcomfortcloud/panasonicsession.py", line 144, in execute_get await check_response(response, function_description, expected_status_code) File "/config/custom_components/panasonic_cc/pcomfortcloud/helpers.py", line 32, in check_response raise exceptions.ResponseError( custom_components.panasonic_cc.pcomfortcloud.exceptions.ResponseError: (get_device: Expected status code 200, received: 500: {"code":5005,"message":"Adapter Communication error"}

I can control and HVAC systems fine via the Comfort Cloud app.

sockless-coding commented 3 months ago

Regarding the 5005 or 5002 error codes, Panasonic's support answer to that is: "If you receive this error, please check if the Internet environment is stable. If the problem persists even though the Internet is stable, contact your local service center here."

aldebaran-ms commented 3 months ago

My two pence here about the 5005 problem. I had the very same problem and it was related with one single unit not being reachable from the Panasonic app. Once I removed the faulty ac unit from the app the HA integration started working again. BTW thank you all for the great work here!

sockless-coding commented 3 months ago

I've made v1.1.8 more resilient in the start-up phase, if it encounters an inaccessible device it will be logged, but the rest should be added.

github-actions[bot] commented 1 month ago

Hi there! This issue has been marked as stale due to inactivity. If you believe this is still relevant, please let us know. Otherwise, it will be closed soon.

github-actions[bot] commented 3 weeks ago

This issue has been automatically closed due to inactivity. If you still need help, feel free to reopen or create a new issue. Thank you!