Usually we try to make building automation systems (including Smart Home) using only wired technology. In any case, when designing we try to adhere to this principle, considering wired technologies to be more reliable.
But sometimes it is difficult to do. All furnish is already made, and the customer asks. Or the project has already been completed on wired technologies, and I also wanted to expand the functionality and add new devices.

How to be?

Now there are Xiaomi devices. Cheap and high quality devices. Sensors are generally super. But with sockets and switches there is one nuance. These devices come in one single design solution.

Stumbled upon a very interesting device – Shelly

Shelly 1 is a wifi relay. It is installed in the box behind any push-button switch.
Built-in web server with support for HTTP commands. There is a description of the REST API
There is support for MQTT protocol.
Almost everything you need. At the same time a very tasty price (10 euros).

Booked on eBay. We will try.

Shelly 1 - Testing

Shelly 1 WiFi relay finally arrived. We try.

We connect the device to the network 220V. Turn on. Go to the device via the web interface:

You can immediately try to turn on / off the relay.

We connect to the intraHouse system

This relay can be connected to the intraHouse system in two ways.
1. Using HTTP plugin
2. Using MQTT plugin

Option 1. Connecting Shelly 1 using the HTTP plugin

Add a block of channels and register the address of the relay Shelly 1:

The survey period set 5 seconds.

Add a channel and fill in the following fields:

  • Device – choose from the list of available devices. In this example, LAMP_1_4
  • Parser – JSON
  • Extract JSON data – data.ison

On the “Actions” tab, fill in the following fields:

  • URL string to ON
  • URL string to OFF

At this setting is over. Go to the user interface and try to click on the lamp LAMP_1_4:

Option 2. Connecting Shelly 1 using the MQTT plugin

To operate the Shelly 1 relay using the MQTT protocol, the following settings must be made on the relay itself:

  • Put permission check MQTT
  • Enter the name and password for the MQTT broker. In our testing, the broker works without authorization. These fields are not filled.
  • Enter the broker’s MQTT address

In the intraHouse system, install the MQTT plugin and perform the following settings:

  • MQTT broker address
  • MQTT Broker Port

Add the MQTT plug-in channel and fill in the following fields:

  • Topic – subscription to the device status
  • Device – binding to a device in the intraHouse system

In the format of the topic there is a device ID. You can find it here:

The relay sends the broker its status in the “on” and “off”
Need to convert. Fill in the form of transformation of incoming values: (value == “on”)?1:0
If the value of the state on (value == “on”) arrives, we transfer one, otherwise zero.

We have subscribed to the topic of the state of the relay. Now write the management topics:

For the Switch On command, write the topic: shellies/shelly1-12BAAE/relay/0/command and message “on
For the Switch Off command, write the topic: shellies/shelly1-12BAAE/relay/0/command and message “off

This completes the setting for the MQTT plugin. In the user interface, you can try the operation of the relay.


WiFi relay Shelly 1 meets almost all of our requirements.

Main parameters:

  • Control via WiFi and locally from any button or key switch. The type of switch is configured in the web interface of the relay.
  • Support MQTT protocol.
  • Very compact.
  • A load connection up to 16A is declared. Nevertheless, I would not dare to connect irons or heaters.

From the point of view of connecting to the intraHouse system, you can choose any option. With the MQTT plug-in, the response in the user interface is faster when a relay triggers. But you need to install the broker MQTT.

Leave a Reply

Close Menu