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

Stubborn HASS MQTT Discovery #1370

Closed
wants to merge 5 commits into from

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented Nov 24, 2018

AsyncMqttClient::publish method returns packet id > 0 when it is actually accepted by the network layer. worked for me with both QoS 0 (PID 1 is success) and QoS 1.
limited testing with lwip2/536mss+git, lwip2/1460mss+git and lwip1.4+2.3.0
pubsubclient works the same way, returning bool right from the .publish method.

Modified mqttSend... variants to check PID validity and check what they return in the discovery sender. Both ha relays and sensors methods modified into a helper class to store last sent internal array ID.

Additionally, this approach should also be applied to the config generator.

Depends on #1374 // F() could be removed for it to work without it
Fixes #1346
cc @peterhoeg

@peterhoeg
Copy link
Contributor

Should this be tested against dev or can I cherry-pick the commits on top of the latest release?

@mcspr
Copy link
Collaborator Author

mcspr commented Nov 26, 2018

Idk if it is worth managing cherry picks, but it should work for master branch too.
homeassistant.ino had no changes since. There is one eeprom related method change in mqtt module, but it could be ignored and old one used instead.

@mcspr mcspr changed the title WIP Stubborn HASS MQTT Discovery Stubborn HASS MQTT Discovery Nov 26, 2018
code/espurna/mqtt.ino Outdated Show resolved Hide resolved
throttle loop sender and delay running send when reconfiguring

reset discovery state when connecting

keep behaviour of ha.send / ha.clear

class helper, shortname hass -> ha
@abmantis
Copy link
Contributor

Any reason why this is still pending?

@mcspr
Copy link
Collaborator Author

mcspr commented Feb 19, 2019

IMO there should be generic callback helper in the core to avoid juggling discovery helper object. i.e. something that will call some function and allow some local state (like here - relay and sensor index sent so far), enforce uniqueness and allow it to be automatically removed when it is done.

Otherwise, I remember this being pretty robust. Maybe one thing that should be tested is DEBUG_SUPPORT=0, because of implicit yields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rfbridge only sending first 8 relays via MQTT for auto-discovery
3 participants