sockless-coding / panasonic_cc

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

New version #41

Closed wdflorczyk closed 4 months ago

wdflorczyk commented 3 years ago

Hi. There is a new version of API. Component stopped working.

adebree commented 3 years ago

API demands a higher client version. A new mobile app has been pushed to the stores. I've opened a PR on the python library to upgrade this:

https://github.com/lostfields/python-panasonic-comfort-cloud/pull/48

[edit] closed the PR since it was incorrect / opened without coffee in the body, aaand @sockless-coding solution is way more elegant :D

purcell-lab commented 3 years ago

Thanks for updating, I had just started seeing this issue today, glad you have reported to upstream library.

My logs for anyone else who is researching this issue:

`This error originated from a custom integration.

Logger: homeassistant.config_entries Source: custom_components/panasonic_cc/init.py:79 Integration: Panasonic Comfort Cloud (documentation) First occurred: 5:32:13 PM (1 occurrences) Last logged: 5:32:13 PM

Error setting up entry for panasonic_cc Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup result = await component.async_setup_entry(hass, self) # type: ignore File "/config/custom_components/panasonic_cc/init.py", line 79, in async_setup_entry devices = await hass.async_add_executor_job(api.get_devices) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 172, in get_devices self.login() File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 99, in login self._create_token() File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 132, in _create_token raise ResponseError(response.status_code, response.text) pcomfortcloud.session.ResponseError: Invalid response, status code: 401 - Data: {"message":"New version app has been published","code":4106} `

Hengjie commented 3 years ago

For now, the temporary workaround is to go to /usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py and edit the bit where it says

    def _headers(self):
        return {
            "X-APP-TYPE": "1",
            "X-APP-VERSION": "1.10.0",
            "X-User-Authorization": self._vid,
            "User-Agent": "G-RAC",
            "Accept": "application/json",
            "Content-Type": "application/json"
        }

so that "X-APP-VERSION": "1.10.0", becomes "X-APP-VERSION": "1.12.0",

Then restart Homeasisstant.

sockless-coding commented 3 years ago

Waiting for @lostfields to publish a new version of the lib to PyPi

sygys commented 3 years ago

im starting to get tired of this.... every few days this integration stops working. I wish i bought a different brand AC with local API support...

Is there documentation to how to send API messages to the panasonic cloud comfort. Maybe i can build my own with node red so these things dont happen anymore. I was allready trying to find documentation on how to implement the api (what to send and to where) but cant find anything.

It would be very much appreciated if this integration becomes a little more stable so i can actually rely on it more then a couple of days...

Besides that i dont have a folder called /usr/local/lib/python3.9 or atleast i cant access it

sockless-coding commented 3 years ago

@sygys I've submitted a pull request to lostfields lib where the version is fetched from the published app instead of being hard coded in the lib. This is the problem with cloud devices, we are at the mercy of their API changes. As far as I can tell, there isn't a way to locally communicate with the HVAC (no open ports). The only activity I can see from my device is to 23.99.106.124:443 which is an azure service with client certificate protection.

sygys commented 3 years ago

im planning on removing the wifi module and read the info that the module sends to AC directly. if i can find out how this thing communicates with the AC the maybe i can replace the module with for example a ESP chip. I guess the wifi is protected to the servers over the cloud. but the wired connection between the wifi module and the AC... maybe i can hijack that and build my own local wifi module

sockless-coding commented 3 years ago

I've created a version that contains a local copy of the lib that includes my auto version code. https://www.jimmyk.se/ha/panasonic_cc.zip I can not publish it to HACS since they do not really want/allow you to include local copies of a lib.

sygys commented 3 years ago

Thanks a bunch it works again! i really hope panasonic will stop messing the api up..

hammie00 commented 3 years ago

Sorry for my ignorance and thanks a lot for investing in my airco ;-) Where do I find that /usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py? how do i get there?

Or... how do I install your zip package? Thanks!!

War3333 commented 3 years ago

im starting to get tired of this.... every few days this integration stops working. I wish i bought a different brand AC with local API support...

Is there documentation to how to send API messages to the panasonic cloud comfort. Maybe i can build my own with node red so these things dont happen anymore. I was allready trying to find documentation on how to implement the api (what to send and to where) but cant find anything.

It would be very much appreciated if this integration becomes a little more stable so i can actually rely on it more then a couple of days...

Besides that i dont have a folder called /usr/local/lib/python3.9 or atleast i cant access it

https://github.com/DomiStyle/esphome-panasonic-ac

This will do exactly what you ask, but only for that specific Wifi adapter. There is another project that work on another adapter but only for specific models. The protocol change a lot from the different series of Panasonic AC.

sockless-coding commented 3 years ago

@hammie00 to update using the zip version: Inside the config directory, there should have the following path custom_components\panasonic_cc just replace the content of that directory with the content from the zip.

hammie00 commented 3 years ago

Tnx, please dont steal my passwords ;-)

bschjoett commented 3 years ago

Tnx, sockless-coding it solved the problem.

sygys commented 3 years ago

im starting to get tired of this.... every few days this integration stops working. I wish i bought a different brand AC with local API support... Is there documentation to how to send API messages to the panasonic cloud comfort. Maybe i can build my own with node red so these things dont happen anymore. I was allready trying to find documentation on how to implement the api (what to send and to where) but cant find anything. It would be very much appreciated if this integration becomes a little more stable so i can actually rely on it more then a couple of days... Besides that i dont have a folder called /usr/local/lib/python3.9 or atleast i cant access it

https://github.com/DomiStyle/esphome-panasonic-ac

This will do exactly what you ask, but only for that specific Wifi adapter. There is another project that work on another adapter but only for specific models. The protocol change a lot from the different series of Panasonic AC.

This could be exactly what i need! I hope this works for the latests and newest AC units too. Thanks very much for this!

purcell-lab commented 3 years ago

Presumably this issue can be closed as the update has fixed the current version issue, until it is changed upstream again.

sygys commented 3 years ago

@War3333 I just finished installing the ESP32 into my panasonic AC and can confirm it works with the DomiStyle tutorial and software. the ESP32 and logic converter fit into the standard wifi module housing. Im planning on making a few more for people who want the AC to properly work offline without the comfort cloud. i just need to find the same connector so no soldering is needed.