Support Request: API calls from Homebridge Switchbot platform for Bot frequently return 'Failed to connect device, try again'
### Describe Your Problem

Calls to Switchbot's API succeeds but Bot only works sporadically, showing 'Failed to connect device, try again' in the logs from the Switchbot app; using a Switchbot Hub with Cloud Services enabled on all devices

### Relevant log output

```shell
Example of the Homebridge log when it fails:

[10/14/2023, 12:13:12 AM] [SwitchBot] Bot: Kitchen Lights Set On: true
[10/14/2023, 12:13:12 AM] [SwitchBot] Bot: Kitchen Lights openAPIpushChanges
[10/14/2023, 12:13:12 AM] [SwitchBot] Bot: Kitchen Lights No openAPIpushChanges.On: true, OnCached: true
[10/14/2023, 12:13:19 AM] [SwitchBot] Bot: Kitchen Lights openAPIRefreshStatus
[10/14/2023, 12:13:19 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights body: {"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":{"head":{"data":{"type":"Buffer","data":[123,34,115,116,97,116,117,115,67,111,100,101,34,58,49,48,48,44,34,98,111,100,121,34,58,123,34,100,101,118,105,99,101,73,100,34,58,34,70,57,57,52,67,51,65,49,65,54,67,69,34,44,34,100,101,118,105,99,101,84,121,112,101,34,58,34,66,111,116,34,44,34,104,117,98,68,101,118,105,99,101,73,100,34,58,34,67,51,65,53,55,68,55,52,56,48,48,56,34,44,34,118,101,114,115,105,111,110,34,58,34,86,54,46,52,34,44,34,112,111,119,101,114,34,58,34,111,102,102,34,44,34,98,97,116,116,101,114,121,34,58,49,57,44,34,100,101,118,105,99,101,77,111,100,101,34,58,34,115,119,105,116,99,104,77,111,100,101,34,125,44,34,109,101,115,115,97,103,101,34,58,34,115,117,99,99,101,115,115,34,125]},"next":null},"tail":{"data":{"type":"Buffer","data":[123,34,115,116,97,116,117,115,67,111,100,101,34,58,49,48,48,44,34,98,111,100,121,34,58,123,34,100,101,118,105,99,101,73,100,34,58,34,70,57,57,52,67,51,65,49,65,54,67,69,34,44,34,100,101,118,105,99,101,84,121,112,101,34,58,34,66,111,116,34,44,34,104,117,98,68,101,118,105,99,101,73,100,34,58,34,67,51,65,53,55,68,55,52,56,48,48,56,34,44,34,118,101,114,115,105,111,110,34,58,34,86,54,46,52,34,44,34,112,111,119,101,114,34,58,34,111,102,102,34,44,34,98,97,116,116,101,114,121,34,58,49,57,44,34,100,101,118,105,99,101,77,111,100,101,34,58,34,115,119,105,116,99,104,77,111,100,101,34,125,44,34,109,101,115,115,97,103,101,34,58,34,115,117,99,99,101,115,115,34,125]},"next":null},"length":1},"length":191,"pipes":[],"flowing":null,"ended":true,"endEmitted":false,"reading":false,"constructed":true,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"errorEmitted":false,"emitClose":true,"autoDestroy":true,"destroyed":false,"errored":null,"closed":false,"closeEmitted":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"dataEmitted":false,"decoder":null,"encoding":null},"_events":{},"_eventsCount":0}
[10/14/2023, 12:13:19 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights statusCode: 200
[10/14/2023, 12:13:19 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights headers: {"date":"Sat, 14 Oct 2023 04:13:19 GMT","content-type":"application/json","content-length":"191","connection":"keep-alive","x-amzn-requestid":"2c4b0786-971d-4e15-ae8c-a99e673702d3","x-amz-apigw-id":"MxhG_ESuIAMEbxg=","x-amzn-trace-id":"Root=1-652a155f-3990dd500bf13aea5bcc360c;Sampled=0;lineage=bf95bacf:0"}
[10/14/2023, 12:13:19 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights deviceStatus: {"statusCode":100,"body":{"deviceId":"F994C3A1A6CE","deviceType":"Bot","hubDeviceId":"C3A57D748008","version":"V6.4","power":"off","battery":19,"deviceMode":"switchMode"},"message":"success"}
[10/14/2023, 12:13:19 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights deviceStatus body: {"deviceId":"F994C3A1A6CE","deviceType":"Bot","hubDeviceId":"C3A57D748008","version":"V6.4","power":"off","battery":19,"deviceMode":"switchMode"}
[10/14/2023, 12:13:19 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights deviceStatus statusCode: 100
[10/14/2023, 12:13:19 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights statusCode: 200 & deviceStatus StatusCode: 100
[10/14/2023, 12:13:19 AM] [SwitchBot] Bot: Kitchen Lights openAPIparseStatus
[10/14/2023, 12:13:19 AM] [SwitchBot] Bot: Kitchen Lights On: true
[10/14/2023, 12:13:19 AM] [SwitchBot] Bot: Kitchen Lights BatteryLevel: 19, StatusLowBattery: 0
[10/14/2023, 12:13:19 AM] [SwitchBot] Bot: Kitchen Lights updateCharacteristic On: true
[10/14/2023, 12:13:19 AM] [SwitchBot] Bot: Kitchen Lights updateCharacteristic BatteryLevel: 19
[10/14/2023, 12:13:19 AM] [SwitchBot] Bot: Kitchen Lights updateCharacteristic StatusLowBattery: 0
[10/14/2023, 12:13:19 AM] [SwitchBot] Bot: Kitchen Lights updateCharacteristic FirmwareRevision: V6.4
[10/14/2023, 12:13:24 AM] [DysonPureCoolPlatform] VS3-US-KHA2828A - MQTT message received: {"msg":"CURRENT-STATE","time":"2023-10-14T04:13:24.000Z","mode-reason":"NONE","state-reason":"MODE","rssi":"-38","channel":"4","fqhp":"96408","fghp":"67544","product-state":{"fpwr":"ON","auto":"OFF","oscs":"OFF","oson":"OFF","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"30U1","wacd":"FLTR","nmdv":"0004","fnsp":"0010","bril":"0002","corf":"OFF","cflr":"0000","hflr":"0000","cflt":"CARF","hflt":"GHEP","sltm":"OFF","osal":"0090","osau":"0270","ancp":"CUST","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
[10/14/2023, 12:13:24 AM] [DysonPureCoolPlatform] VS3-US-KHA2828A - MQTT message received: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2023-10-14T04:13:24.000Z","data":{"tact":"2951","hact":"0046","pm25":"0000","pm10":"0000","va10":"0005","noxl":"0000","p25r":"0000","p10r":"0000","sltm":"OFF"}}
[10/14/2023, 12:13:24 AM] [DysonPureCoolPlatform] K3W-US-PHA1917A - MQTT message received: {"msg":"CURRENT-STATE","time":"2023-10-14T04:13:24.000Z","mode-reason":"NONE","state-reason":"MODE","rssi":"-27","channel":"4","fqhp":"82360","fghp":"62808","product-state":{"fpwr":"ON","auto":"OFF","oscs":"OFF","oson":"OFF","nmod":"OFF","rhtm":"ON","fnst":"FAN","ercd":"12E1","wacd":"NONE","nmdv":"0004","fnsp":"0005","bril":"0002","corf":"OFF","cflr":"INV","hflr":"0029","cflt":"SCOF","hflt":"GCOM","sltm":"OFF","osal":"0341","osau":"0341","ancp":"CUST","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0000","tzid":"0001"}}
[10/14/2023, 12:13:24 AM] [DysonPureCoolPlatform] K3W-US-PHA1917A - MQTT message received: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2023-10-14T04:13:24.000Z","data":{"tact":"2941","hact":"0049","pm25":"0000","pm10":"0000","va10":"0007","noxl":"0002","p25r":"0001","p10r":"0001","hcho":"0001","hchr":"0003","sltm":"OFF"}}
[10/14/2023, 12:13:24 AM] [DysonPureCoolPlatform] VS3-US-NJA1115A - MQTT message received: {"msg":"CURRENT-STATE","time":"2023-10-14T04:13:24.000Z","mode-reason":"PUI","state-reason":"MODE","rssi":"-33","channel":"4","fqhp":"105440","fghp":"74376","product-state":{"fpwr":"OFF","auto":"OFF","oscs":"OFF","oson":"OFF","nmod":"OFF","rhtm":"ON","fnst":"OFF","ercd":"30U1","wacd":"NONE","nmdv":"0004","fnsp":"0008","bril":"0002","corf":"OFF","cflr":"0012","hflr":"0012","cflt":"CARF","hflt":"GHEP","sltm":"OFF","osal":"0141","osau":"0231","ancp":"0180","fdir":"ON"},"scheduler":{"srsc":"0000000000000000","dstv":"0001","tzid":"0001"}}
[10/14/2023, 12:13:24 AM] [DysonPureCoolPlatform] VS3-US-NJA1115A - MQTT message received: {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2023-10-14T04:13:24.000Z","data":{"tact":"2955","hact":"0046","pm25":"0000","pm10":"0000","va10":"0006","noxl":"0000","p25r":"0001","p10r":"0001","sltm":"OFF"}}
[10/14/2023, 12:13:27 AM] [SwitchBot] Bot: Kitchen Lights openAPIRefreshStatus
[10/14/2023, 12:13:27 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights body: {"_readableState":{"objectMode":false,"highWaterMark":65536,"buffer":{"head":{"data":{"type":"Buffer","data":[123,34,115,116,97,116,117,115,67,111,100,101,34,58,49,48,48,44,34,98,111,100,121,34,58,123,34,100,101,118,105,99,101,73,100,34,58,34,70,57,57,52,67,51,65,49,65,54,67,69,34,44,34,100,101,118,105,99,101,84,121,112,101,34,58,34,66,111,116,34,44,34,104,117,98,68,101,118,105,99,101,73,100,34,58,34,67,51,65,53,55,68,55,52,56,48,48,56,34,44,34,118,101,114,115,105,111,110,34,58,34,86,54,46,52,34,44,34,112,111,119,101,114,34,58,34,111,102,102,34,44,34,98,97,116,116,101,114,121,34,58,49,57,44,34,100,101,118,105,99,101,77,111,100,101,34,58,34,115,119,105,116,99,104,77,111,100,101,34,125,44,34,109,101,115,115,97,103,101,34,58,34,115,117,99,99,101,115,115,34,125]},"next":null},"tail":{"data":{"type":"Buffer","data":[123,34,115,116,97,116,117,115,67,111,100,101,34,58,49,48,48,44,34,98,111,100,121,34,58,123,34,100,101,118,105,99,101,73,100,34,58,34,70,57,57,52,67,51,65,49,65,54,67,69,34,44,34,100,101,118,105,99,101,84,121,112,101,34,58,34,66,111,116,34,44,34,104,117,98,68,101,118,105,99,101,73,100,34,58,34,67,51,65,53,55,68,55,52,56,48,48,56,34,44,34,118,101,114,115,105,111,110,34,58,34,86,54,46,52,34,44,34,112,111,119,101,114,34,58,34,111,102,102,34,44,34,98,97,116,116,101,114,121,34,58,49,57,44,34,100,101,118,105,99,101,77,111,100,101,34,58,34,115,119,105,116,99,104,77,111,100,101,34,125,44,34,109,101,115,115,97,103,101,34,58,34,115,117,99,99,101,115,115,34,125]},"next":null},"length":1},"length":191,"pipes":[],"flowing":null,"ended":true,"endEmitted":false,"reading":false,"constructed":true,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"resumeScheduled":false,"errorEmitted":false,"emitClose":true,"autoDestroy":true,"destroyed":false,"errored":null,"closed":false,"closeEmitted":false,"defaultEncoding":"utf8","awaitDrainWriters":null,"multiAwaitDrain":false,"readingMore":false,"dataEmitted":false,"decoder":null,"encoding":null},"_events":{},"_eventsCount":0}
[10/14/2023, 12:13:27 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights statusCode: 200
[10/14/2023, 12:13:27 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights headers: {"date":"Sat, 14 Oct 2023 04:13:27 GMT","content-type":"application/json","content-length":"191","connection":"keep-alive","x-amzn-requestid":"48885108-5a2d-45f9-841c-167bc60c9a6f","x-amz-apigw-id":"MxhIPENkoAMEADw=","x-amzn-trace-id":"Root=1-652a1567-618779d76ec1814527a5afb4;Sampled=0;lineage=bf95bacf:0"}
[10/14/2023, 12:13:27 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights deviceStatus: {"statusCode":100,"body":{"deviceId":"F994C3A1A6CE","deviceType":"Bot","hubDeviceId":"C3A57D748008","version":"V6.4","power":"off","battery":19,"deviceMode":"switchMode"},"message":"success"}
[10/14/2023, 12:13:27 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights deviceStatus body: {"deviceId":"F994C3A1A6CE","deviceType":"Bot","hubDeviceId":"C3A57D748008","version":"V6.4","power":"off","battery":19,"deviceMode":"switchMode"}
[10/14/2023, 12:13:27 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights deviceStatus statusCode: 100
[10/14/2023, 12:13:27 AM] [SwitchBot] [DEBUG] Bot: Kitchen Lights statusCode: 200 & deviceStatus StatusCode: 100
[10/14/2023, 12:13:27 AM] [SwitchBot] Bot: Kitchen Lights openAPIparseStatus
[10/14/2023, 12:13:27 AM] [SwitchBot] Bot: Kitchen Lights On: true
[10/14/2023, 12:13:27 AM] [SwitchBot] Bot: Kitchen Lights BatteryLevel: 19, StatusLowBattery: 0
[10/14/2023, 12:13:27 AM] [SwitchBot] Bot: Kitchen Lights updateCharacteristic On: true
[10/14/2023, 12:13:27 AM] [SwitchBot] Bot: Kitchen Lights updateCharacteristic BatteryLevel: 19
[10/14/2023, 12:13:27 AM] [SwitchBot] Bot: Kitchen Lights updateCharacteristic StatusLowBattery: 0
[10/14/2023, 12:13:27 AM] [SwitchBot] Bot: Kitchen Lights updateCharacteristic FirmwareRevision: V6.4
```


### Config for homebridge-switchbot

```shell
{
    "bridge": {
        "name": "Homebridge 1D6C",
        "username": "XXXXX",
        "port": 51511,
        "pin": "XXXXX",
        "advertiser": "bonjour-hap"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "auth": "form",
            "theme": "auto",
            "tempUnits": "f",
            "lang": "auto",
            "platform": "config"
        },
        {
            "devices": [
                {
                    "ipAddress": "192.168.1.14",
                    "serialNumber": "XXXXX",
                    "credentials": "XXXXX",
                    "useFahrenheit": true,
                    "enableAutoModeWhenActivating": false,
                    "enableOscillationWhenActivating": false,
                    "enableNightModeWhenActivating": false,
                    "isNightModeEnabled": true,
                    "isJetFocusEnabled": true,
                    "isContinuousMonitoringEnabled": true,
                    "isTemperatureSensorEnabled": true,
                    "isTemperatureIgnored": false,
                    "temperatureOffset": 0,
                    "isHumiditySensorEnabled": true,
                    "isHumidityIgnored": false,
                    "humidityOffset": 0,
                    "isAirQualitySensorEnabled": true,
                    "isAirQualityIgnored": false,
                    "isSingleSensorAccessoryModeEnabled": true,
                    "isSingleAccessoryModeEnabled": true,
                    "isFullRangeHumidity": false,
                    "isHeatingDisabled": false,
                    "isHeatingSafetyIgnored": false
                },
                {
                    "ipAddress": "192.168.1.13",
                    "serialNumber": "XXXXX",
                    "credentials": "XXXXX",
                    "useFahrenheit": true,
                    "enableAutoModeWhenActivating": false,
                    "enableOscillationWhenActivating": false,
                    "enableNightModeWhenActivating": false,
                    "isNightModeEnabled": true,
                    "isJetFocusEnabled": true,
                    "isContinuousMonitoringEnabled": true,
                    "isTemperatureSensorEnabled": true,
                    "isTemperatureIgnored": false,
                    "temperatureOffset": 0,
                    "isHumiditySensorEnabled": true,
                    "isHumidityIgnored": false,
                    "humidityOffset": 0,
                    "isAirQualitySensorEnabled": true,
                    "isAirQualityIgnored": false,
                    "isSingleSensorAccessoryModeEnabled": false,
                    "isSingleAccessoryModeEnabled": true,
                    "isFullRangeHumidity": false,
                    "isHeatingDisabled": false,
                    "isHeatingSafetyIgnored": false
                },
                {
                    "ipAddress": "192.168.1.7",
                    "serialNumber": "XXXXX",
                    "credentials": "XXXXX",
                    "useFahrenheit": true,
                    "enableAutoModeWhenActivating": false,
                    "enableOscillationWhenActivating": false,
                    "enableNightModeWhenActivating": false,
                    "isNightModeEnabled": true,
                    "isJetFocusEnabled": true,
                    "isContinuousMonitoringEnabled": true,
                    "isTemperatureSensorEnabled": true,
                    "isTemperatureIgnored": false,
                    "temperatureOffset": 0,
                    "isHumiditySensorEnabled": true,
                    "isHumidityIgnored": false,
                    "humidityOffset": 0,
                    "isAirQualitySensorEnabled": true,
                    "isAirQualityIgnored": false,
                    "isSingleSensorAccessoryModeEnabled": false,
                    "isSingleAccessoryModeEnabled": true,
                    "isFullRangeHumidity": false,
                    "isHeatingDisabled": false,
                    "isHeatingSafetyIgnored": false
                }
            ],
            "platform": "DysonPureCoolPlatform"
        },
        {
            "name": "Weather",
            "apikey": "XXXXX",
            "cityIds": [
                0
            ],
            "dailyForecasts": 7,
            "hourlyForecasts": 24,
            "leakSensor": false,
            "locations": [
                "Brooklyn"
            ],
            "platform": "WS"
        },
        {
            "name": "SwitchBot",
            "credentials": {
                "token": "XXXXX",
                "secret": "XXXXX",
                "notice": "Keep your Token & Secret a secret!"
            },
            "platform": "SwitchBot"
        }
    ]
}
```


### Screenshots

Example of device log:

![IMG_0075](https://github.com/OpenWonderLabs/homebridge-switchbot/assets/15283/61dce587-f562-4a2f-99cc-c7443e3a3991)


### Device & Model

Switchbot Bot

### Node.js Version

v18.16.1

### NPM Version

9.5.1

### Homebridge Version

v1.6.1

### Homebridge SwitchBot Plugin Version

v2.9.0

### Homebridge Config UI X Plugin Version

v4.50.6

### Operating System

Mac OS X Sonoma