homebridge-switchbot icon indicating copy to clipboard operation
homebridge-switchbot copied to clipboard

Feature Request: Combine Two SwitchBots into one Accessory?

Open dampney opened this issue 2 years ago • 5 comments

Describe Your Problem

To open my garage door, I use two SwitchBots. Is it possible to expose the two accessories as one in Homekit? To open my garage door, the first SwitchBot has to turn on the intercom before the second opens the gate. I can easily expose my individual SwitchBots as Garage Doors in Homekit, but need to combine the two accessories into one for it to actually work.

Relevant log output

Config for homebridge-switchbot

No response

Screenshots

IMG_1605

Device & Model

SwitchBot

Node.js Version

V16.15.1

NPM Version

V7.x.x

Homebridge Version

v1.5.0

Homebridge SwitchBot Plugin Version

V.x.x.

Homebridge Config UI X Plugin Version

No response

Operating System

MacOS

dampney avatar Jul 01 '22 04:07 dampney

I have a similar request. I use two bots to control my window blind controller (one bot presses the "UP" button, the other the "DOWN" button). It would be great if these could be combined into a single switch (or even better: window cover) device in Homekit.

afmklk avatar Aug 17 '22 09:08 afmklk

I have a similar request. I use two bots to control my window blind controller (one bot presses the "UP" button, the other the "DOWN" button). It would be great if these could be combined into a single switch (or even better: window cover) device in Homekit.

Similar request here. I end up using some dummy window cover plugin that trigger the bot switches. Works ok, but it is a quite dirty solution

renatz76 avatar Aug 24 '22 11:08 renatz76

I will take any pull requests on this

donavanbecker avatar Aug 24 '22 13:08 donavanbecker

Similar request here. I end up using some dummy window cover plugin that trigger the bot switches. Works ok, but it is a quite dirty solution

Which plugin do use? I found that Dummy Garage works quite well for this, although it shows up as a garage door, of course.

afmklk avatar Aug 25 '22 16:08 afmklk

Similar request here. I end up using some dummy window cover plugin that trigger the bot switches. Works ok, but it is a quite dirty solution

Which plugin do use? I found that Dummy Garage works quite well for this, although it shows up as a garage door, of course.

I am using homebridge-window-cover to create dummy window shutters. Just install it, no need to config anything.

renatz76 avatar Aug 26 '22 20:08 renatz76

The ideal way to do this would be to use Homebridge to create an accessory within Homebridge and use cURL to send requests to Homebridge. IMO this should be made way easier in Homebridge itself (the ability to automate accessories through plugins). To do this you're also gonna need to change the default duration that tokens last. That being said, a pull request for this wouldn't be too difficult.

alvst avatar Dec 27 '22 00:12 alvst

Actually, thinking about this more, its pretty difficult with the current implementation and would basically require a shim layer in between, while not impossible, its a difficult UI problem and understanding for new users, the easiest way is definitely to make an accessory in Homebridge. I will Open Source my implementation at some point in the next couple weeks. And one could pretty easily adapt that to this request. I'll also probably request a better, safer way to do the cURL stuff within the actual Homebridge project since if one were to get access to your bearer token, they'd have pretty significant access to your system and could do things like unlock doors, flip on and off lights, etc.

alvst avatar Dec 27 '22 00:12 alvst

The ideal way to do this would be to use Homebridge to create an accessory within Homebridge and use cURL to send requests to Homebridge. IMO this should be made way easier in Homebridge itself (the ability to automate accessories through plugins). To do this you're also gonna need to change the default duration that tokens last. That being said, a pull request for this wouldn't be too difficult.

Very much interested in this and willing to roll-up my sleeves if necessary. Would you mind giving some initial directions to a noob on this?

renatz76 avatar Jan 18 '23 13:01 renatz76

The ideal way to do this would be to use Homebridge to create an accessory within Homebridge and use cURL to send requests to Homebridge. IMO this should be made way easier in Homebridge itself (the ability to automate accessories through plugins). To do this you're also gonna need to change the default duration that tokens last. That being said, a pull request for this wouldn't be too difficult.

Very much interested in this and willing to roll-up my sleeves if necessary. Would you mind giving some initial directions to a noob on this?

I’m not sure how beginner level you are but, I’d start with this repo, fork it, and then you’ll need to remove the http calls (technically not necessary but for cleanliness/clarity of your code and drop in the 2 switchbot cURLS (one for the gate, the other for the garage) on open and on close. You can look at my implementation for a thermostat as a guide. For the record, my thermostat is originally based on this so there’s gonna be a good amount of overlap between what I changed and what you’ll have to change.

alvst avatar Jan 18 '23 22:01 alvst