Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Think through addon startup, MQTT QoS, repeated availability messages etc #170

Open
SweVictor opened this issue Mar 1, 2021 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@SweVictor
Copy link
Collaborator

Currently we send available = true over mqtt for every state update we get. We also subscribe to all mqtt messages. This got me thinking a bit.

Mqtt has the option to use QoS (quality of service) and set 1 - "at least once" or 2 - "exactly once" delivery (we currently use 0 "at most once", or "fire and forget") https://github.com/mqttjs/MQTT.js#qos. To me it seems like the QoS 1 would be a good default for us (guaranteed delivery).

There is also the option to retain messages if no client (HA) receives them which seems like a good idea to avoid issues if the HA mqtt client is unavailable for some reason. This, though, requires us to nl = true (no local) or rap = true (retain as published) when subscribing (which I think we should either way). nl = true should remove receiving a copy of sent messages back which I think is a bit redundant.

Finally we could think about if we should set devices as unavailable when BLE is not connected. For the version on the way for 0.7.0, #169, the write queue is kept if the BLE connection goes down meaning shorter outages are handled quite gracefully. For longer outages it might be nice to communicate to HA that devices are unavailable, however that would mean that things such as time-based scenarios might fail instead of being much delayed (which would be the case currently if BLE eventually reconnects).

Finally I wonder if we could start up the addon earlier during the HA lifecycle, at least in my installation it starts quite late.

Any other suggestions on mqtt/lifecycle improvements?

@SweVictor SweVictor added the enhancement New feature or request label Mar 1, 2021
@SweVictor
Copy link
Collaborator Author

Mqtt v5 does not seem to be supported by HA Mosquitto at this time. Created issue in HA to track this
home-assistant/addons#1984

v5 is needed for nl and rap as far as I can see.

@SweVictor
Copy link
Collaborator Author

HA isseu has been closed in PR! home-assistant/addons#2007

Presumably Mosquitto has been updated to v1.6.12.

Anyone feel like looking into if nl/rap/... is supported after that? (not sure if when master is released though).

@SweVictor SweVictor added the help wanted Extra attention is needed label May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant