Shelly via HTTP or MQTT?

Hello,

I am integrating something like 20-25 Shelleys in my brand new flat and I will connect them to home assistant.

I’m wondering which is the best way to connect them in terms of reliability but also also in terms of bandwidth consumption since I would like to avoid to create overhead in the connection.

Which protocol to you suggest? I assume that when you normally connect the Shelly via standard discovery in HA it is then connect via HTTP, correct?

Thank you,
Giulio

CoIoT unicast.

https://www.home-assistant.io/integrations/shelly/

2 Likes

Hello,

Thank you for the answer. But I just checked on a Shelly dimmer 2 and this option is not available. Am I doing something wrong?

Nothing wrong, it is not possible or required for the generation 2 devices.

Ok, then what is the suggested protocol to be used? MQTT?

Personally I prefer the core Shelly integration. For no other reason than it is extremely easy to set up and it works flawlessly.

It’s up to you, if you prefer creating your own mqtt entities you can do that instead.

Ok, thank you. I think I will follow your suggestion. I’m just wondering which protocol is using the core Shelly integration and if it is optimised for IoT communication and if it has a benefit over MQTT.

They all use the CoIoT protocol which is based on CoAP. If you do a Google search you should find some information on it. It is optimised for IoT.

My Shelly dimmer 2 does have the option to Enable ColoT. Maybe it’s only visible based on other settings.

I prefer MQTT for shelly devices except for Dimmers where I use the Shelly integration. The dimmers regularly log errors so I’m enabling CoIoT to see if that fixes them.

Hi Richard,

thank you for the answer. Currently I am testing them as hotspot, so maybe that functionality will appear once I am connected to the WIFI and updated the firmware. But looking at the documentation seems that seems that CoIoT option is present only in the first generation.

I think I will go for the shelly integration and keep you posted once everything is up and running :slight_smile:

This is a bit of an old topic, I hope you don’t mind me sharing my own findings on this.

When it comes to sensors (Shelly Flood and Shelly H&T), I ended up with MQTT over the Shelly Integration for reliability.

With a bit of tinkering, my sensors are reporting status fine to HA via MQTT, something I did not manage to get using the Shelly Integration. For relays, both Gen1 and Gen2 the official integration seems to work just fine.

1 Like

I always suggest mqtt way as long as it is possible. Not long ago I post arguments supporting my choice in this thread Shelly Dimmer with MQTT - #42 by maxym

There are definitely not all possible reasons listed.

last weeks I finally found time to migrate all iot devices to dedicated vlan. Imagine about 100 shelly devices, used by automations and shown on HA frontend.

Since using mqtt it was matter of changing ip addresses in shellies networking config (done easily through http api). No touching HA nor mqtt at all. I cannot imagine to do the same if using the integration (several days ago I saw post saying that the integration uses shelly device address as main identifier).

Not that we do such migrations every day. Just an another benefit of having those systems separated from each other.

2 Likes

Even with three Shelly 1s acting as garage door relays, it’s too much to have to hand-hold extremely simple embedded devices.

CoIoT appears to be fragile, every firewall change causes the shellys to go offline, templated devices unavailable…

reconfigured my firewall rules today, and shellys are offline. finally had enough and I’m abandoning the gold-plated integration and switching to mqtt. hoping to configure and forget like my two dozen teslamate mqtt sensors that never let me down. if the shelly integration doesn’t work with mqtt, it won’t work for me

I don’t think this is correct. I’m now using static IPs, but I’ve changed addresses before with no issues.

1 Like

I’ve been using CoIoT since the start for Shelly/HA, and I don’t know if something’s changed lately, but I find it unusable for anything that requires quick response from HA based on status from the Shelly device.

For example:

I’m using it for Shelly 1 on momentary light switches - not so important to have HT recognize immediately when the light is manually turned on.

Using it with Shelly Uni for a doorbell sensor - very important to have immediate response in HA - but HA takes upwards of 10-20 seconds to recognize when a button has been activated on the shelly device - sometimes it never recognizes it or if it does, typically it never turns off. It never responds quick enough to recognize a normal doorbell press as that can’t possibly use a 20 second on period. It used to work fine/well in the past with near-instant response.

It seems to work OK for activating the device based on actions within HA - so outbound communication from HA.

One year later. About 25 shelly devices connected and so far I am doing fine with the native Shelly integration. Initial issues I had were due to a very cheap router provided by my ISP.

1 Like

What do you mean with native Shelly integration?

Soon, I will order my first Shelly device, the Shelly 1 relay. I want to control a dumb switch located in the garage. So, I thought I could simply attach Shelly 1 relay in the dumb switch.

You can just attach the Shelly device to your dumb switch and then integrate it to your Wi-Fi network, then Home Assistant will automatically detect it and if you follow the steps (a couple of click only) it will be integrated using the Shelly native integration.

However, if you prefer using MQTT, the Shelly also supports that. I’m not gonna explore here the benefits of each choice… If you don’t know this already, just follow the steps proposed by HA when you install your Shelly device and you will be good.

1 Like

For a garage door you will need a Shelly 2.5. Shelly 1 are only for lights/power outlet. Btw I suggest you to use Shelly 1 plus version which according to what I read seems to be more reliable.

1 Like

It does depend on your motor unit.
I use a Shelly 1 for my garage door, using it as a dry contact relay to trigger the override switch.

I have a Reed switch to detect if the door is closed.
The only downside is no spare GPIO for detecting fully open if it is fully open.

I have flashed an ESPHome firmware onto it though.

Because it is a dry contact relay I can power the Shelly off the 30v DC accessory feed on the motor unit itself.