sockless-coding / panasonic_cc

Panasonic Comfort Cloud - Home Assistant Component
MIT License
137 stars 35 forks source link

Bad request code 4008 #2

Closed JanSkovhus closed 4 years ago

JanSkovhus commented 4 years ago

Now I get this.

Log Details (ERROR) Logger: homeassistant.config_entries Source: custom_components/panasonic_cc/panasonic.py:50 First occurred: 10:54:02 PM (3 occurrences) Last logged: 11:06:06 PM

Error setting up entry for panasonic_cc Traceback (most recent call last): File "/config/custom_components/panasonic_cc/panasonic.py", line 46, in do_update data= await self.hass.async_add_executor_job(self._api.get_device,self.id) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.7/site-packages/pcomfortcloud/session.py", line 268, in get_device raise ResponseError(response.status_code, response.text) pcomfortcloud.session.ResponseError: Invalid response, status code: 400 - Data: {"message":"Bad request","code":4008}

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 217, in async_setup hass, self File "/config/custom_components/panasonic_cc/init.py", line 69, in async_setup_entry await api_device.update() File "/config/custom_components/panasonic_cc/panasonic.py", line 42, in update await self.do_update() File "/config/custom_components/panasonic_cc/panasonic.py", line 50, in do_update data = self._api.get_device(self.id) File "/usr/local/lib/python3.7/site-packages/pcomfortcloud/session.py", line 268, in get_device raise ResponseError(response.status_code, response.text) pcomfortcloud.session.ResponseError: Invalid response, status code: 400 - Data: {"message":"Bad request","code":4008}

sockless-coding commented 4 years ago

Hmm, do you have multiple devices connected to this account?

JanSkovhus commented 4 years ago

No it is a 2 in 1 devices, floor and water heating. EABB1CE9-24BF-4826-B634-310FFCC14961

Insite Unit: WH-ADC0309J3E5AN Outsite Unit: WH-UD05JE5

sockless-coding commented 4 years ago

I added some error handling to the initialization process, I'm guessing one of the devices doesn't support the get status call. Can you give the new release a try and see if anything shows up?

JanSkovhus commented 4 years ago

Log Details (WARNING) Logger: custom_components.panasonic_cc Source: custom_components/panasonic_cc/init.py:73 Integration: Panasonic Comfort Cloud (documentation) First occurred: 12:55:13 PM (1 occurrences) Last logged: 12:55:13 PM

Failed to setup device: A2W

Log Details (WARNING) Logger: homeassistant.util.async Source: util/async.py:120 First occurred: 12:55:11 PM (2 occurrences) Last logged: 12:55:13 PM

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for panasonic_cc doing I/O at custom_components/panasonic_cc/panasonic.py, line 49: self._api.login() Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for panasonic_cc doing I/O at custom_components/panasonic_cc/panasonic.py, line 50: data = self._api.get_device(self.id)

sockless-coding commented 4 years ago

Hmm, looks like aquarea smart cloud isn't the same as comfort cloud. Does the comfort cloud app work with your device or are required to use the aquarea-smart.panasonic.com? Aquarea seem to have it's own api (https://aquarea-smart.panasonic.com/remote/v1/api) CC is using https://accsmart.panasonic.com

I know about the IO in event loop login issue I haven't had time to sort it out yet, it only happens when the token is invalidated.

JanSkovhus commented 4 years ago

I can login via comfort cloud app but i get redirecte to the web page aquarea-smart.panasonic.com, you are probly right about that it use another api, well I hpoe it will work. Thanks for the help.

sockless-coding commented 4 years ago

The api for aquarea looks very similar to CC so making a HA integration for it shouldn't be that hard. Do you have any experience in python?

JanSkovhus commented 4 years ago

Not muts, where do you find the API for the aquarea?

sockless-coding commented 4 years ago

This guy have made a MagicMirror module https://github.com/martinburheimtingstad/MMM-AquareaSmartCloud in JS. So porting it to Python shouldn't be that hard if you look at the CC module https://github.com/lostfields/python-panasonic-comfort-cloud I haven't looked in to much detail on what it return but the first step would be updating the urls in urls.py and go from there.

JanSkovhus commented 4 years ago

I was planing to use it in MagicMirror any way, and I havent seen that there was one in module for MagicMirror so I just use that and it works.

cigas4 commented 3 years ago

Having same error message. Are there any way to integrate it to HA? I have A2W heater, using same Panasonic Comfort Cloud app, but after logging in I need to select Aquarea group, so it is using Aquarea smart cloud.

sockless-coding commented 3 years ago

@cigas4 unfortunately Aquarea is using a completely different API then Comfort Cloud, in the app they just redirect you to the web API. But I guess you could try setting it up using IFTTT https://ifttt.com/aquarea_smart_cloud

cigas4 commented 3 years ago

Yes, it looks like it is possible to add it to IFTTT, but I am interested in adding it to Home Assistant as climate device.

sockless-coding commented 3 years ago

@cigas4 Yes, and then you add a IFTTT hook to Home Assistant https://www.home-assistant.io/integrations/ifttt/