Tito Patricio Posted October 15 Share Posted October 15 There is the possibility to implement MQTT broker message with retain parameter for the Shelly H&T Gen3 device? Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
Heinz Posted October 18 Share Posted October 18 On 10/15/2024 at 4:09 PM, Tito Patricio said: There is the possibility to implement MQTT broker message with retain parameter for the Shelly H&T Gen3 device? do you want to display the message on the Display ? Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
Tito Patricio Posted October 21 Author Share Posted October 21 If I understand the question, you are asking if I want to display the message on the device display? if is this the question the anser is, no. I only need to retain the message on the MQTT broker. The usage is to have a system thats connects to the broker and gets the retained message from the Shelly H&T Gen3. Today, without retain, the message doesn't exist, on the broker, when this systens make the connection. Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
tintii Posted October 26 Share Posted October 26 I second this. I currently have a few shellies (uni plus in this particular case) where the messages are not sent with retain: 1, so whenever home assistant (or any mqtt client) connects the value shows as unavailable. Is there a way to make shelly send messages with retain: 1? Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
If_then_else Posted October 26 Share Posted October 26 This parameter can also be selected in the Shelly script. If this is really necessary, the required MQTT values can also be published via scripting. https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Mqtt/ Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
tintii Posted October 26 Share Posted October 26 Yes the script can be used. But it's kind of a work-around in this case since you need to build a script into the device itself in order to publish a message in a topic and set retain=true. What I'm after is the ability to set retain for the native topics that the device publishes to. That way, if for whatever reason I restart my MQTT client (and it happens reasonably frequently with HASS) I don't need to wait for an update to the topic by the device to set the value of the entity since retain=true it'll get the last message. Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
tintii Posted October 26 Share Posted October 26 (edited) Anyway I've taken what @If_then_else said to heart and created a simple script to update the voltage and set retain==true. https://github.com/tintii/shelly_scripts/blob/master/publish_voltage_mqtt.js note this comes with some caveats, since MQTT messages are not retained by default, if the script is not run periodically then the value of the last time the script was run will be retained. cheers Edited October 26 by tintii clarity Quote Translate Revert translation? English (American) Finnish French German Italian Portuguese (European) Spanish Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.