WebSocket connection Error(invalid_grant)

Bonjour à tous,

Je viens d’équiper notre maison de vacances d’un alarme Somfy Home Alarm Plus Integral. Elle est installée et tout fonctionne à distance avec l’application Somfy protect.
Afin d’en contrôler l’état à distance, je voulais la connecter sur le Jeedom de ma résidence principale.

[2022-07-25 09:04:50.741]DEBUG : https://sso.myfox.io:443 "POST /oauth/oauth/v2/token HTTP/1.1" 400 None
[2022-07-25 09:04:50.745]DEBUG : Request to fetch token completed with status 400.
[2022-07-25 09:04:50.746]DEBUG : Request url was https://sso.myfox.io/oauth/oauth/v2/token
[2022-07-25 09:04:50.747]DEBUG : Request headers were {'User-Agent': 'Somfy Protect', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'Content-Length': '242'}
[2022-07-25 09:04:50.748]DEBUG : Request body was grant_type=password&client_id=#MONID#&client_secret=#MONSECRET#&username=#MONEMAIL#&password=#MONPASSWORD#
[2022-07-25 09:04:50.748]DEBUG : Response headers were {'Date': 'Mon, 25 Jul 2022 07:04:50 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Server': 'openresty', 'Cache-Control': 'max-age=0, must-revalidate, private', 'Expires': 'Mon, 25 Jul 2022 07:04:50 GMT'} and content {"message":"error.too_many_failed_attempts","data":[],"uid":"62de4092adb6c"}.
[2022-07-25 09:04:50.749]DEBUG : Invoking 0 token response hooks.
[2022-07-25 09:04:50.749]ERROR : WebSocket connection Error(missing_token) Missing access token parameter.
[2022-07-25 09:04:50.749]INFO : Trying to reconnect in 25 seconds
[2022-07-25 09:05:15.772]INFO : Starting websocket
[2022-07-25 09:05:15.775]DEBUG : Obtention d'un nouveau token à partir du démon
[2022-07-25 09:05:15.777]DEBUG : Requesting url https://sso.myfox.io/oauth/oauth/v2/token using method POST.
[2022-07-25 09:05:15.778]DEBUG : Supplying headers {'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'} and data {'grant_type': 'password', 'client_id': '#MONID#', 'client_secret': '#MONSECRET#', 'username': '#MONEMAIL#', 'password': '#MONPASSWORD#'}
[2022-07-25 09:05:15.779]DEBUG : Passing through key word arguments {'timeout': None, 'auth': None, 'verify': False, 'proxies': None, 'cert': None}.
[2022-07-25 09:05:15.785]DEBUG : Starting new HTTPS connection (1): sso.myfox.io:443
/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py:1052: InsecureRequestWarning: Unverified HTTPS request is being made to host 'sso.myfox.io'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
InsecureRequestWarning,
[2022-07-25 09:05:16.013]DEBUG : https://sso.myfox.io:443 "POST /oauth/oauth/v2/token HTTP/1.1" 400 None
[2022-07-25 09:05:16.014]DEBUG : Request to fetch token completed with status 400.
[2022-07-25 09:05:16.014]DEBUG : Request url was https://sso.myfox.io/oauth/oauth/v2/token
[2022-07-25 09:05:16.015]DEBUG : Request headers were {'User-Agent': 'Somfy Protect', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', 'Content-Length': '242'}
[2022-07-25 09:05:16.015]DEBUG : Request body was grant_type=password&client_id=#MONID#&client_secret=#MONSECRET#&username=#MONEMAIL#&password=#MONPASSWORD#
[2022-07-25 09:05:16.015]DEBUG : Response headers were {'Date': 'Mon, 25 Jul 2022 07:05:15 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Server': 'openresty', 'Cache-Control': 'max-age=0, must-revalidate, private', 'Expires': 'Mon, 25 Jul 2022 07:05:15 GMT'} and content {"message":"error.too_many_failed_attempts","data":[],"uid":"62de40abf0b8b"}.
[2022-07-25 09:05:16.015]DEBUG : Invoking 0 token response hooks.
[2022-07-25 09:05:16.016]ERROR : WebSocket connection Error(missing_token) Missing access token parameter.
[2022-07-25 09:05:16.016]INFO : Trying to reconnect in 30 seconds

J’ai testé le plugin en version stable et beta. J’ai essayé de desinstaller le plugin puis réinstaller. Le dépendances ont été refaite à chaque changement.
Pour le log, le plugin est en Version 2022-07-02 13:28:18

Dans le log des dépendance,s il n’y pas d’erreur.
Merci d’avance pour votre aide !

Bonjour,

De mon côté, j’ai beaucoup d’erreur « Websocket » également, bien que le plugin soit fonctionnel :

0000|[2022-07-23 12:55:29.784]ERROR : Error in the websocket connection: ping/pong timed out
0001|[2022-07-23 12:56:07.829]ERROR : Error in the websocket connection: [Errno -3] Temporary failure in name resolution
0002|[2022-07-23 12:56:47.869]ERROR : Error in the websocket connection: [Errno -3] Temporary failure in name resolution
0003|[2022-07-23 12:57:32.917]ERROR : Error in the websocket connection: [Errno -3] Temporary failure in name resolution
0004|[2022-07-23 12:58:22.969]ERROR : Error in the websocket connection: [Errno -3] Temporary failure in name resolution
0005|[2022-07-23 14:59:08.268]ERROR : Error in the websocket connection: Connection to remote host was lost.
0006|[2022-07-23 19:18:15.667]ERROR : Error in the websocket connection: Connection to remote host was lost.
0007|[2022-07-23 19:18:15.669]ERROR : Cannot reconnect to the server after 10 retries, something must be wrong
0008|[2022-07-24 09:00:20.182]ERROR : Error in the websocket connection: Connection to remote host was lost.
0009|/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py:1050: InsecureRequestWarning: Unverified HTTPS request is being made to host 'sso.myfox.io'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
0010|InsecureRequestWarning,
0011|[2022-07-24 12:24:32.163]ERROR : Error in the websocket connection: Connection to remote host was lost.

Apparemment de ton côté ça ne fonctionne pas du tout ? J’espère que @Liniaal repassera par là bientôt.

Bonjour,

Pour ton soucis @fredlamour, tu as bien réussi à synchroniser tes équipements? Si oui, est-ce que tu as des caractères spéciaux dans ton mot de passe? Quelqu’un m’avait remonté le soucis mais avait changé son mot de passe, et je n’ai finalement pas creusé, ce sera peut être l’occasion du coup :sweat_smile:

Pour les erreurs « failures in name resolution », je ne les ai jamais comprises, je les ai aussi, c’est d’ailleurs pour ça que je fais un re-connect automatique dans le démon.

1 « J'aime »

Bonjour Liniaal,

En effet j’ai des caractères spéciaux dans le mot de passe.
Par contre, je viens de voir que les équipements remontent bien mais toujours autant d’erreurs dans les logs. Cela semble aléatoire dans la remontée d’information.