sabinus52 / jeedom-smartlife

Plugin Jeedom pour la gestion des objets connectés Smart Life / Tuya
GNU General Public License v2.0
10 stars 5 forks source link

Connection Issue #81

Closed vlefort closed 1 year ago

vlefort commented 1 year ago

Hi, I'm trying to use your plugin to control my climate.

When trying the connection I obtain this error message :

image

But this curl, replacing LOGIN & PASSWORD but the same credentials works . curl -v -X POST -k -H 'Content-Type: application/x-www-form-urlencoded' -i 'https://px1.tuyaus.com/homeassistant/auth.do' --data 'userName=LOGIN&password=PASSWORD&countryCode=33&bizType=smart_life&from=tuya'

{"access_token":"XXXX","refresh_token":"XXX","token_type":"bearer","expires_in":864000}

The logs in debug :

[2022-12-05 12:41:48]INFO :  CHECK CONNECTION : === BEGIN ===================================================
[2022-12-05 12:41:48]DEBUG : NEW SESSION :  ()  - 5 s
[2022-12-05 12:41:48]ERROR : CHECK CONNECTION : Get accesstoken failed. Invalid parms.
[2022-12-05 12:41:48]DEBUG : CHECK CONNECTION : Exception Object (     [message:protected] => Get accesstoken failed. Invalid parms.     [string:Exception:private] =>      [code:protected] => 0     [file:protected] => /var/www/html/plugins/SmartLife/vendor/sabinus52/tuyacloudapi/src/Session/Session.php     [line:protected] => 224     [trace:Exception:private] => Array         (             [0] => Array                 (                     [file] => /var/www/html/plugins/SmartLife/vendor/sabinus52/tuyacloudapi/src/Session/Session.php                     [line] => 176                     [function] => checkResponse                     [class] => Sabinus\TuyaCloudApi\Session\Session                     [type] => ->                     [args] => Array                         (                             [0] => Array                                 (                                     [responseStatus] => error                                     [errorMsg] => Get accesstoken failed. Invalid parms.                                 )                              [1] => Get accesstoken failed. Invalid parms.                         )                  )              [1] => Array                 (                     [file] => /var/www/html/plugins/SmartLife/vendor/sabinus52/tuyacloudapi/src/Session/Session.php                     [line] => 117                     [function] => _createToken                     [class] => Sabinus\TuyaCloudApi\Session\Session                     [type] => ->                     [args] => Array                         (                         )                  )              [2] => Array                 (                     [file] => /var/www/html/plugins/SmartLife/vendor/sabinus52/tuyacloudapi/src/TuyaCloudApi.php                     [line] => 62                     [function] => getToken                     [class] => Sabinus\TuyaCloudApi\Session\Session                     [type] => ->                     [args] => Array                         (                         )                  )              [3] => Array                 (                     [file] => /var/www/html/plugins/SmartLife/core/class/SmartLife.class.php                     [line] => 81                     [function] => checkConnection                     [class] => Sabinus\TuyaCloudApi\TuyaCloudApi                     [type] => ->                     [args] => Array                         (                         )                  )              [4] => Array                 (                     [file] => /var/www/html/plugins/SmartLife/core/ajax/SmartLife.ajax.php                     [line] => 34                     [function] => checkConnection                     [class] => SmartLife                     [type] => ::                     [args] => Array                         (                         )                  )          )      [previous:Exception:private] =>  )
[2022-12-05 12:41:48]INFO :  CHECK CONNECTION : === END =====================================================

Any solution ?

sabinus52 commented 1 year ago

Bonjour,

Il faut sauvegarder les paramètres avant de faire le test de connexion.