formatBCE / Airbnk-MQTTOpenGateway

Gateway to use Airbnk locks with HA custom integration https://github.com/rospogrigio/airbnk_mqtt
GNU Affero General Public License v3.0
12 stars 1 forks source link

multi devices support #1

Closed xick closed 2 years ago

xick commented 2 years ago

Hi, is it possible to connect more than one Lock at the Gateway?

formatBCE commented 2 years ago

Hi. While technically it seems possible, the logic of scanning me sending commands to several devices is overwhelming. For example, while scanning, ESP32 cannot send BLE commands. Right now scan gets cancelled, if we received command, and restarted after command is sent. For several locks it could lead to situation, when scan never starts. Or another example: right now, scan operation gets restarted immediately after lock adv message has been found, which allows to send messages from lock almost immediately. However, with several locks we'd have to wait for all locks to be found, making logic really complicated. Thus, I'd say that adding multiple locks, while isn't impossible, is highly impractical. If you have concerns, please describe :)

xick commented 2 years ago

I briefly read your code and also documentation of NimBLE (https://h2zero.github.io/esp-nimble-cpp/md__new_user_guide.html), now I understand more of the problems that you point. However, and this could a dumb question, but I can't get the point for scanning devices each time. Once we scan and got a list of devices, and store the result of the scan NimBLEScan *pScan = NimBLEDevice::getScan(); NimBLEScanResults results = pScan->start(10); , why can't we just call from the result, and perform a scan only at startup or on demand. If this sounds stupid to you, maybe I didn't get the full logic :)

formatBCE commented 2 years ago

Scanning is polling state. Basically, if we want to know, that lock was opened or closed, and if lock is actually in effective distance. It's like connection/status check. Also, I remembered one more stumble point in multi-device setup: With small effective distance, it's very unlikely to have someone with such a setup, when several locks are close to eachother. And if they are far, gateway will lose connection at least to one of them. So it's actually more robust and stable to get ESP for each device. :)

xick commented 2 years ago

Now I get, thanks. I was looking for a solution to manage 14+ doors in a b&b with my custom access manager. Airbnk + your gateway and airbnk_mqqt seemed to be a great solution for it's battery powered system (thus no need of electrification), but having a gateway for each door seems impractical (they would need to be powered too). I think I will go with tuya based door locks, despite the fact that I'd depend on their api and cloud system sigh

formatBCE commented 2 years ago

Yeah, definitely WiFi-based solution will fit best for your usecase. Moreover, I would not rely on our solution in industrial cases :) It's still young and considered alpha-stage. Instead, you may use TuyaLocal integration for tuya-basrd devices, avoiding cloud ;)

ronpotter271 commented 2 years ago

@formatBCE I couldn't find any tested/supported tuya locks compatible with HA neither cloud nor local, do you know any? since you suggested it I had to ask

formatBCE commented 2 years ago

@formatBCE I couldn't find any tested/supported tuya locks compatible with HA neither cloud nor local, do you know any? since you suggested it I had to ask

Sorry, I didn't dive deep into this - and I believe, it is possible, 5hat Guys Local doesn't support locks yet.