dkerr64 / homebridge-yolink

Apache License 2.0
12 stars 2 forks source link

Login to YoLink API with credentials from config doesn't work #60

Closed Gobastos closed 1 year ago

Gobastos commented 1 year ago

Describe The Bug: I'm always getting an error in the log file reporting problems logging into the yolink API using my credentials defined in my configuration. The credentials are correct as I am able to send CURL commands to the yolink API using these credentials without any problem.

I am been using this plugin for months without problems and I only noticed this today. I even tried to generate new credentials in the YOLINK APP but the problem remains with these new credentials..

Logs: 9/26/2022, 5:39:05 PMYolink BridgeYoLinkYoLink plugin for HomeBridge version 1.2.11 (c) 2022 David A. Kerr Please report all bugs at https://github.com/dkerr64/homebridge-yolink/issues 9/26/2022, 5:39:05 PMYolink BridgeYoLink[verbose] Loaded configuration: {"platform":"YoLink","name":"YoLink","tokenURL":https://api.yosmart.com/open/yolink/token,"apiURL":https://api.yosmart.com/open/yolink/v2/api,"mqttPort":8003,"userAccessId":"ua_C850FC82C3B3493D95883F1XXXXXXXXX”,"secretKey":"sec_v1_v68aBqbFkxk2nXXXXXXXXX==","refreshAfter":1800,"allDevices":true,"verboseLog":true,"devices":{"d88b4cYYYYYYYYYb":{"name":"Swimming Pool","refreshAfter":300,"hide":"hydro"},"d88b4cXXXXXXXXXb":{"hide":true,"refreshAfter":3600}},"liteLog":true,"excludeTypes":["Hub","SpeakerHub"],"includeTypes":[],"enableExperimental":false,"deviceTemperatures":false,"powerFailureSensorAs":"Outlet","version":"1.2.11","garageDoors":[]}9/26/2022, 5:39:05 PMYolink BridgeYoLink[verbose] YoLinkAPI.constructor9/26/2022, 5:39:05 PMYolink BridgeYoLink[verbose] Loading accessory from cache:Leak Sensor9/26/2022, 5:39:05 PMYolink BridgeYoLink[verbose] Loading accessory from cache:Leak Sensor9/26/2022, 5:39:05 PMYolink BridgeYoLink[verbose] Loading accessory from cache:Swimming Pool9/26/2022, 5:39:05 PMYolink BridgeYoLinkLogin to YoLink API with credentials from config9/26/2022, 5:39:05 PMYolink BridgeYoLink[verbose] SENDING: grant_type=client_credentials&client_id=ua_C850FC82C3B3493D95883F1XXXXXXXXX&client_secret=sec_v1_v68aBqbFkxk2nXXXXXXXXX%3D%3D9/26/2022, 5:39:05 PMYolink BridgeYoLinkRetry bound tryLogin due to error, try again in 5 second(s): request to https://api.yosmart.com/open/yolink/token failed, reason: getaddrinfo EAI_AGAIN api.yosmart.com [lite]9/26/2022, 5:39:10 PMYolink BridgeYoLinkLogin to YoLink API with credentials from config9/26/2022, 5:39:10 PMYolink BridgeYoLink[verbose] SENDING: grant_type=client_credentials&client_id=ua_C850FC82C3B3493D95883F1XXXXXXXXX&client_secret=sec_v1_v68aBqbFkxk2nXXXXXXXXX%3D%3D9/26/2022, 5:39:10 PMYolink BridgeYoLinkRetry bound tryLogin due to error, try again in 10 second(s): request to https://api.yosmart.com/open/yolink/token failed, reason: getaddrinfo EAI_AGAIN api.yosmart.com [lite]9/26/2022, 5:39:20 PMYolink BridgeYoLinkLogin to YoLink API with credentials from config9/26/2022, 5:39:20 PMYolink BridgeYoLink[verbose] SENDING: grant_type=client_credentials&client_id=ua_C850FC82C3B3493D95883F1XXXXXXXXX&client_secret=sec_v1_v68aBqbFkxk2nXXXXXXXXX%3D%3D9/26/2

Plugin Config:

{ "accessories": [], "platforms": [ { "platform": "YoLink", "name": "YoLink", "tokenURL": "https://api.yosmart.com/open/yolink/token", "apiURL": "https://api.yosmart.com/open/yolink/v2/api", "mqttPort": 8003, "userAccessId": "ua_C850FC82C3B3493D95883F1XXXXXXXXX ", "secretKey": "sec_v1_v68aBqbFkxk2nXXXXXXXXX==", "refreshAfter": 1800, "allDevices": true, "verboseLog": true, "devices": [ { "deviceId": "d88b4cYYYYYYYYYb", "config": { "name": "Swimming Pool", "refreshAfter": 300, "hide": "hydro" } }, { "deviceId": "d88b4cXXXXXXXXXb", "config": { "hide": true, "refreshAfter": 3600 } } ] } ] }

Environment:

dkerr64 commented 1 year ago

The error getaddrinfo EAI_AGAIN is coming from underlying network stack (node-fetch) and outside control of this plugin. Googling for that error and it appears to be a problem with the DNS server responding that it cannot fulfill the request to resolve api.yosmart.com

Feels like a temporary network problem that should resolve itself?

David

Gobastos commented 1 year ago

Many Thanks David Indeed the problem was not related to the plug-in. Probably this was due to an update of one of the homebridge components that caused this. I had to reinstall everything from scratch (homebridge and all plugins) in order to get this solved. Best Regards, Guilherme

dkerr64 commented 1 year ago

Thanks for reporting back and closing the issue.