sdamasoc / domoticz_panasonic_CZ-TACG1

A Python plugin for Domoticz to communicate with Panasonic Cloud Confort throught CZ-TACG1 WiFi adapter
MIT License
8 stars 2 forks source link

Error getting data #5

Closed MikeZMssl closed 2 years ago

MikeZMssl commented 2 years ago

Hi Sergio,

Although all worked for quite a while, got some errors lately Working on domoticz version 2022.01 build hash c956851b running via docker. Have installed requests and simplejson

Any thoughts on what might go wrong?

Many thanks in advance!

2022-07-17 17:26:48.031 Error: Airco: 'onHeartbeat' failed 'JSONDecodeError':'Expecting value: line 1 column 1 (char 0)'. 2022-07-17 17:26:48.031 Error: Airco: Exception traceback: 2022-07-17 17:26:48.031 Error: Airco: ----> Line 283 in '/config/plugins/domoticz_panasonic_CZ-TACG1/plugin.py' 2022-07-17 17:26:48.031 Error: Airco: ----> Line 199 in '/config/plugins/domoticz_panasonic_CZ-TACG1/plugin.py' 2022-07-17 17:26:48.031 Error: Airco: ----> Line 353 in '/config/plugins/domoticz_panasonic_CZ-TACG1/plugin.py' 2022-07-17 17:26:48.031 Error: Airco: ----> Line 357 in '/usr/lib/python3.8/json/init.py' 2022-07-17 17:26:48.032 Error: Airco: ----> Line 337 in '/usr/lib/python3.8/json/decoder.py' 2022-07-17 17:26:48.032 Error: Airco: ----> Line 355 in '/usr/lib/python3.8/json/decoder.py' 2022-07-17 17:26:58.118 Error: Airco: 'onHeartbeat' failed 'JSONDecodeError':'Expecting value: line 1 column 1 (char 0)'. 2022-07-17 17:26:58.118 Error: Airco: Exception traceback: 2022-07-17 17:26:58.118 Error: Airco: ----> Line 283 in '/config/plugins/domoticz_panasonic_CZ-TACG1/plugin.py' 2022-07-17 17:26:58.118 Error: Airco: ----> Line 199 in '/config/plugins/domoticz_panasonic_CZ-TACG1/plugin.py' 2022-07-17 17:26:58.118 Error: Airco: ----> Line 353 in '/config/plugins/domoticz_panasonic_CZ-TACG1/plugin.py' 2022-07-17 17:26:58.118 Error: Airco: ----> Line 357 in '/usr/lib/python3.8/json/init.py' 2022-07-17 17:26:58.118 Error: Airco: ----> Line 337 in '/usr/lib/python3.8/json/decoder.py' 2022-07-17 17:26:58.118 Error: Airco: ----> Line 355 in '/usr/lib/python3.8/json/decoder.py'

JoostdeJonge123 commented 2 years ago

Hi Sergio, Here the same error since a couple of days, any ideas? Thx

curl -v 'https://accsmart.panasonic.com/auth/login' -s --http1.1 -X POST --no-alpn --no-npn --header 'Accept: application/json; charset=UTF-8' - -header 'Content-Type: application/json' --header 'X-APP-TYPE: 0' --header 'X-AP P-VERSION: 1.20.0' --header 'User-Agent: G-RAC' --data-raw '{ "loginId": "yyyy", "language": 0, "password": "xxxxx" }'

Egregius commented 2 years ago

trying to use this script for a friend but also receive the 403 Forbidden error in the logfile. Did panasonic change there authentication or server address?

sdamasoc commented 2 years ago

I have no problem with my installation. I was on holiday, I will take a look ASAP.

sdamasoc commented 2 years ago

Can you try to execute the follow command to get a token: curl 'https://accsmart.panasonic.com/auth/login/' -s --http1.1 -X POST --no-alpn --no-npn --header 'Accept: application/json; charset=UTF-8' --header 'Content-Type: application/json' --header 'X-APP-TYPE: 0' --header 'X-APP-VERSION: 1.15.1' --header 'User-Agent: G-RAC' --data-raw '{ "loginId": "<EMAIL>", "language": 0, "password": "<PASSWORD>" }' Replace <EMAIL> and <PASSWORD> with your credentials. Ensure that you use the X-APP-VERSION 1.15.1 (last version of confort cloud app). Also try to login at least once with the app to ensure that you accept the panasonic licence.

Egregius commented 2 years ago

That seems to work: {"result":0,"uToken":"FjHaZWdSZCF3beM657gn7zjlBUzJNchs","country":"BE","extUsrId":"UDeQrwCoprBDExJMRzPsFRTofjESJaFt","clientId":"0X2yVtrukiZFngzaEQcHO8Zb3CL74xBb","language":0}

However, with the same credentials and app version in domoticz:

`2022-08-01 12:20:22.410 Status: Python Plugin System: (PanasonicAirco) Entering work loop. 2022-08-01 12:20:22.410 Status: Python Plugin System: (PanasonicAirco) Initialized version 1.1.0, author 'sdamasoc' 2022-08-01 12:20:22.411 Python Plugin System: (PanasonicAirco) Debug logging mask set to: PYTHON 2022-08-01 12:20:23.368 Python Plugin System: (PanasonicAirco) getDevices=

403 Forbidden

403 Forbidden

2022-08-01 12:20:23.368 Error: Python Plugin System: (PanasonicAirco) 'onStart' failed 'JSONDecodeError'. 2022-08-01 12:20:23.368 Error: Python Plugin System: (PanasonicAirco) ----> Line 248 in '/temp/domoticz/plugins/domoticz_panasonic_CZ-TACG1/plugin.py' 2022-08-01 12:20:23.368 Error: Python Plugin System: (PanasonicAirco) ----> Line 71 in '/temp/domoticz/plugins/domoticz_panasonic_CZ-TACG1/plugin.py' 2022-08-01 12:20:23.368 Error: Python Plugin System: (PanasonicAirco) ----> Line 329 in '/temp/domoticz/plugins/domoticz_panasonic_CZ-TACG1/plugin.py' 2022-08-01 12:20:23.368 Error: Python Plugin System: (PanasonicAirco) ----> Line 346 in '/usr/lib/python3.9/json/init.py' 2022-08-01 12:20:23.368 Error: Python Plugin System: (PanasonicAirco) ----> Line 337 in '/usr/lib/python3.9/json/decoder.py' 2022-08-01 12:20:23.368 Error: Python Plugin System: (PanasonicAirco) ----> Line 355 in '/usr/lib/python3.9/json/decoder.py'`

sdamasoc commented 2 years ago

Ok, your problem seems to come from the getDevices method.

Can you try the follow command to get the device list: curl -s --location --request GET 'https://accsmart.panasonic.com/device/group/' --header 'Accept: application/json; charset=UTF-8' --header 'Content-Type: application/json' --header 'X-APP-TYPE: 0' --header 'X-APP-VERSION: 1.15.1' --header "X-User-Authorization: <TOKEN>" --header 'User-Agent: G-RAC' --data-raw '' And replace <TOKEN> with a fresh token.

Egregius commented 2 years ago

That also seems to work: {"iaqStatus":{"statusCode":200},"uiFlg":false,"groupCount":1,"groupList":[{"groupId":852541,"groupName":"My House","deviceList":[{"deviceGuid":"CS-TZ42WKEW+4758609730","deviceType":"3","deviceName":"Living","permission":3,"deviceModuleNumber":"CS-TZ42WKEW","deviceHashGuid":"4d789feb3218a9fd4a463702b6f9299ce55cfaa74c91b118f8168440f084f19c","summerHouse":0,"iAutoX":false,"nanoe":false,"nanoeStandAlone":false,"autoMode":true,"heatMode":true,"fanMode":false,"dryMode":true,"coolMode":true,"ecoNavi":false,"powerfulMode":true,"quietMode":true,"airSwingLR":true,"autoSwingUD":false,"ecoFunction":0,"temperatureUnit":0,"modeAvlList":{"autoMode":1,"fanMode":1},"coordinableFlg":false,"parameters":{"operate":0,"operationMode":2,"temperatureSet":20.0,"fanSpeed":0,"fanAutoMode":3,"airSwingLR":2,"airSwingUD":3,"ecoMode":2,"ecoNavi":0,"nanoe":0,"iAuto":0,"actualNanoe":0,"airDirection":1,"ecoFunctionData":0,"lastSettingMode":0}},{"deviceGuid":"CS-MTZ16WKE+4426118311","deviceType":"3","deviceName":"Slaapkamer ","permission":3,"deviceModuleNumber":"CS-MTZ16WKE","deviceHashGuid":"1c99aa9abfc98d5fd94140a712d67db3a3a3e4e62d6805f9c994f05e750b4fbb","summerHouse":0,"iAutoX":false,"nanoe":false,"nanoeStandAlone":false,"autoMode":true,"heatMode":true,"fanMode":false,"dryMode":true,"coolMode":true,"ecoNavi":false,"powerfulMode":true,"quietMode":true,"airSwingLR":true,"autoSwingUD":false,"ecoFunction":0,"temperatureUnit":0,"modeAvlList":{"autoMode":1,"fanMode":1},"coordinableFlg":false,"parameters":{"operate":0,"operationMode":2,"temperatureSet":18.0,"fanSpeed":0,"fanAutoMode":1,"airSwingLR":6,"airSwingUD":0,"ecoMode":0,"ecoNavi":0,"nanoe":0,"iAuto":0,"actualNanoe":0,"airDirection":1,"ecoFunctionData":0,"lastSettingMode":0}},{"deviceGuid":"CS-MTZ16WKE+4426118330","deviceType":"3","deviceName":"Bureau ","permission":3,"deviceModuleNumber":"CS-MTZ16WKE","deviceHashGuid":"886202dc95f1964a3e8c14678f980ef45bcb94bb0d01c718c9b2d6d080af4237","summerHouse":0,"iAutoX":false,"nanoe":false,"nanoeStandAlone":false,"autoMode":true,"heatMode":true,"fanMode":false,"dryMode":true,"coolMode":true,"ecoNavi":false,"powerfulMode":true,"quietMode":true,"airSwingLR":true,"autoSwingUD":false,"ecoFunction":0,"temperatureUnit":0,"modeAvlList":{"autoMode":1,"fanMode":1},"coordinableFlg":false,"parameters":{"operate":0,"operationMode":2,"temperatureSet":18.0,"fanSpeed":0,"fanAutoMode":1,"airSwingLR":6,"airSwingUD":0,"ecoMode":2,"ecoNavi":0,"nanoe":0,"iAuto":0,"actualNanoe":0,"airDirection":1,"ecoFunctionData":0,"lastSettingMode":0}}]}]}%

sdamasoc commented 2 years ago

I made a fix on the headers sent by the plugin. Can you pull the changes and test it on domoticz?

sdamasoc commented 2 years ago

Also, be sure to use 1.15.1 in API version parameter

Egregius commented 2 years ago

Thank you, this is working! 24 devices created in domoticz.

Egregius commented 2 years ago

Also, be sure to use 1.15.1 in API version parameter

Does this mean that for every update of the app I need to change this number in domoticz? How can we find the latest number?

sdamasoc commented 2 years ago

I found on the internet that we can use a version greater than the current version to avoid to update it every time they release a new version (ex: 1.20.0)

To know the version I look for it in the App Store on my phone when I execute the Confort Cloud app updates.

sdamasoc commented 2 years ago

@MikeZMssl and @JoostdeJonge123 does this new code also fix your issues?

JoostdeJonge123 commented 2 years ago

Hi Sergio,

I cannot check, because I am on holiday. I will check when I am back home.

Regards, Joost

-------- Oorspronkelijk bericht -------- Van: Sergio @.> Datum: 01-08-2022 19:47 (GMT+01:00) Aan: sdamasoc/domoticz_panasonic_CZ-TACG1 @.> Cc: JoostdeJonge123 @.>, Mention @.> Onderwerp: Re: [sdamasoc/domoticz_panasonic_CZ-TACG1] Error getting data (Issue #5)

@MikeZMsslhttps://github.com/MikeZMssl and @JoostdeJonge123https://github.com/JoostdeJonge123 does this new code also fix your issues?

— Reply to this email directly, view it on GitHubhttps://github.com/sdamasoc/domoticz_panasonic_CZ-TACG1/issues/5#issuecomment-1201518728, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZWN5DCRE22EDLMM6C6HINTVXAEQXANCNFSM53Z5Q4HQ. You are receiving this because you were mentioned.Message ID: @.***>

-- Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. https://www.avast.com/antivirus

MikeZMssl commented 2 years ago

Hi Sergio,

Will check after my holiday ! :)


From: Sergio @.> Sent: Monday, August 1, 2022 7:46:51 PM To: sdamasoc/domoticz_panasonic_CZ-TACG1 @.> Cc: MikeZMssl @.>; Mention @.> Subject: Re: [sdamasoc/domoticz_panasonic_CZ-TACG1] Error getting data (Issue #5)

@MikeZMsslhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMikeZMssl&data=05%7C01%7C%7C731c2dc531b24b35495408da73e5d176%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637949728136108606%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=AmSGZBLzjCDhgPgFVcaCQmCD%2FI69FHSIwAGfMxhEOU4%3D&reserved=0 and @JoostdeJonge123https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FJoostdeJonge123&data=05%7C01%7C%7C731c2dc531b24b35495408da73e5d176%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637949728136108606%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=AAp7ZIk%2FPMlnFqnUcovUJprE%2Bbgzihq9bl9UQYCXrGo%3D&reserved=0 does this new code also fix your issues?

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsdamasoc%2Fdomoticz_panasonic_CZ-TACG1%2Fissues%2F5%23issuecomment-1201518728&data=05%7C01%7C%7C731c2dc531b24b35495408da73e5d176%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637949728136108606%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WL3T8JmnBinHsg%2FhY9dmZYqiwYbPwF%2B91%2BSEFEeRIl4%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAQMPJTCNLYXZO7GXS6RSMD3VXAEQXANCNFSM53Z5Q4HQ&data=05%7C01%7C%7C731c2dc531b24b35495408da73e5d176%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637949728136108606%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ycT6FpDFtEkXMUlmdw99s7akGafqh6CsCD5cUaBTO7Q%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

sdamasoc commented 2 years ago

Ok, have a good holiday and please feel free to reopen the issue if the problem is still present.

JoostdeJonge123 commented 2 years ago

Back from holidays… problem seems to be fixed! Thanks.

Regards, Joost

From: Sergio @.*** Sent: maandag 1 augustus 2022 20:36 To: sdamasoc/domoticz_panasonic_CZ-TACG1 Cc: JoostdeJonge123; Mention Subject: Re: [sdamasoc/domoticz_panasonic_CZ-TACG1] Error getting data (Issue #5)

Closed #5https://github.com/sdamasoc/domoticz_panasonic_CZ-TACG1/issues/5 as completed.

— Reply to this email directly, view it on GitHubhttps://github.com/sdamasoc/domoticz_panasonic_CZ-TACG1/issues/5#event-7103936911, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZWN5DDZQTEUHDLZ6GS2VSTVXAKKFANCNFSM53Z5Q4HQ. You are receiving this because you were mentioned.Message ID: @.***>

-- Dit e-mailbericht is gecontroleerd op virussen met Avast antivirussoftware. https://www.avast.com/antivirus

MikeZMssl commented 2 years ago

@sdamasoc

Hi Sergio, I am afraid I am struggling. Maybe to do with domoticz running from containers ? I have checked the versionno and set it correct in domoticz

Are you also using IP adres "https://accsmart.panasonic.com"

2022-08-25 19:23:48.143 Error: Airco: 'onHeartbeat' failed 'KeyError':'('uToken',)'. 2022-08-25 19:23:48.143 Error: Airco: Exception traceback: 2022-08-25 19:23:48.143 Error: Airco: ----> Line 283 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:48.143 Error: Airco: ----> Line 199 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:48.143 Error: Airco: ----> Line 350 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:48.143 Error: Airco: ----> Line 306 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:58.091 Error: Airco: 'onHeartbeat' failed 'KeyError':'('uToken',)'. 2022-08-25 19:23:58.092 Error: Airco: Exception traceback: 2022-08-25 19:23:58.092 Error: Airco: ----> Line 283 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:58.092 Error: Airco: ----> Line 199 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:58.092 Error: Airco: ----> Line 350 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:58.092 Error: Airco: ----> Line 306 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py'

sdamasoc commented 2 years ago

It seems you cannot get a token, just before the exception do you have a token in the logs (getToken=…)? You can also just use the Python script testPlugin,py (edit it to set your credentials) to check what’s going wrong.

Sergio

Le 25 août 2022 à 19:27, MikeZMssl @.***> a écrit :



Hi Sergio, I am afraid I am struggling. Maybe to do with domoticz running from containers ? I have checked the versionno and set it correct in domoticz

2022-08-25 19:23:48.143 Error: Airco: 'onHeartbeat' failed 'KeyError':'('uToken',)'. 2022-08-25 19:23:48.143 Error: Airco: Exception traceback: 2022-08-25 19:23:48.143 Error: Airco: ----> Line 283 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:48.143 Error: Airco: ----> Line 199 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:48.143 Error: Airco: ----> Line 350 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:48.143 Error: Airco: ----> Line 306 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:58.091 Error: Airco: 'onHeartbeat' failed 'KeyError':'('uToken',)'. 2022-08-25 19:23:58.092 Error: Airco: Exception traceback: 2022-08-25 19:23:58.092 Error: Airco: ----> Line 283 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:58.092 Error: Airco: ----> Line 199 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:58.092 Error: Airco: ----> Line 350 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 19:23:58.092 Error: Airco: ----> Line 306 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py'

— Reply to this email directly, view it on GitHubhttps://github.com/sdamasoc/domoticz_panasonic_CZ-TACG1/issues/5#issuecomment-1227559049, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACEWTDSEW4GRQLEUM44WHOLV26UGNANCNFSM53Z5Q4HQ. You are receiving this because you modified the open/close state.Message ID: @.***>

MikeZMssl commented 2 years ago

Hi Sergio,

The test script does work. I am working with domoticz version 2022.1 hash c9526851b ; Might that be different?

sdamasoc commented 2 years ago

The testScript just send python commands to the Panasonic api without using Domoticz, you need to edit the script to setup your credentials.

What I need to understand is the full log to see what the getToken method returns because the plug-in cannot find the key uToken in the JSON response.

Le 25 août 2022 à 20:52, MikeZMssl @.***> a écrit :



Hi Sergio,

The test script does work. I am working with domoticz version 2022.1 hash c9526851b ; Might that be different?

— Reply to this email directly, view it on GitHubhttps://github.com/sdamasoc/domoticz_panasonic_CZ-TACG1/issues/5#issuecomment-1227641344, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACEWTDWDCO6D3CZGLQTZZ2LV266IDANCNFSM53Z5Q4HQ. You are receiving this because you were mentioned.Message ID: @.***>

MikeZMssl commented 2 years ago

I understand, but where can I find this log ? All domoticz is logging is this :

2022-08-25 21:18:26.071 Airco: onHeartbeat started... 2022-08-25 21:18:26.071 Airco: interval since last update = 1661455106.0716205, update_interval = 60 2022-08-25 21:18:26.141 Status: Airco: Stop directive received. 2022-08-25 21:18:27.159 Airco: getDeviceById={"message":"Token expires","code":4100} 2022-08-25 21:18:28.187 Airco: getToken={"message":"New version app has been published","code":4106} 2022-08-25 21:18:28.190 Airco: onStop called 2022-08-25 21:18:28.270 Status: Airco: Exiting work loop. 2022-08-25 21:18:28.344 Status: Airco: Stopping threads. 2022-08-25 21:18:28.344 Status: Airco: Stopped. 2022-08-25 21:18:28.189 Error: Airco: 'onHeartbeat' failed 'KeyError':'('uToken',)'. 2022-08-25 21:18:28.189 Error: Airco: Exception traceback: 2022-08-25 21:18:28.190 Error: Airco: ----> Line 283 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 21:18:28.190 Error: Airco: ----> Line 199 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 21:18:28.190 Error: Airco: ----> Line 350 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py' 2022-08-25 21:18:28.190 Error: Airco: ----> Line 306 in '/config/plugins/domoticz_panasonic_CZ-TACG/plugin.py'

sdamasoc commented 2 years ago

That’s the log, we can see the error: getToken={"message":"New version app has been published","code":4106}

Go to the hardware configuration, click on the plug-in and set api version to: 1.15.1 (last version of Panasonic comfort cloud app) [image0.jpeg]

Le 25 août 2022 à 21:20, MikeZMssl @.***> a écrit :

getToken={"message":"New version app has been published","code":4106}

MikeZMssl commented 2 years ago

That indeed does help. Strange, cause my app version is 1.15.0 But since it is working : you are the best 👍

Many thanks :)