Possibility to force retain #941
-
Hi all, I was wondering if there is a way to force retain for all topics? Similar to the Mosquitto force-retain plugin. Because it seems that Shelly gen 2 devices (based on esp32) don't offer a way to activate the retain flag in their web interfaces. With their gen 1 devices (based on esp8266) that feature is available. So all these messages from my new Shelly devices unfortunately arrive in my Aedes broker as retain false, which is not sufficient for my use case. Although I understand that this is not a standard mqtt feature, it would be very useful for such use cases. Or if you could apply this setting to specific topics only, that would even be better... Or if somebody has another workaround, all tips are appreciated! Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
@bartbutenaers it is a good suggestion but also a risk. afaik currently aedes does not support modify PUBLISH packet on the fly, this also open a risk to misbehave the core when a modified packet is malformed, which require developers to take care of. |
Beta Was this translation helpful? Give feedback.
-
@bartbutenaers I think you can already edit the packet in the |
Beta Was this translation helpful? Give feedback.
-
Hi @gnought, @robertsLando, |
Beta Was this translation helpful? Give feedback.
-
I think I am doing something wrong. When I add this handler:
Then indeed this code will set the retain flag to true, when a message from my shelly arrives: However in my mqtt client application (Node-RED) it looks like the arriving message has still the retain flag as false: Do I perhaps need to add some extra code to update the value? |
Beta Was this translation helpful? Give feedback.
@bartbutenaers I think you can already edit the packet in the
authorizePublish
hook but be aware that you may have some unwanted results