python-panasonic-comfort-cloud
python-panasonic-comfort-cloud copied to clipboard
code 403: "message":"Have no authority to the request","code":4300
Hello,
I'm getting an error when trying to run the Module example, in this step: print(session.get_device(devices[0]['id']))
I get:
Traceback (most recent call last):
File "C:\Users\Pete\Documents\Programacion\Python\test1.py", line 73, in
I've tried to change the init to use verifySsl=False (I saw that in one of the issues): def init(self, username, password, tokenFileName='~/.panasonic-token', raw=True, verifySsl=False): but no luck.
Thanks in advance
Sound strange, are you able to use the same user inn the app?
Hello,
I'm using the same credentials.

The strange thing is that no matter the email and password (right or wrong), I can always retrieve the list of devices, and I always end up getting the same 4300 error:

Maybe the session is stuck with old wrong credentials? Or I'm retrieving a dummy list of devices?
I may take a look, are you sure you have installed the latest version?
I think so:
Unless I'm missing something
May you try to download VS Code and try to run some of the requests in https://github.com/lostfields/python-panasonic-comfort-cloud/blob/master/requests.http - you may use curl as well, but you have to rewrite them.
VS Code + REST Client may run these commands in sequence.
First login, by running the first request. Then run the second one to get the first device in the device list. After that you can run anyone of them, to see if any fails.
I've tried, and in the 3rd call I get the 4300 "Have no authority to the request". Here you have the results of the 3 first calls:
GET https://accsmart.panasonic.com/device/group HTTP/1.1
HTTP/1.1 200
Date: Sat, 22 Oct 2022 06:03:37 GMT
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
Connection: close
Server: nginx
Cache-Control: no-store,no-cache,must-revalidate,max-age=0
Pragma: no-cache
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1;mode=block
Strict-Transport-Security: max-age=31536000;includeSubdomains
Content-Security-Policy: script-src 'self' 'unsafe-inline'
{
"result": 0,
"uToken": "***",
"country": "ES",
"extUsrId": "***",
"clientId": "***",
"language": 0
}
GET https://accsmart.panasonic.com/deviceStatus/now/{{device.response.body.$.groupList[0].deviceList[0].deviceGuid}} HTTP/1.1
HTTP/1.1 200
Date: Sat, 22 Oct 2022 06:04:03 GMT
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked
Connection: close
Server: nginx
Cache-Control: no-store,no-cache,must-revalidate,max-age=0
Pragma: no-cache
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1;mode=block
Strict-Transport-Security: max-age=31536000;includeSubdomains
Content-Security-Policy: script-src 'self' 'unsafe-inline'
{
"iaqStatus": {
"statusCode": 200
},
"a2wStatus": {
"statusCode": 200
},
"uiFlg": false,
"groupCount": 1,
"groupList": [
{
"groupId": 773894,
"groupName": "My House",
"pairingList": [],
"deviceList": [
{
"deviceGuid": "B308306902",
"deviceType": "2",
"deviceName": "Aerotermia",
"connectionStatus": 0,
"operationMode": 1,
"zoneStatus": [
{
"zoneId": 1,
"operationStatus": 0,
"temperature": 37
},
{
"zoneId": 2
}
],
"tankStatus": {
"operationStatus": 0,
"temperature": 56
},
"parameters": {}
}
]
}
]
}
GET https://accsmart.panasonic.com/deviceStatus/{{device.response.body.$.groupList[0].deviceList[0].deviceGuid}} HTTP/1.1
HTTP/1.1 403
Date: Sat, 22 Oct 2022 06:04:33 GMT
Content-Type: application/json;charset=UTF-8
Content-Length: 58
Connection: close
Server: nginx
Cache-Control: no-cache, must-revalidate
{
"message": "Have no authority to the request",
"code": 4300
}
This is really a authorization problem, since you get HTTP 403. Are you sure you don't have to agree to some terms when you use your credentials in the the Panasonic Comfort Cloud app at your phone?
If you have several users, may you log into with your primary user, and press the upper icon at right, and going into Owner > User list and make sure everyone has access?
Hi,
Was the root cause for this identified, have been facing exactly same issue for several users including primary user. I get the user and device information, but all other calls eg. dump, history are failing with {"message":"Have no authority to the request","code":4300}, Have two mobile apps and both are working fine.
Hi! I'm having same issue, any hint?
Anyone, please!
I'm still getting:
{"message":"Have no authority to the request","code":4300}
@lostfields
I never managed to fix this problem :(
Just to update, my guess is that seems this script does not work with some panasonic devices, for myself I see solution just to use curl instead, what seems to work fine for purposes I need(I want turn on or off devices based on spot prices of electricity).
What kind of curl command line works for you? @os11k
sent an email @lostfields
Hi @os11k, I can't get this to work. Can you please send me the solution you built with curl? It'd be very appreciated. Thanks a lot in advance!
@lostfields is there any advance on this?
Hmm, try to do a new request to https://accsmart.panasonic.com/deviceStatus/now/ and after that find the deviceGuid in the response body and insert it into the following url at the end replacing # ; https://accsmart.panasonic.com/deviceStatus/now/#
A request how? I guess I need some headers. This doesn't work: import requests x = requests.get('https://accsmart.panasonic.com/deviceStatus/now/')
Sorry, I'm not an expert on api integrations :( Thanks in advance
On Sun, Oct 15, 2023 at 11:29 PM lostfields @.***> wrote:
Hmm, try to do a new request to https://accsmart.panasonic.com/deviceStatus/now/ and after that find the deviceGuid in the response body and insert it into the following url at the end replacing # ; https://accsmart.panasonic.com/deviceStatus/now/#
— Reply to this email directly, view it on GitHub https://github.com/lostfields/python-panasonic-comfort-cloud/issues/70#issuecomment-1763508802, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFTLEBQ7BW7TIFZBRPIN3ATX7RIUTAVCNFSM6AAAAAARC7OMPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRTGUYDQOBQGI . You are receiving this because you authored the thread.Message ID: @.*** com>
I just noticed, even if I use a dummy user and password in the Session: session = pcomfortcloud.Session('aaa', 'xxxx') It still prints the devices correctly: print(devices)
[{'id': 'f0de1ca618eeaeb66acc19a0b73b27a6', 'name': 'Aerotermia', 'group': 'Huetor', 'model': ''}]
But then, when trying to get the info from the device, it yields the error: print(session.get_device(devices[0]['id']))
pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data: {"code":4300,"message":"Have no authority to the request"}
Could it be that the user and password are stored and hardcoded somewhere, and that it has to be cleaned?
it stores the session token in ~/.panasonic-token at https://github.com/lostfields/python-panasonic-comfort-cloud/blob/80dbbfb22a4405e8908d32517a44b25bcf132779/pcomfortcloud/session.py#L55-L55
But it should try to auth again if the authorization fails. It will not authorize again if some of the commands fails though. https://github.com/lostfields/python-panasonic-comfort-cloud/blob/80dbbfb22a4405e8908d32517a44b25bcf132779/pcomfortcloud/session.py#L91-L99
If I try GET https://accsmart.panasonic.com/deviceStatus/now without deviceGuid it will fail with 403 at my end as well.
The following requests works just fine at my part; https://github.com/lostfields/python-panasonic-comfort-cloud/blob/80dbbfb22a4405e8908d32517a44b25bcf132779/requests.http#L24-L33
and next GET https://accsmart.panasonic.com/deviceStatus/now/CS-HZ25UKE-5+4948102813 works as well. That is my deviceGuid, yours is different.
Unfortunately, all the requests return 403. I've disabled the part to reuse the token, and now at least I'm getting an error message if I don't use the proper user+passwd. However, I still get the 403 "Have no authority...".
On Mon, Oct 16, 2023 at 8:48 PM lostfields @.***> wrote:
it stores the session token in ~/.panasonic-token at https://github.com/lostfields/python-panasonic-comfort-cloud/blob/80dbbfb22a4405e8908d32517a44b25bcf132779/pcomfortcloud/session.py#L55-L55
But it should try to auth again if the authorization fails. It will not authorize again if some of the commands fails though.
https://github.com/lostfields/python-panasonic-comfort-cloud/blob/80dbbfb22a4405e8908d32517a44b25bcf132779/pcomfortcloud/session.py#L91-L99
If I try GET https://accsmart.panasonic.com/deviceStatus/now without deviceGuid it will fail with 403 at my end as well.
GET https://accsmart.panasonic.com/device/group works, and next GET https://accsmart.panasonic.com/deviceStatus/now/CS-HZ25UKE-5+4948102813 works fine as well. That is my deviceGuid, yours is different.
— Reply to this email directly, view it on GitHub https://github.com/lostfields/python-panasonic-comfort-cloud/issues/70#issuecomment-1765087638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFTLEBRFPQU4I3ATCUXVVYLX7V6RRAVCNFSM6AAAAAARC7OMPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVGA4DONRTHA . You are receiving this because you authored the thread.Message ID: @.*** com>
Using raw, I can see more info about the machine: --- _get_groups() --- raw beginning --- {"a2wStatus":{"statusCode":200},"uiFlg":false,"groupCount":1,"groupList":[{"groupId":773894,"groupName":"Huetor","pairingList":[],"deviceList":[{"deviceGuid":"B308306902","deviceType":"2","deviceName":"Aerotermia","connectionStatus":0,"operationMode":2,"zoneStatus":[{"zoneId":1,"operationStatus":0,"temperature":12},{"zoneId":2}],"tankStatus":{"operationStatus":0,"temperature":54}}]}]} --- raw ending ---
So it seems I'm able to access that information, not sure why it doesn't work later.
On Mon, Oct 16, 2023 at 9:36 PM Pedro Navarro @.***> wrote:
Unfortunately, all the requests return 403. I've disabled the part to reuse the token, and now at least I'm getting an error message if I don't use the proper user+passwd. However, I still get the 403 "Have no authority...".
On Mon, Oct 16, 2023 at 8:48 PM lostfields @.***> wrote:
it stores the session token in ~/.panasonic-token at https://github.com/lostfields/python-panasonic-comfort-cloud/blob/80dbbfb22a4405e8908d32517a44b25bcf132779/pcomfortcloud/session.py#L55-L55
But it should try to auth again if the authorization fails. It will not authorize again if some of the commands fails though.
https://github.com/lostfields/python-panasonic-comfort-cloud/blob/80dbbfb22a4405e8908d32517a44b25bcf132779/pcomfortcloud/session.py#L91-L99
If I try GET https://accsmart.panasonic.com/deviceStatus/now without deviceGuid it will fail with 403 at my end as well.
GET https://accsmart.panasonic.com/device/group works, and next GET https://accsmart.panasonic.com/deviceStatus/now/CS-HZ25UKE-5+4948102813 works fine as well. That is my deviceGuid, yours is different.
— Reply to this email directly, view it on GitHub https://github.com/lostfields/python-panasonic-comfort-cloud/issues/70#issuecomment-1765087638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFTLEBRFPQU4I3ATCUXVVYLX7V6RRAVCNFSM6AAAAAARC7OMPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVGA4DONRTHA . You are receiving this because you authored the thread.Message ID: @.*** com>
My deviceType is 3. So I guess there is some different device family at Panasonic that has different APIs. Until someone figure out how to communicate with this device family I guess we are kinda out of luck.
Hello, I have the same issue. My objective is to get the power consumption of my heater pump via a script. Is there any way that works today to get this data? Thanks in advance !
Hello, I have the same issue. My objective is to get the power consumption of my heater pump via a script. Is there any way that works today to get this data? Thanks in advance !
Hi, It is possible for sure. I don't have it in my script, which I use just for on/off heater and tank.
But here a bit more clues how to do that:
https://github.com/cjaliaga/home-assistant-aquarea/issues/1#issuecomment-1837675335
https://community.home-assistant.io/t/panasonic-aquarea-heat-pump-integration/392095/110
I plan to put my script for switching heating and tank in github soon, but unfortuantly I don't have time for that now.
So if I was you, I would login into aquare cloud and download data, unfortunately I can't recall what file name it is.
Logging in and out and control heat pump is very trivial task to do.
Are you sure web scrapping is possible on aquarea smart cloud? It seems like it is not allowed, and there is a layer of protection to avoid it. When I made a simple python script to attempt this, the querry got rejected...
I'm able to login and control my heat pump, I didn't tried to scrap any data, but seems this project will be able to do it:
https://github.com/cjaliaga/home-assistant-aquarea
More details:
https://github.com/cjaliaga/aioaquarea/commit/baf98ea4bc0219315b6503eb6f80a70088ccbe7f
I doubt that it is impossible to scrap that data, but again I didn't try to do it by myself, so I can't be 100% sure.
I will wait for @cjaliaga release, I use his integration in my home assistant to push data to influxDB, like tank temperature and etc. I control heat pump by my own scripts, I was not able to migrate that functionality in homeassistant yet, but I think this will be an endgame for me.
Just to add a it more on this. I'm using this integration:
https://github.com/cjaliaga/home-assistant-aquarea
And I'm able to get temperature data as outside temperature, tank temperature and much more, only power consumption is not supported yet, but seems it will be done very soon.
Thanks a lot! It seems like getting the aioaquarea to work from a Synology NAS is not going to be straight forward, right? And via the pcomfortcloud.py, will there be a fix soon?
Never tried, but seems it is possible to install home assistant on Synology NAS