sockless-coding / panasonic_cc

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

403 forbidden #76

Closed baty0man closed 4 months ago

baty0man commented 2 years ago

Hi

Getting a 403 forbidden error even though my password is correct (tested on Panasonic comfort cloud app)

Anybody has the same issue? It was working fine before.

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/panasonic_cc/panasonic.py:23
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 9:22:12 PM (10 occurrences)
Last logged: 9:38:07 PM

[140446803720848] Invalid response, status code: 403 - Data: <html> <head><title>403 Forbidden</title></head> <body> <center><h1>403 Forbidden</h1></center> </body> </html>
[140446797973632] Invalid response, status code: 403 - Data: <html> <head><title>403 Forbidden</title></head> <body> <center><h1>403 Forbidden</h1></center> </body> </html>
Traceback (most recent call last):
  File "/config/custom_components/panasonic_cc/panasonic.py", line 21, in wrapper_call
    func(*args, **kwargs)
  File "/config/custom_components/panasonic_cc/panasonic.py", line 346, in set_device
    self._api.set_device(
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 389, in set_device
    raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 189, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1627, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1664, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 677, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 964, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 714, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 588, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/config/custom_components/panasonic_cc/climate.py", line 106, in async_set_temperature
    await self._api.set_temperature(**kwargs)
  File "/config/custom_components/panasonic_cc/panasonic.py", line 266, in set_temperature
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/panasonic_cc/panasonic.py", line 23, in wrapper_call
    args[0]._api.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: 403 - Data: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>
masminl commented 2 years ago

I have exactly the same issue since this week.. Really frustrating that in this hot weather I can't control my AC using Home Assistant.

It appears to be the same issue as raised here last year: https://github.com/sockless-coding/panasonic_cc/issues/35

kongjudas commented 2 years ago

Same here, it started a few days ago and has been on and off. The CC app has also been very slow to not responding at all, so this seems to be Panasonic's problem.

Th0masDB commented 2 years ago

@kongjudas I do think something at the back end changed, and we also need to change something. Otherwise, we would get some connection sometimes. :(

freman commented 2 years ago

I have exactly the same issue since this week.. Really frustrating that in this hot weather I can't control my AC using Home Assistant.

I have the opposite problem, it's freezing here and I have to go find the remote

zobde74 commented 2 years ago

I have the same/similar issue started yesterday evening. Yesterday evening also Panasonc app was not working but now it works.

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

Error setting up entry for panasonic_cc Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 353, in async_setup result = await component.async_setup_entry(hass, self) 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.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.10/site-packages/pcomfortcloud/session.py", line 172, in get_devices self.login() File "/usr/local/lib/python3.10/site-packages/pcomfortcloud/session.py", line 99, in login self._create_token() File "/usr/local/lib/python3.10/site-packages/pcomfortcloud/session.py", line 132, in _create_token raise ResponseError(response.status_code, response.text) pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data:

403 Forbidden

403 Forbidden

djbuzz07 commented 2 years ago

Has been a bit iffy for a few days and then stopped completely this morning, deleted the integration and now it wont let me add it back in, just get this error so think Panasonic have changed something at there end.

PCC .

Th0masDB commented 2 years ago

I think it has to do with this: https://github.com/lostfields/python-panasonic-comfort-cloud/issues/62#issuecomment-1183102263

freman commented 2 years ago

I'm probably going to give up and go the esp32 route... tho while I'm waiting maybe try some mitm... I have such a love hate relationship with tls right now.

I just checked my pcomfortcloud already has that version.

kongjudas commented 2 years ago

Integration with the Tibber app also fails at login. The API seems to be broken for all.

Th0masDB commented 2 years ago

I think it has to do with this: lostfields/python-panasonic-comfort-cloud#62 (comment)

Found the solution! You can fixit for yourselfs by editing manifest.json and replacing the requirements with "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"]

I made a pull request (https://github.com/lostfields/python-panasonic-comfort-cloud/pull/63), so you also can wait until it is approved.

freman commented 2 years ago

That worked for me, strange cos the pconmfortcloud I found had the right version in it, maybe there's another copy of the module somewhere.

Th0masDB commented 2 years ago

That worked for me, strange cos the pconmfortcloud I found had the right version in it, maybe there's another copy of the module somewhere.

I changed a file but I didn't change the version number because nothing big changed. (The version on my fork.)

kloodhu commented 2 years ago

unfortunatelly this modification is not solved the problem for me. still 403.

Th0masDB commented 2 years ago

unfortunatelly this modification is not solved the problem for me. still 403.

Did you restart home assistant?

krism23 commented 2 years ago

"requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"]

I did restart ha , but still 403

buhito81 commented 2 years ago

unfortunatelly this modification is not solved the problem for me. still 403.

Did you restart home assistant?

No 403, but now the log indicates a such:

image

Manifest reads:

image

lucastumia commented 2 years ago

unfortunatelly this modification is not solved the problem for me. still 403.

Did you restart home assistant?

No 403, but now the log indicates a such:

image

Manifest reads:

image

replace "requirements":["pcomfortcloud==0.0.2"] by "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"]. And maybe the version 1.0.30 to 1.15.0 Then restart ha It also works for me (thanks for the solution 👍 )

buhito81 commented 2 years ago

"requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"]

Ah, thanks. Stupid of me. After reboot similar error:

image

When changing version to 1.15.0:

image

Iceledo commented 2 years ago

I have also done the "requirements" and "version" change and still have the "403 Forbidden" error.

Th0masDB commented 2 years ago
{
    "domain": "panasonic_cc",
    "name": "Panasonic Comfort Cloud",
    "version": "1.0.30",
    "config_flow": true,
    "documentation": "https://github.com/sockless-coding/panasonic_cc/",
    "dependencies": [],
    "codeowners": ["sockless-coding"],
    "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"]
  }

So, this is what your manifest.json looks like? (@Iceledo @buhito81 )

krism23 commented 2 years ago
{
    "domain": "panasonic_cc",
    "name": "Panasonic Comfort Cloud",
    "version": "1.0.30",
    "config_flow": true,
    "documentation": "https://github.com/sockless-coding/panasonic_cc/",
    "dependencies": [],
    "codeowners": ["sockless-coding"],
    "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"]
  }

So, this is what your manifest.json looks like? (@Iceledo @buhito81 )

Still 403, mine manifest is: { "domain": "panasonic_cc", "name": "Panasonic Comfort Cloud", "version": "1.0.31", "config_flow": true, "documentation": "https://github.com/sockless-coding/panasonic_cc/", "dependencies": [], "codeowners": ["sockless-coding"], "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"] }

buhito81 commented 2 years ago
{
    "domain": "panasonic_cc",
    "name": "Panasonic Comfort Cloud",
    "version": "1.15",
    "config_flow": true,
    "documentation": "https://github.com/sockless-coding/panasonic_cc/",
    "dependencies": [],
    "codeowners": ["sockless-coding"],
    "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"]
  }
Iceledo commented 2 years ago

Yea, exactly like that

lucastumia commented 2 years ago

could you try with "version": "1.15.0", ?

Here is my settings : { "domain": "panasonic_cc", "name": "Panasonic Comfort Cloud", "version": "1.15.0", "config_flow": true, "documentation": "https://github.com/sockless-coding/panasonic_cc/", "dependencies": [], "codeowners": ["sockless-coding"], "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"] }

Th0masDB commented 2 years ago

Mmm... Strange. Do you (for the people that is doesn't work for) have any files in deps folder? Also what version of HA do you use? Docker container?

buhito81 commented 2 years ago

Mmm... Strange. Do you (for the people that is doesn't work for) have any files in deps folder? Also what version of HA do you use? Docker container?

?Deps folder?

image

krism23 commented 2 years ago

Mmm... Strange. Do you (for the people that is doesn't work for) have any files in deps folder? Also what version of HA do you use? Docker container?

core-2022.7.3 also, where to find deps folder? Running VM

Th0masDB commented 2 years ago

Mmm... Strange. Do you (for the people that is doesn't work for) have any files in deps folder? Also what version of HA do you use? Docker container?

?Deps folder?

image

I see... You use the Supervisor version and I don't. I will look into that! In the home folder of HA there is a deps folder... afbeelding

This is how it looks for me

buhito81 commented 2 years ago

could you try with "version": "1.15.0", ?

Here is my settings : { "domain": "panasonic_cc", "name": "Panasonic Comfort Cloud", "version": "1.15.0", "config_flow": true, "documentation": "https://github.com/sockless-coding/panasonic_cc/", "dependencies": [], "codeowners": ["sockless-coding"], "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"] }

Similar:

image

krism23 commented 2 years ago

@Th0masDB deps folder is empty for me

Lem0nz commented 2 years ago

Joining the conversation with same issue :-( (Also Supervisor HA install on VM)

image

Current manifest.json setup: { "domain": "panasonic_cc", "name": "Panasonic Comfort Cloud", "version": "1.0.30", "config_flow": true, "documentation": "https://github.com/sockless-coding/panasonic_cc/", "dependencies": [], "codeowners": ["sockless-coding"], "requirements": ["pcomfortcloud==0.0.22"] }

Tried above mentioned changes in topic, restarted HA, had no effect so turned back to original state.

TimBE1989 commented 2 years ago

Same issue for me since today. Last two days got several times HTTP 500 - Service Unavailable

Th0masDB commented 2 years ago

I just tested it on a VM, and it also works then. I installed panasonic_cc using HACS, and then I edited the manifest.json with the file editor plugin to this: { "domain": "panasonic_cc", "name": "Panasonic Comfort Cloud", "version": "1.0.30", "config_flow": true, "documentation": "https://github.com/sockless-coding/panasonic_cc/", "dependencies": [], "codeowners": ["sockless-coding"], "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"] } I saved the file. Rebooted the whole VM. And then I added the integration.

buhito81 commented 2 years ago

{ "domain": "panasonic_cc", "name": "Panasonic Comfort Cloud", "version": "1.0.30", "config_flow": true, "documentation": "https://github.com/sockless-coding/panasonic_cc/", "dependencies": [], "codeowners": ["sockless-coding"], "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"] }

Tried that just now, same errors as a result:

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: 17:02:43 (1 occurrences)
Last logged: 17:02:43

Error setting up entry for panasonic_cc
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 353, in async_setup
    result = await component.async_setup_entry(hass, self)
  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.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/pcomfortcloud/session.py", line 172, in get_devices
    self.login()
  File "/usr/local/lib/python3.10/site-packages/pcomfortcloud/session.py", line 99, in login
    self._create_token()
  File "/usr/local/lib/python3.10/site-packages/pcomfortcloud/session.py", line 132, in _create_token
    raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data: <html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
</body>
</html>
Th0masDB commented 2 years ago

What I think the problem is that HA doesn't download the new pcomfortcloud on the VM version. But since I am not home/familiar with HA Supervisor, it can take some time. :)

krism23 commented 2 years ago

I just tested it on a VM, and it also works then. I installed panasonic_cc using HACS, and then I edited the manifest.json with the file editor plugin to this: { "domain": "panasonic_cc", "name": "Panasonic Comfort Cloud", "version": "1.0.30", "config_flow": true, "documentation": "https://github.com/sockless-coding/panasonic_cc/", "dependencies": [], "codeowners": ["sockless-coding"], "requirements": ["git+https://github.com/Th0masDB/python-panasonic-comfort-cloud@master#pcomfortcloud==0.0.2"] } I saved the file. Rebooted the whole VM. And then I added the integration.

I appreciate your efforts, but still the same problem. These are the steps I tried: I completely removed the integration and also the repo. Then rebooted the VM. Downloaded the repo. Edited the manifest.json. Rebooted the VM again. Installed the integration and when asked for username & password ==> error

buhito81 commented 2 years ago

What I think the problem is that HA doesn't download the new pcomfortcloud on the VM version. But since I am not home/familiar with HA Supervisor, it can take some time. :)

As I understand - but not my field of expertise - the dependencies are in the supervisor updates (see here: https://github.com/home-assistant/architecture/blob/master/adr/0014-home-assistant-supervised.md#required-expertise)

BVGorp commented 2 years ago

if you want to fix this temporary till the new pull request is accepted. for supervised: (at your own risk) ssh to host shell into the home assistant docker container: docker exec -it homeassistant /bin/bash cd /usr/local/lib/python3.10/site-packages/pcomfortcloud vi session.py and make the change like https://github.com/lostfields/python-panasonic-comfort-cloud/pull/63/files

this worked for me. and will be overwritten as the new version is released.

Th0masDB commented 2 years ago

if you want to fix this temporary till the new pull request is accepted. for supervised: (at your own risk) ssh to host shell into the home assistant docker container: docker exec -it homeassistant /bin/bash cd /usr/local/lib/python3.10/site-packages/pcomfortcloud vi session.py and make the change like https://github.com/lostfields/python-panasonic-comfort-cloud/pull/63/files

this worked for me. and will be overwritten as the new version is released.

Thanks! This is what I was looking for. But man, the supervisor is not easy to understand in 10 minutes haha :)

haru67200 commented 2 years ago

yessss thanks @BVGorp and @Th0masDB work for me!!!

krism23 commented 2 years ago

if you want to fix this temporary till the new pull request is accepted. for supervised: (at your own risk) ssh to host shell into the home assistant docker container: docker exec -it homeassistant /bin/bash cd /usr/local/lib/python3.10/site-packages/pcomfortcloud vi session.py and make the change like https://github.com/lostfields/python-panasonic-comfort-cloud/pull/63/files

this worked for me. and will be overwritten as the new version is released.

thanks man !!!

Iceledo commented 2 years ago

This solved it. Thanks to both!

TimBE1989 commented 2 years ago

if you want to fix this temporary till the new pull request is accepted. for supervised: (at your own risk) ssh to host shell into the home assistant docker container: docker exec -it homeassistant /bin/bash cd /usr/local/lib/python3.10/site-packages/pcomfortcloud vi session.py and make the change like https://github.com/lostfields/python-panasonic-comfort-cloud/pull/63/files

this worked for me. and will be overwritten as the new version is released.

Works perfect. Thanks!

kloodhu commented 2 years ago

this worked for me. and will be overwritten as the new version is released.

worked for me too. thank you all!

maartenhendrix commented 2 years ago

if you want to fix this temporary till the new pull request is accepted.

for supervised: (at your own risk)

ssh to host

shell into the home assistant docker container: docker exec -it homeassistant /bin/bash

cd /usr/local/lib/python3.10/site-packages/pcomfortcloud

vi session.py

and make the change like https://github.com/lostfields/python-panasonic-comfort-cloud/pull/63/files

this worked for me. and will be overwritten as the new version is released.

On my pi i have the same problem but am not able to find the file you mentioned. Could it be located somewhere else?

TimBE1989 commented 2 years ago

if you want to fix this temporary till the new pull request is accepted. for supervised: (at your own risk) ssh to host shell into the home assistant docker container: docker exec -it homeassistant /bin/bash cd /usr/local/lib/python3.10/site-packages/pcomfortcloud vi session.py and make the change like https://github.com/lostfields/python-panasonic-comfort-cloud/pull/63/files this worked for me. and will be overwritten as the new version is released.

On my pi i have the same problem but am not able to find the file you mentioned. Could it be located somewhere else?

Have also a PI, for me it was in python3.9 folder

sockless-coding commented 2 years ago

Hi, Yes, it looks like they implemented stricter version checking on the server side, so lostfields way of adding a way higher version number no longer works. And unfortunately, he never merged my pull request with auto version detection. The latest app version is 1.15.1. I will see if I can't get my v2.0 in to a release worthy state, it doesn't rely on the lib from lostfields and support auto pc cloud app version detection.

Th0masDB commented 2 years ago

@sockless-coding it does still work now after the change in the file. So I do not quite get what you mean. But it is really nice that you are going to try to update it!

Th0masDB commented 2 years ago

@maartenhendrix Heb jij hem rechtstreeks op de PI lopen of in een docker container? English: Do you run it directly on the PI or in a docker container?

Lem0nz commented 2 years ago

if you want to fix this temporary till the new pull request is accepted. for supervised: (at your own risk) ssh to host shell into the home assistant docker container: docker exec -it homeassistant /bin/bash cd /usr/local/lib/python3.10/site-packages/pcomfortcloud vi session.py and make the change like https://github.com/lostfields/python-panasonic-comfort-cloud/pull/63/files

this worked for me. and will be overwritten as the new version is released.

Damned, not really a clue how to start the "SSH" and the "SHELL" part :-( Anyone with a quick "howto" or can this be done via the "Visual Studio Code" in HA as well?

My current setup is the HA Supervisor install on my Synology via the Virtual Machine Manager. I'm able to "connect" to the VM, but shows me a window like this:

image