Shelly 2.5: How to Configure Double Click and Long Click

Detect multi-clicks using Home Assistant with default integration for Shelly 2.5

Roman Orac

--

Photo by R ARCHITECTURE on Unsplash

If you’re building a Smart Home, the chances are you’re already familiar with Shelly 2.5 relays.

Shelly 2.5 is one of the most popular relays for controling electric roller shutters using WiFi.

One annoying downside of this relay is that it does not recognize different types of clicks of the box.

In this article, I describe how to detect multi-clicks using Home Assistant with default integration for Shelly 2.5 (using CoIoT and Roller Shutter device type).

Intro

I’m a Shely user for more than a year and they mostly work well.

“Mostly” because they sometimes drop off WiFi for no reason.

By diving deeper into this issue, I discovered that the reason could be in the MQTT protocol instead of the recommened CoIoT.

I’ve decided to give CoIoT a try and since enabling it, I haven’t observed a Shelly droping off WiFi, which is nice.

Another problem appeared when I switched to the default Home Assistant integration for Shelly with CoIoT…

My use case with Shelly 2.5 is to control an electric roller shutter with a momentary switch:

  • single press moves the shutter as long as the switch is pressed then it stops,
  • long press moves it all the way to a fully open or closed state.

The problem is that Shelly 2.5 doesn’t send click events when set to Roller Shutter device type, so it’s not possible to detect different types of clicks.

This solution works with Momentary button type (Image by author).

Solution

The solution is to define binary sensors based on Shelly state changes. The binary sensors detect when the open or close button is pressed.

To make the code more organized, I added the snippet below to configuration.yaml and defined sensors in a new binary_sensors.yaml file:

--

--