Lyr3x / Roode

A reliable smart home people counter based on VL53L1X and ESPHome
The Unlicense
149 stars 43 forks source link

Random disconnects of the ESPHome API #27

Closed Lyr3x closed 2 years ago

Lyr3x commented 3 years ago

Describe the bug When controlling Roode from HA it come sometimes to an disconnect after a command is sent

To Reproduce Steps to reproduce the behavior: Sent recalibrate command

Expected behavior Recalibration occurs, but after the recalibration started the esp disconnects for a few seconds

Lyr3x commented 3 years ago

We can't enable both mqtt and the native api without stability issues. We need MQTT to receive commands and react on them in the code. Currently the native api is not capable of that. However, it seems that they develop that possibility.

Lyr3x commented 3 years ago

Cleaning up exposed sensors + setting a higher Timeout mitigated the issue well

noxhirsch commented 2 years ago

We can't enable both mqtt and the native api without stability issues. We need MQTT to receive commands and react on them in the code. Currently the native api is not capable of that. However, it seems that they develop that possibility.

@Lyr3x Sorry to respond to a closed issue here, but shouldn't this be possible with user-defined services so that MQTT isn't needed anymore? https://esphome.io/components/api.html#user-defined-services

I use these user-defined services to trigger specific commands or send position data to my blinds: image

Lyr3x commented 2 years ago

Thank you very much! I didn't know about that. I'll reopen the issue and will test that to ditch MQTT completely.

I think that will also help to provide roode as an external_component.

Lyr3x commented 2 years ago

Do you know if it's possible to use just a lambda in the then part?

Lyr3x commented 2 years ago

Do you know if it's possible to use just a lambda in the then part?

noxhirsch commented 2 years ago

If that's what you mean, then yes, it's possible:

    - service: slow_position
      variables:
        pos: float
      then:
        - [...]
        - lambda: 'id(tilt).update();'
        - [...]

(this is snippet of my blinds-script)

Lyr3x commented 2 years ago

Awesome! Thanks again

Lyr3x commented 2 years ago

With #43 I removed MQTT and switched to NativeAPI all the way. Services are registered in the example configurations to achieve resetting, counter setting and recalibration.