Current Situation
The current API actions for the "Bot" from SwitchBot does not include a way to programmatically set the duration of the press.
This functionality would be allow for more automations, especially in the smart home world (e.g. Home Assistant), to do things like "roll down the blinds 50% (15s)", where the Bot can press for a variable amount of seconds based on the user's needs, then for another action the same Bot can press for 30s.
Something similar has already been mentioned before, but curious to see if anything has changed?
Some people have already tried to reverse engineer it (switchbotpy, but it would be so much easier to just have this directly in the API.
Proposed Change
Suggestion:
-
Add the duration of the press to the GET /v1.1/devices/{deviceId}/status endpoint — e.g. pressDuration (number measured in seconds)
| Key |
Value Type |
Description |
| pressDuration |
Integer |
device's press duration |
Current abilities: https://github.com/OpenWonderLabs/SwitchBotAPI#bot-1
-
Add a command like setPressDuration (or even pressForSeconds and allow a parameter seconds)
| deviceType |
commandType |
Command |
command parameter |
Description |
| Bot |
command |
setDuration |
default |
change the press duration |
| deviceType |
commandType |
Command |
command parameter |
Description |
| Bot |
command |
pressForSeconds |
{1-60} |
press for defined number of seconds |
Current abilities: https://github.com/OpenWonderLabs/SwitchBotAPI#bot-2
Additional Context
Using the SwitchBot app, users can change the press duration (one static value), so this appears to be already technically implemented internally.
This is NOT solved already by the "action sequence" feature in the app, because the duration of how long to press could be variable based on what someone is trying to do.
Current Situation
The current API actions for the "Bot" from SwitchBot does not include a way to programmatically set the duration of the press.
This functionality would be allow for more automations, especially in the smart home world (e.g. Home Assistant), to do things like "roll down the blinds 50% (15s)", where the Bot can press for a variable amount of seconds based on the user's needs, then for another action the same Bot can press for 30s.
Something similar has already been mentioned before, but curious to see if anything has changed?
Some people have already tried to reverse engineer it (switchbotpy, but it would be so much easier to just have this directly in the API.
Proposed Change
Suggestion:
Add the duration of the press to the
GET /v1.1/devices/{deviceId}/statusendpoint — e.g.pressDuration(number measured in seconds)Current abilities: https://github.com/OpenWonderLabs/SwitchBotAPI#bot-1
Add a command like
setPressDuration(or evenpressForSecondsand allow a parameterseconds){1-60}Current abilities: https://github.com/OpenWonderLabs/SwitchBotAPI#bot-2
Additional Context
Using the SwitchBot app, users can change the press duration (one static value), so this appears to be already technically implemented internally.
This is NOT solved already by the "action sequence" feature in the app, because the duration of how long to press could be variable based on what someone is trying to do.