Closed grelca closed 10 months ago
this (third party) repo looks like it agrees with my observation, and parses 0 as on and 1 as off. i think i will open a PR
@grelca what we can do is once you have a PR open then we can merge it into a beta of node-switchbot and then have that beta be in a beta of homebridge-switchbot and we can verify all is working as expected.
I just published a beta branch if you can base your PR on that. Branch beta-1.9.2
Released v1.10.0
Analysis
i forked https://github.com/OpenWonderLabs/homebridge-switchbot because i wanted to add (even if just for myself) a way to keep the homebridge bot state in sync even if i control it via the switchbot app and not homebridge. however, i noticed that the bot state read from node-switchbot is always opposite of what the bot's actual state is.
using
@abandonware/noble
directly, i found the following values for the second byte in the broadcast service datasince
node-switchbot
takes the value of the second bit of this byte for the bot'sstate
, the bot state gets reported backwards.i am posting an issue first rather than opening a PR in case this is possibly an issue with my bot? but i'm happy to open a PR if it's not just an issue with my bot.
i only have the one bot so i'm unable to compare this with the behavior of other bots, but the bot's on/off state is always correctly displayed in the switchbot app. and i don't have a hub so i am also unable to compare the BLE behavior with API behavior.
Expected Behavior
when a bot in turned on, its BLE state is parsed as
true
when a bot is turned off, its BLE state is parsed asfalse
Steps To Reproduce
node-switchbot
state: false
node-switchbot
state: true
Logs
from the basic
homebridge-switchbot
plugin, not my forkwhen the bot is off:
when the bot is on:
Configuration
Environment
Additional Context
i have reset my bot with the physical reset button under the cover and the behavior did not change. i'm not sure what the most up-to-date firmware version is for the bot, but mine is running v6.3 and does not show a firmware update available in the app.