correct Shelly config

Posted on
Sat Jul 11, 2020 5:32 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

correct Shelly config

The plugin works brilliantly, thanks, especially the detached switch capability.

Can I confirm what are the appropriate Shelly MQTT config settings? - for clean session & retain.

Posted on
Mon Jul 13, 2020 6:42 pm
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: correct Shelly config

agame wrote:
The plugin works brilliantly, thanks, especially the detached switch capability.

Can I confirm what are the appropriate Shelly MQTT config settings? - for clean session & retain.


Sorry for the late reply! I'm glad the plugin fits your needs.

I think this is a good reference (https://www.hivemq.com/blog/mqtt-essentials-part-7-persistent-session-queuing-messages/), but I can summarize to answer your questions.

Clean Session is used to indicate persistent connections between a device and a broker. I am assuming you are asking these questions to populate the Shelly device config (not the config in my plugin or the Connector plugin). A persistent connection uses device ID's so that the broker can identify clients when they connect or lose connection. The broker can then keep track of missed messages and which topics a device was subscribed to when they reconnect. This is really only relevant when a QoS of 1 or 2 is used (which guarantees delivery at least once / exactly once respectively). It is fairly common to use a QoS of 0 (message delivery of at most once) which does not guarantee delivery (think TCP vs UDP if that helps). Since most setups are over internal networks, a QoS of 0 is common and usually doesn't have any issues with missed messages. The QoS between my plugin and brokers is internally set to 0 (which I guess should probably be configurable...) TLDR; clean session will have no effect if the QoS setting configured on your Shelly device is set to 0.

Retain is pretty neat as is stores the most recent value for a topic. This is nice for devices that don't publish frequently. If a value gets published every 3 hours, then another device might have to wait another 3 hours after connecting to get a value from the topic. Enabling retain would allow a client to get the last know value immediately after subscribing to a topic. I find this unnecessary for the Shelly devices because by default they publish their states every 30 seconds. Worst case is the plugin takes 30 seconds to get data for all of your devices if you reloaded the plugin.

Hopefully this answers your questions!

Posted on
Mon Jul 13, 2020 8:37 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: correct Shelly config

really helpful, thanks.
Still getting my head around MQTT!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest