digaus / esphome-components-eqiva

Other
23 stars 10 forks source link

Help request: Disconnect BLE when API client not connected #9

Open user45876 opened 7 months ago

user45876 commented 7 months ago

Dear digaus,

thank you so much for this. I was using a Zero 2 with several keyble for years and while it is great, this is looking to be more reliable and easier in the end. This has so much less moving parts than a zero with Node on it ;)

However, I am having two questiong and want to ask for help:

Thank you so much for your efforts, very much appreciated! Corwin

user45876 commented 7 months ago

After reading and trying to think in this bedlam I came up with this. Should this work? Is it enough or too much? Desired behaviour is that it disconnects from the lock when the API is disconnected for whatever reason so the app can be used. (editing around...)

api:
  encryption:
    key: "..."

  on_client_disconnected:
    - while:
        condition:
          - not: api.connected
        then:
          - esp32_ble_tracker.stop_scan:
          - eqiva_key_ble.disconnect:

However, this does not seem to be working as intended. When the API is disconnected (e.g. temporarily shutting the HA switchport), the lock does not become available in the app.

dlbogdan commented 1 month ago

Yes, this is quite important in order to have redundancy of opening the door. example. HA crashes or wifi or whatever, you should be able to use the Eqiva App in your phone to open the door. If the ESP32 is constantly connected to the lock, you can't.

Help!