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

Is there an mqtt echo functionality? #2618

Open
CrappyTan opened this issue Sep 4, 2024 · 1 comment
Open

Is there an mqtt echo functionality? #2618

CrappyTan opened this issue Sep 4, 2024 · 1 comment
Labels

Comments

@CrappyTan
Copy link

Device

No response

Version

No response

Question

After our last discussion around mqtt and LWT, I need to be 100% certain a devices is online.

My use-case, I am controlling a heater which is keeping a large number of Lithium batteries warm through winter. As such, it needs to be belt and braces to ensure I don't cook the batteries (and the heater has the capacity to do this)

Whist LWT is good to alert of subscribers vanishing, it does not, I believe, protect from the broker crashing. Certainly not in my testing. (There is a safety mechanism - SWITCH=OFF ON BROKER DISCONNECT which I already have set)

To work around this, I "poll" the relay. I send a message pattern to the relay relay/0/set and process the sequence coming back via the relay/0 topic. If I get the same patter, I know we're online.

This obviously causes chatter and the PSU / fans don't much appreciate it.

What would be very simple if there was an "echo" function.
I sent a value to echo/set and it would reply on /echo with the same value.

/echo or /alive - same thing.

is something like this there? I cannot see anything in the code.

If not, I will implement it for myself - thoughts on a wider use / inclusion in the codebase?

@mcspr
Copy link
Collaborator

mcspr commented Sep 6, 2024

I do see <root>/action/set receiving heartbeat would schedule one immediately. Heartbeat usually contains status, unless disabled via settings / build flags.

Whist LWT is good to alert of subscribers vanishing, it does not, I believe, protect from the broker crashing. Certainly not in my testing. (There is a safety mechanism - SWITCH=OFF ON BROKER DISCONNECT which I already have set)

To work around this, I "poll" the relay. I send a message pattern to the relay relay/0/set and process the sequence coming back via the relay/0 topic. If I get the same patter, I know we're online.

Subscribers in this case are Espurna devices?
Is the idea for the device to do something when there are no ping->pong / alive / echo payloads?
If the idea is to keep relay ON and OFF otherwise, doesn't pulse timer already do that?

Courtesy reminder that MQTT is not request->response, but publisher->subscriber
(...or, at least it is without MQTTv5 optional publish flag that does that... :)

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

No branches or pull requests

2 participants