-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code 403: "message":"Have no authority to the request","code":4300 #70
Comments
Sound strange, are you able to use the same user inn the app? |
I may take a look, are you sure you have installed the latest version? |
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". GET https://accsmart.panasonic.com/device/group HTTP/1.1
GET https://accsmart.panasonic.com/deviceStatus/now/{{device.response.body.$.groupList[0].deviceList[0].deviceGuid}} HTTP/1.1
GET https://accsmart.panasonic.com/deviceStatus/{{device.response.body.$.groupList[0].deviceList[0].deviceGuid}} HTTP/1.1
|
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 |
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:
|
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, |
@lostfields is there any advance on this? |
Hmm, try to do a new request to |
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
<#70 (comment)>,
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:
But then, when trying to get the info from the device, it yields the error:
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
But it should try to auth again if the authorization fails. It will not authorize again if some of the commands fails though. python-panasonic-comfort-cloud/pcomfortcloud/session.py Lines 91 to 99 in 80dbbfb
If I try The following requests works just fine at my part; python-panasonic-comfort-cloud/requests.http Lines 24 to 33 in 80dbbfb
and next |
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
<#70 (comment)>,
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
> <#70 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AFTLEBRFPQU4I3ATCUXVVYLX7V6RRAVCNFSM6AAAAAARC7OMPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVGA4DONRTHA>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***
> com>
>
|
My |
Hello, |
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: cjaliaga/home-assistant-aquarea#1 (comment) 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: 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! |
Never tried, but seems it is possible to install home assistant on Synology NAS |
Same error for me using aquarea comfort cloud. Do you guys found the solution?
It seems (also reading your comments) that the error is caused by some differences between different families of Panasonic devices. In my case, the response to the request In particular, consider |
I have some updates to share. I attempted to sniff the HTTP traffic on my Comfort Cloud app for my Aquarea, and here is what I observed: It appears that certain requests are directed to https://accsmart.panasonic.com/, while others are directed to https://aquarea-smart.panasonic.com/. Specifically, the token is acquired when interacting with accsmart.panasonic.com, and the remaining requests are directed to https://aquarea-smart.panasonic.com/. In the provided example, I issued a temperature change command for zone 1. The request was submitted via POST to the following URL: https://aquarea-smart.panasonic.com/remote/v1/api/devices/{deviceGuid} The JSON request body is: The requests forwarded to aquarea-smart.panasonic.com do not employ the same method for obtaining authorization as utilized in this library ( I would like to know if the same information can be obtained/sent by sending requests to accsmart.panasonic.com instead of aquarea-smart.panasonic.com. |
I don't change temperature, but I just enable/disable heating or water tank heating. All what I do I login to I do get cookie string from In your case I would look for same request, try to sniff login, get cookie and then try to update as needed your setting. Keep in mind, logout is mandatory, otherwise your smart cloud adapter will hang up and will become unresponsive. I run this script with arguments:
like check more details for my code, part for sending telegram message can be omitted:
|
@os11k yeah, thanks for sharing that. I used a slightly different approach import requests
import json
def get_user_token(username, password):
url = "https://accsmart.panasonic.com/auth/login"
headers = {
"X-APP-TYPE": "1",
"X-APP-VERSION": "1.19.0",
"X-APP-TIMESTAMP": "1",
"X-APP-NAME": "Comfort Cloud",
"X-CFC-API-KEY": "Comfort Cloud",
"User-Agent": "G-RAC",
"Accept": "application/json; charset=utf-8",
"Content-Type": "application/json; charset=utf-8"
}
data = {
"language": 0,
"loginId": username,
"password": password
}
response = requests.post(url, headers=headers, json=data)
return json.loads(response.text)['uToken']
def get_idp_token(userToken):
url = "https://accsmart.panasonic.com/auth/idpToken"
headers = {
"X-APP-TYPE": "1",
"X-APP-VERSION": "1.19.0",
"X-User-Authorization": userToken,
"X-APP-TIMESTAMP": "1",
"X-APP-NAME": "Comfort Cloud",
"X-CFC-API-KEY": "Comfort Cloud",
"User-Agent": "G-RAC",
"Accept": "application/json; charset=utf-8",
"Content-Type": "application/json; charset=utf-8",
}
response = requests.get(url, headers=headers)
return json.loads(response.text)['idpToken']
def get_session_cookies(idpToken, gwid):
url = "https://aquarea-smart.panasonic.com/"
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "aquarea-smart.panasonic.com",
"User-Agent": "G-RAC",
"X-Requested-With": "com.panasonic.ACCsmart"
}
data = {
"X-Authorization": idpToken,
"cfcLoginMode": "1",
"gwid": gwid
}
response = requests.post(url, headers=headers, data=data)
return response.cookies
def set_temperature(cookies):
device_guid = cookies.get('selectedDeviceId', None)
url = f"https://aquarea-smart.panasonic.com/remote/v1/api/devices/{device_guid}"
headers = {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Type": "application/json",
"Host": "aquarea-smart.panasonic.com",
"Origin": "https://aquarea-smart.panasonic.com",
"Referer": "https://aquarea-smart.panasonic.com/remote/a2wControl",
"User-Agent": "G-RAC",
"X-Requested-With": "XMLHttpRequest"
}
headers["Cookie"] = "; ".join([f"{cookie.name}={cookie.value}" for cookie in cookies])
data = {
"status": [
{
"deviceGuid": device_guid,
"tankStatus": [
{
"heatSet": 45
}
]
}
]
}
response = requests.post(url, headers=headers, json=data)
return response
if __name__ == "__main__":
user_email = "***"
user_password = "***"
device_guid = "***"
user_token = get_user_token(user_email, user_password)
idp_token = get_idp_token(user_token)
cookies = get_session_cookies(idp_token, device_guid)
set_temperature(cookies) I find this a nice approach, as it mirrors the one used in version 1.19.0 of the Comfort Cloud app. Obviously, the same approach could be used for other settings or to retrieve data from the Aquarea. One important consideration is to minimize the frequency of calls to get_user_token, as it may lead to server blockages. Following the existing approach in this library is advisable: store the token and only recreate it when it has expired.
Tbh, I never experienced that. I never did a log-out but my adapter still remained responsive. Now it would be awesome to integrate that on this library. |
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
print(session.get_device(devices[0]['id']))
File "C:\Program Files\Python310\lib\site-packages\pcomfortcloud\session.py", line 273, in get_device
raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 403 - Data: {"message":"Have no authority to the request","code":4300}
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
The text was updated successfully, but these errors were encountered: