Mqtt node issue... bug or setting?

I have a mqtt in node "zigbee2mqtt/Garage Remote/action"
If the device sends a signal to mqtt without the "action" part of the json, node red still triggers and sends the "action" from the previous message.
This causes my switched to be very flakey as they are constantly being toggles to the previous state.

Is this a bug, or some node-red mqtt setting?

I am still learning, but the topic.

All my MQTT IN nodes have their topic ending in /#

So I would have the node (in your case) set to:
zigbee2mqtt/Garage Remote/action/#
or (if I am wrong)
zigbee2mqtt/Garage Remote/#
Then check if action is valid/sent.

That may help with stopping the wrong types of messages getting through.

Im still playing with it, but it may have been some kind of QOS issue...
What does the # on the end do?

The qos is Quality Of Service.
That controls how the message is sent.

Also the retain flag can cause problems.
Set it to FALSE for now.

QOS (from the help in the node's help section)

qos number
    0, fire and forget - 1, at least once - 2, once and once only.
retain boolean
    true indicates the message was retained and may be old.

There will be other messages sent and if you don't filter them in your code other messages when they come through may cause problems if they don't have the required part of the message.

Stick an MQTT IN node and have it listening to zigbee2mqtt/Garage Remote/#
Put a debug node on it and get the debug to show COMPLETE message.

(This may take some time)

Watch for messages that don't have your required structure.
That may help find out how/why (and who) is sending the messages.

I hope it is not an intermittent problem.

Oh, sorry... the # at the end is a wild card.
Similar to * in windows.

So you can put in the topic:
zigbee2mqtt/Garage Remote/# it will listen to anything below that path.
You could put:
zigbee2mqtt/# and that would listen to all stuff that the zigbee2mqtt is sending.
(If it is sending on any other channel/topic)
It can be handy if you have things sending messages with complicated topic structures.
Say....
zigbee2mqtt/Garage Remote/action
zigbee2mqtt/FrontDoor Remote/action
zigbee2mqtt/BackDoor Remote/action
zigbee2mqtt/Lights/Front/action
zigbee2mqtt/Lights/Back/action
You could have a topic set to:
zigbee2mqtt/#/action and any/all actions would be shown.
You wouldn't need to enter all the paths.

(but I kind of went off track there.) This is an EXAMPLE only.

No, that would not be correct.
The # would be last thing . If you want a wildcard in the middle of a topic use +

1 Like

Thanks.

(I hope you can do a better job at helping than I am/was doing.)

Probably your flow setup, hard to say without seeing your flow.

If you put a switch node after the mqtt node and set it to has key action, then only objects that have an action will pass. (assuming your mqtt outputs an object)

Looking at this again. I think it is actually the switch device...
Im investigating zigbee2mqtt debounce and reporting limiting at the moment to see if this helps.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.