Closed benjaminbogdanovic closed 3 years ago
Would using the same MAC address for on and off on the current setup work?
If you want to use it with a single device, you can have the same address specified for on and off, but just specify the MAC address directly as shown below and it will work. (Internally, it works by specifying the same MAC address for on and off.
https://github.com/zizi4n5/homebridge-switchbot-for-mac#control-one-switchbot
Thanks for your response. That makes sense. I have not not received my switchbot yet, it is arriving later today, but I wanted to understand the functionality of this plugin, but was confused by the reference to two devices in the Properties section on the readme.
Thanks for your comment. I feel it's hard to explain one device and two devices, so I'll add an image, etc. and improve it.
Would it be possible to have single device on and off as shown in the screenshot, with a normal mode, and an add on mode. This would be useful for light switches.
There is no option to change the mode in the plugin. So the SwitchBot device will work in the mode that is set SwitchBot app. Try changing the mode of your device in the SwitchBot app. https://www.switch-bot.com/bot
Press-hold Time can be set in the SwitchBot app too.
That's good to know. I was unaware that it listens to the in app settings. My experience with other hardware such as the Broadlink RM is quite the opposite. The plugin usually has to set these things.
Would HomeKit know if the switchbot is on or off using that setting in the app?
I am currently looking at the code an attempting to convert it from a switch accessory to a lock accessory. I am hoping it will be simple enough.
Would HomeKit know if the switchbot is on or off using that setting in the app?
HomeKit cannot know what settings you have in the app, but if you change the settings in the SwitchBot app, the SwitchBot device will reflect the changes.
Then, the SwitchBot device will behave according to the device's settings when HomeKit sends on or off.
This plugin uses the node-switchbot's turnOn/turnOff methods. This method works according to the settings of the SwitchBot device. https://github.com/futomi/node-switchbot#turnon-method
Then there's also the press/down/up methods, so it looks like I could add a set mode option to the plugin. However, I'm not sure if this is a limitation of node-switchbot or the SwitchBot API, but node-switchbot does not support press timers.
Sorry, I phrased that question poorly. For example, if the press mode with a timer for 3 seconds is set in the app, then I send an on command on HomeKit, will the plugin/HomeKit know to show that the SwitchBot is off after the 3 seconds are over?
And as general point, can the plugin determine the state of the SwitchBot through the API?
Then there's also the press/down/up methods, so it looks like I could add a set mode option to the plugin. However, I'm not sure if this is a limitation of node-switchbot or the SwitchBot API, but node-switchbot does not support press timers.
That's good to know. If I have the time, and once I get head around why it is still showing as a switch accessory after I changed all the relevant references to a lock accessory, I might look at implementing this so that the settings are not split between the app and the plugin.
Sorry, I phrased that question poorly. For example, if the press mode with a timer for 3 seconds is set in the app, then I send an on command on HomeKit, will the plugin/HomeKit know to show that the SwitchBot is off after the 3 seconds are over?
You can set the press timer, but I think the status is the same that in-press state and post-press state of the SwitchBot.
And as general point, can the plugin determine the state of the SwitchBot through the API?
In the case of node-switchbot, the state of the SwitchBot is You can get it as Advertisement Data. However, I don't know how to use it in detail because I don't use it. https://github.com/futomi/node-switchbot#advertisement-data
Sorry, I phrased that question poorly. For example, if the press mode with a timer for 3 seconds is set in the app, then I send an on command on HomeKit, will the plugin/HomeKit know to show that the SwitchBot is off after the 3 seconds are over?
You can set the press timer, but I think the status is the same that in-press state and post-press state of the SwitchBot.
Does that mean that it will show as on in the Home app, even though the timer has turned it off?
I guess I will find out soon when my delivery arrives!
I have received my SwitchBot and it behaves as discussed. Would a timeout/timer for the state that is shown in HomeKit (on or off) be difficult to implement, so it can be matched with the timer in the app?
I have achieved this by using the ping feature, but setting an IP that will always be unreachable.
There will be some unnecessary pings, but I think it's a no problem that way.
Thanks for your work on this project so far! All the others I have come across use gatttool, so are Linux only.
Would it be possible to have single device on and off as shown in the screenshot, with a normal mode, and an add on mode. This would be useful for light switches.
A timer for how long it should stay on for would also be useful, a 'press' mode. I am seeing a use case for an intercom that opens a door, similar to this using the Lock accessory type: https://github.com/github9984/homebridge-switchbot-lock. Thank you in advance if you find this worthy of your time.