OpenWonderLabs / homebridge-switchbot

The Homebridge SwitchBot plugin allows you to access your SwitchBot Device(s) from HomeKit. Homebridge.
https://openwonderlabs.github.io/homebridge-switchbot/
ISC License
246 stars 54 forks source link

Bug: Curtain 3 Status not showing correctly #1082

Open jdbishop17 opened 1 month ago

jdbishop17 commented 1 month ago

Describe the Bug

The curtain can be controlled but the open/close status and the battery level are not synced/constantly showing 'closing' and/or displayed incorrectly.

To Reproduce

Install V 4.0.0, click 'Enable BLE Scanning' under advanced settings so all the items are automatically added, and then look at the curtain in either homebridge or the home app.

Expected Behavior

The curtain should display the current battery life and curtain status in the home app.

Relevant Log Output

[10/19/2024, 10:28:14 PM] [SwitchBot] [parseAdvertising.id.{] return {"id":"id","address":"address","rssi":-68,"serviceData":{"model":"c","modelName":"WoCurtain","modelFriendlyName":"Curtain","calibration":true,"battery":4,"inMotion":true,"position":0,"lightLevel":0,"deviceChain":3}}
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain received BLE: {"model":"c","modelName":"WoCurtain","modelFriendlyName":"Curtain","calibration":true,"battery":4,"inMotion":true,"position":0,"lightLevel":0,"deviceChain":3}
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain BLEparseStatus
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain (position, battery) = BLE:(0, 4), current:(100, 4)
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain CurrentPosition 100
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain Checking Status ...
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain Opening, CurrentPosition: 100
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain Decreasing, PositionState: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain CurrentPosition: 100, TargetPosition: 0, PositionState: 0,
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain BatteryLevel: 4
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain StatusLowBattery: 1
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic CurrentPosition: 100
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain CurrentPosition context before: 100
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain CurrentPosition context after: 100
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic PositionState: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain PositionState context before: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain PositionState context after: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic TargetPosition: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain TargetPosition context before: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain TargetPosition context after: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic HoldPosition: false
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain HoldPosition context before: false
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain HoldPosition context after: false
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic BatteryLevel: 4
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain BatteryLevel context before: 4
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain BatteryLevel context after: 4
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic StatusLowBattery: 1
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain StatusLowBattery context before: 1
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain StatusLowBattery context after: 1
[10/19/2024, 10:28:14 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic ChargingState: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain ChargingState context before: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] Curtain3: Curtain ChargingState context after: 0
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] [parseServiceData] Buffer length 4 !== 3!
[10/19/2024, 10:28:14 PM] [SwitchBot] [DEBUG] [parseServiceData] Buffer length 4 !== 3!
[10/19/2024, 10:28:15 PM] [SwitchBot] [DEBUG] [parseServiceData] Buffer length 4 !== 3!
[10/19/2024, 10:28:15 PM] [SwitchBot] [DEBUG] [parseServiceData] Buffer length 4 !== 3!
[10/19/2024, 10:28:15 PM] [SwitchBot] [DEBUG] [parseServiceData] Buffer length 4 !== 3!
[10/19/2024, 10:28:15 PM] [SwitchBot] [DEBUG] [parseServiceData] Buffer length 4 !== 3!
[10/19/2024, 10:28:17 PM] [SwitchBot] [parseAdvertising.id.{] return {"id":"id","address":"address","rssi":-66,"serviceData":{"model":"c","modelName":"WoCurtain","modelFriendlyName":"Curtain","calibration":true,"battery":4,"inMotion":true,"position":0,"lightLevel":0,"deviceChain":3}}
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain received BLE: {"model":"c","modelName":"WoCurtain","modelFriendlyName":"Curtain","calibration":true,"battery":4,"inMotion":true,"position":0,"lightLevel":0,"deviceChain":3}
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain BLEparseStatus
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain (position, battery) = BLE:(0, 4), current:(100, 4)
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain CurrentPosition 100
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain Checking Status ...
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain Opening, CurrentPosition: 100
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain Decreasing, PositionState: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain CurrentPosition: 100, TargetPosition: 0, PositionState: 0,
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain BatteryLevel: 4
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain StatusLowBattery: 1
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic CurrentPosition: 100
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain CurrentPosition context before: 100
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain CurrentPosition context after: 100
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic PositionState: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain PositionState context before: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain PositionState context after: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic TargetPosition: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain TargetPosition context before: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain TargetPosition context after: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic HoldPosition: false
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain HoldPosition context before: false
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain HoldPosition context after: false
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic BatteryLevel: 4
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain BatteryLevel context before: 4
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain BatteryLevel context after: 4
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic StatusLowBattery: 1
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain StatusLowBattery context before: 1
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain StatusLowBattery context after: 1
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain ChargingState context before: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic ChargingState: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain ChargingState context after: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [parseAdvertising.id.{] return {"id":"id","address":"address","rssi":-67,"serviceData":{"model":"c","modelName":"WoCurtain","modelFriendlyName":"Curtain","calibration":true,"battery":4,"inMotion":true,"position":0,"lightLevel":0,"deviceChain":3}}
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain received BLE: {"model":"c","modelName":"WoCurtain","modelFriendlyName":"Curtain","calibration":true,"battery":4,"inMotion":true,"position":0,"lightLevel":0,"deviceChain":3}
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain BLEparseStatus
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain (position, battery) = BLE:(0, 4), current:(100, 4)
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain CurrentPosition 100
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain Checking Status ...
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain Opening, CurrentPosition: 100
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain Decreasing, PositionState: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain CurrentPosition: 100, TargetPosition: 0, PositionState: 0,
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain BatteryLevel: 4
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain StatusLowBattery: 1
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic CurrentPosition: 100
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain CurrentPosition context before: 100
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain CurrentPosition context after: 100
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic PositionState: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain PositionState context before: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain PositionState context after: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic TargetPosition: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain TargetPosition context before: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain TargetPosition context after: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic HoldPosition: false
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain HoldPosition context before: false
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain HoldPosition context after: false
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic BatteryLevel: 4
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain BatteryLevel context before: 4
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain BatteryLevel context after: 4
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic StatusLowBattery: 1
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain StatusLowBattery context before: 1
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain StatusLowBattery context after: 1
[10/19/2024, 10:28:17 PM] [SwitchBot] Curtain3: Curtain updateCharacteristic ChargingState: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain ChargingState context before: 0
[10/19/2024, 10:28:17 PM] [SwitchBot] [DEBUG] Curtain3: Curtain ChargingState context after: 0
[10/19/2024, 10:28:18 PM] [SwitchBot] [DEBUG] [parseServiceData] Buffer length 4 !== 3!
[10/19/2024, 10:28:18 PM] [SwitchBot] [DEBUG] [parseServiceData] Buffer length 4 !== 3!
[10/19/2024, 10:28:18 PM] [SwitchBot] Curtain3: Curtain Refresh Status When Moving, PositionState: 0
[10/19/2024, 10:28:18 PM] [SwitchBot] Curtain3: Curtain openAPIRefreshStatus
[10/19/2024, 10:28:18 PM] [SwitchBot] [parseAdvertising.id.{] return {"id":"id","address":"address","rssi":-68,"serviceData":{"model":"c","modelName":"WoCurtain","modelFriendlyName":"Curtain","calibration":true,"battery":4,"inMotion":true,"position":0,"lightLevel":0,"deviceChain":3}}
[10/19/2024, 10:28:18 PM] [SwitchBot] Curtain3: Curtain received BLE: {"model":"c","modelName":"WoCurtain","modelFriendlyName":"Curtain","calibration":true,"battery":4,"inMotion":true,"position":0,"lightLevel":0,"deviceChain":3}

Config for homebridge-switchbot

{
    "bridge": {
        "name": "Homebridge E65A",
        "username": "username",
        "port": port,
        "pin": "pin",
        "advertiser": "bonjour-hap"
    },
    "accessories": [
        {
            "name": "Garage Door",
            "autoCloseDelay": 0,
            "accessory": "DummyGarage"
        }
    ],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "name": "SwitchBot",
            "credentials": {
                "token": "token",
                "secret": "secret",
                "notice": "Keep your Token & Secret a secret!"
            },
            "options": {
                "BLE": true,
                "discoverBLE": false
            },
            "platform": "SwitchBot"
        }
    ],
    "disabledPlugins": [
        "homebridge-dummy-garage"
    ]
}

Screenshots

homebridge.log.txt

Device and Model

Curtain 3, firmware v1.2

Node.js Version

v20.18.0

NPM Version

v10.8.2

Homebridge Version

v1.8.4

Homebridge Switchbot Plugin Version

v4.0.0

Homebridge Config UI X Plugin Version

v4.62.0

Operating System

macOS Ventura 13.3.1(a)

github-actions[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jisunglim commented 2 weeks ago

I am experiencing the exact same issue. Specifically, when using the Automation feature of the SwitchBot app to automatically open or close the curtains, it seems that even after the curtains are fully opened or closed, the Homebridge or Apple Home app continues to display the status as 'Closing' or 'Opening.' When the status remains pending as 'Opening' or 'Closing,' manually opening or closing the curtains through the SwitchBot app sometimes updates the status correctly.