dkerr64 / homebridge-yolink

Apache License 2.0
12 stars 2 forks source link

Access Token #72

Closed FlightMedic376 closed 1 year ago

FlightMedic376 commented 1 year ago

Describe The Bug: In the homekit logs Yolink plugin continually prompts that "Current access token expired, or close to expiry, request new one"

To Reproduce: I have canceled and resigned a new access token. The plugin seems to be working; I don't know if there is a time limit on the access token.

Logs: [2/17/2023, 8:46:49 AM] [YoLink] YoLinkAPI.getDeviceState for Garage Door Controller (d88b4c0100059769) [2/17/2023, 8:46:49 AM] [YoLink] At 2/17/2023, 8:46:49 AM: Device state for Garage Door Controller (d88b4c0100059769) is: Garage Door or Finger: , rc: 1 [2/17/2023, 9:22:45 AM] [YoLink] At 2/17/2023, 9:16:30 AM: Device state for Garage Door Controller (d88b4c0100059769) is: Garage Door or Finger: , rc: 1 [2/17/2023, 10:06:42 AM] [YoLink] Current access token expired, or close to expiry, request new one [2/17/2023, 10:53:05 AM] [Ring] Reconnecting location socket.io connection [2/17/2023, 10:53:06 AM] [Ring] Creating location socket.io connection - Bellevue [2/17/2023, 10:53:07 AM] [Ring] Ring connected to socket.io server [2/17/2023, 12:00:42 PM] [YoLink] Current access token expired, or close to expiry, request new one [2/17/2023, 12:48:29 PM] [YoLink] YoLinkAPI.getDeviceState for Garage Door Controller (d88b4c0100059769) [2/17/2023, 12:48:30 PM] [YoLink] At 2/17/2023, 12:48:30 PM: Device state for Garage Door Controller (d88b4c0100059769) is: Garage Door or Finger: , rc: 1 [2/17/2023, 1:54:42 PM] [YoLink] Current access token expired, or close to expiry, request new one [2/17/2023, 2:36:58 PM] [YoLink] At 2/17/2023, 1:46:55 PM: Device state for Garage Door Controller (d88b4c0100059769) is: Garage Door or Finger: , rc: 1

Show the Homebridge logs here, remove any sensitive information.

Plugin Config:

{
    "bridge": {
        "name": "Homebridge E919",
        "username": "0E:61:C8:AE:C4:54",
        "port": 51022,
        "pin": "353-23-115",
        "advertiser": "bonjour-hap",
        "bind": [
            "bond0"
        ]
    },
    "accessories": [
        {
            "name": "Alarm Arm",
            "stateful": false,
            "reverse": false,
            "time": 5000,
            "random": false,
            "resettable": true,
            "disableLogging": false,
            "accessory": "DummySwitch"
        },
        {
            "name": "Alarm Disarm",
            "stateful": false,
            "reverse": false,
            "time": 5000,
            "random": false,
            "resettable": true,
            "disableLogging": false,
            "accessory": "DummySwitch"
        },
        {
            "name": "Alarm Home",
            "stateful": false,
            "reverse": false,
            "time": 5000,
            "random": false,
            "resettable": true,
            "disableLogging": false,
            "accessory": "DummySwitch"
        },
        {
            "name": "Door Lock",
            "stateful": false,
            "reverse": false,
            "time": 5000,
            "random": false,
            "resettable": true,
            "disableLogging": false,
            "accessory": "DummySwitch"
        },
        {
            "name": "Door Unlock",
            "stateful": false,
            "reverse": false,
            "time": 5000,
            "random": false,
            "resettable": true,
            "disableLogging": false,
            "accessory": "DummySwitch"
        }
    ],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "auth": "form",
            "theme": "auto",
            "tempUnits": "f",
            "lang": "auto",
            "platform": "config"
        },
        {
            "refreshToken": "
            "unbridgeCameras": true,
            "alarmOnEntryDelay": true,
            "hideLightGroups": true,
            "hideCameraLight": true,
            "hideCameraMotionSensor": true,
            "hideCameraSirenSwitch": true,
            "hideInHomeDoorbellSwitch": true,
            "hideAlarmSirenSwitch": true,
            "avoidSnapshotBatteryDrain": true,
            "hideDeviceIds": [
                "1f7b240f-91c9-4161-b1b9-01cd8e82faa8",
                "d3d60a19-fa97-42c2-bcf8-16a51695f47c",
                "bff9a42f-730a-4a9e-87eb-5d9499063049",
                "31be1c70-7056-4ebc-bbe8-b522c20a8c76",
                "13225b17-1709-4ca9-ab61-6aecae023a5d",
                "15845ac0-86ea-4fca-a59b-d0572053fea7",
                "2b48ce09-a985-4fed-8c52-24d4752eb419"
            ],
            "platform": "Ring"
        },
        {
            "name": "SwitchBot",
            "credentials": {
                "token": "
            },
            "options": {
                "devices": [
                    {
                        "deviceId": "EE9455243CEC",
                        "configDeviceName": "Building Door",
                        "hide_device": false,
                        "configDeviceType": "Bot",
                        "connectionType": "OpenAPI",
                        "bot": {
                            "mode": "press",
                            "deviceType": "door",
                            "allowPush": false,
                            "doublePress": 1
                        },
                        "refreshRate": 1500,
                        "external": true
                    }
                ],
                "refreshRate": 1500
            },
            "_bridge": {
                "username": "0E:ED:B6:1C:E3:6F",
                "port": 39720
            },
            "platform": "SwitchBot"
        },
        {
            "name": "YoLink",
            "platform": "YoLink",
            "tokenURL": "https://api.yosmart.com/open/yolink/token",
            "apiURL": "https://api.yosmart.com/open/yolink/v2/api",
            "mqttPort": 8003,
            "userAccessId": "ua_**",
            "secretKey": "sec_**",
            "refreshAfter": 14500,
            "verboseLog": false,
            "liteLog": true,
            "allDevices": true,
            "excludeTypes": [
                "Hub",
                "SpeakerHub"
            ],
            "enableExperimental": false,
            "garageDoors": [
                {
                    "controller": "d88b4c0100059769",
                    "sensor": "d88b4c0100058a5b",
                    "timeout": 15
                }
            ],
            "_bridge": {
                "username": "0E:4B:73:D5:3E:28",
                "port": 51979
            }
        }
    ]
}

Screenshots:

Environment:

dkerr64 commented 1 year ago

This is working as expected. The access token is valid for 2 hours. The plugin must request a new token at least every two hours. The plugin tries to do this shortly before the 2 hours is up so that it does not get an error when making a request just after two hours, so it always has a valid token. This activity is logged for informational purposes (reassurance that things are still working).