Wireless or wired Mosquitto server.

Posted on
Sun Feb 28, 2021 3:03 am
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

Wireless or wired Mosquitto server.

Hi guys,

Thanks to the fantastic Shelly and Connect plugins so have I been able to control my Sonos with Shelly I3 devices and different scenes.

My Mosquitto server is running on a wireless RPI zero, it was a quick solution and have been serving well for my purpose.

Now to my question, not sure if this is the right forum to ask but I will give it a try.

I’m controlling the sound on my Sonos with wall push buttons that triggers a Shelly I3 that sends the payload to an AP > Switch > AP > RPI with Mosquitto server > AP > Switch > Lan > Sonos .

There is a small delay that normally not bother me but with push buttons and sound I would like to have a quicker response.

Will the response be significantly quicker if I replace the RPI Zero with a RPI 4 that is connected with Ethernet instead of wireless?
Will I gain a lot with running my Mosquitto server over Ethernet instead of wireless.
My Wi-Fi in not bad but not as quick as my Cat6 cables.


Skickat från min iPad med Tapatalk

Posted on
Sun Feb 28, 2021 7:04 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Wireless or wired Mosquitto server.

It'll knock a few milliseconds off the time, but I doubt it would be enough to notice.

If Indigo and a few plugins are central to the control scheme, then eliminating the network hops totally and putting the MQTT broker on the same machine as Indigo might speed things up. You could run the MQTT broker in a Docker container on the Mac.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Feb 28, 2021 8:27 am
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: Wireless or wired Mosquitto server.

Yeah I agree with Joe's response - going hardwire probably won't make a noticeable difference unless you have a REALLY bad wireless network.

Have you narrowed it down to MQTT being the slow-down in your scenario? I'm not familiar with using Sonos with Indigo, but could this be the cause of the delay you are seeing? Also, how are you triggering off of the Shelly i3? You could either be triggering off of the raw state change or by using a trigger on the custom plugin-defined input events. If you are using the input events, maybe try switching to the raw state trigger. The Shelly device has to actually wait to determine what button combination you pressed.

For example, lets say you have it configured that a double-press is any 2 presses within 250ms. I believe the Shelly i3 has to wait the entire 250ms to see if you press the button again in order for it to determine if it will send a single-press or double-press event. Therefore, if you perform a single-press, then the Shelly would wait 250ms before sending the single-press event over MQTT. I'm not sure what the default values are for these time periods, but it could certainly be the cause.

I'm interested to hear which method you are using. There may be some tuning we could do to speed things up on the Shelly-side.

Edit:
I just looked around the Shelly documentation, and it seems like the i3 is set to allow up to 500ms between these multi-push input events. Are you seeing a delay of about 0.5 seconds after pressing your switches connected to the i3?

Code: Select all
"multipush_time_between_pushes_ms": {
    "max": 500
},

Posted on
Sun Feb 28, 2021 10:45 am
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

Re: Wireless or wired Mosquitto server.

FlyingDiver
I tried to run Docker on my 2012 Minimac and at first it was ok but it was getting slower and slower. I tried to change settings but wasn’t successful. I’m also running SecuritySpy on my minimac and don’t want to stress the minimac any further. If I upgrade my minimac I would certainly consider to run Docker on it.

My delays are not long, we are talking about milliseconds and I can live with them, just curious of how I could improve it. Most discussions is how important speed is if you want to transfer a large file and not so much about small messages.

Aaronlionsheep

When I moved my MQTT server from my minimac to the RPI I also installed Node Red to test it.
Unfortunately the Indigo Sonos plugin don’t seems to be updated, there are no documentation online anymore, you can’t play Spoity with it and Pandora and Sirius is only working inside US. For me it was an easy choice to try Node Red and Sonos.

I’m using the switches for sound control in toggle mode and activate an dimming node that was intended to adjust lights but I got it to work with sound control. One button to raise the volume and another to lover the volume. As long as I push a button it will slowly raise/lover.

For all other applications I use the multi push and know that it will take some time between the final push and the result.

Still like the ShellyMqtt and I will order more devices for it.


Skickat från min iPad med Tapatalk

Posted on
Sun Feb 28, 2021 1:02 pm
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: Wireless or wired Mosquitto server.

tazswe wrote:
Aaronlionsheep

When I moved my MQTT server from my minimac to the RPI I also installed Node Red to test it.
Unfortunately the Indigo Sonos plugin don’t seems to be updated, there are no documentation online anymore, you can’t play Spoity with it and Pandora and Sirius is only working inside US. For me it was an easy choice to try Node Red and Sonos.

I’m using the switches for sound control in toggle mode and activate an dimming node that was intended to adjust lights but I got it to work with sound control. One button to raise the volume and another to lover the volume. As long as I push a button it will slowly raise/lover.

For all other applications I use the multi push and know that it will take some time between the final push and the result.


Well I'm glad to hear you are just talking about some small delays here. If you'd like, you could install the MQTT broker directly to your Mac mini and skip the overhead of running Docker. I personally use ActiveMQ which is very overkill for what we are doing with MQTT. I like it because it is very robust and there is no "install". I just download the package and run the start script contained in the directory. I have ActiveMQ running on the same machine as Indigo and this is a 2007 Mac mini which is still going strong. I think the UI on my Macintosh SE is more responsive though :mrgreen:

tazswe wrote:
Still like the ShellyMqtt and I will order more devices for it.


I am glad you like the plugin now that you have the MQTT setup all figured out. I have support coming for the Shelly Uni and CliveS has the Shelly Motion already and sent me the API. Shelly seems to be slow getting their documentation published, but I am trying to reach out and see if they have a developer program that I can get into. I'd like to get some of these device supported quicker. Or maybe I will get lucky and get some samples :lol:

As always, feel free to give any feedback as you get some more devices!

Thanks,
Aaron

Posted on
Sun Feb 28, 2021 4:11 pm
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Wireless or wired Mosquitto server.

Then indigo Spotify plugin might not be being updated but it still works. You could separate out the control. Use indigo for volume and node red for extra control for other inputs?
I use zwave and zigbee wireless controllers to control volume and pause/play and Unless I have zwave congestion it’s pretty instant. The zigbee works well, also over mqtt but goes from zigbee usb stick on Mac to broker on Nas back to Mac all over Cat 6 so probably faster than negotiating WiFi. Watching the messages I’d be hard pushed to say it’s not instant.

Posted on
Sun Feb 28, 2021 5:48 pm
tazswe offline
Posts: 211
Joined: Mar 13, 2017
Location: Sweden

Re: Wireless or wired Mosquitto server.

I have played around a little and pinged all my Shellies and my minimac from my IPad with the Fing app. The response time was in average about 2ms and no packet loss. On my RPI running my mqtt server the response time was about 5ms but it had a lot of spikes over 2000ms and up to 30% packet loss. I will move it to another location but also get a lan connection for it.

Will also follow your advise and have a look at the ActiveMQ server and try to compare my set up for volume with the one in the Sonos plugin.


Skickat från min iPad med Tapatalk

Posted on
Sun Feb 28, 2021 5:58 pm
aaronlionsheep offline
Posts: 260
Joined: Feb 24, 2019
Location: Virginia, USA

Re: Wireless or wired Mosquitto server.

tazswe wrote:
I have played around a little and pinged all my Shellies and my minimac from my IPad with the Fing app. The response time was in average about 2ms and no packet loss. On my RPI running my mqtt server the response time was about 5ms but it had a lot of spikes over 2000ms and up to 30% packet loss. I will move it to another location but also get a lan connection for it.

Will also follow your advise and have a look at the ActiveMQ server and try to compare my set up for volume with the one in the Sonos plugin.


Skickat från min iPad med Tapatalk


Interesting, so you may actually see a benefit from going to a hardwire connection with a RPi 4.

One thing to note about ActiveMQ is that is requires Java (version 8 I think), so make of that what you will. Just running Mosquito and installing through Homebrew is definitely something to look at too. https://formulae.brew.sh/formula/mosquitto#default

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests