Integrate Shelly Plus 1 with the Ilevia system

How to configure the Shelly Plus 1 device with the MQTT protocol so it can be managed with the Ilevia system.

INTRODUCTION

This guide explains how to integrate the Shelly Plus 1 device with the Ilevia system via the MQTT protocol, so that it can be controlled from Ilevia Manager and the Ilevia Control app.

Web interface configuration of the Shelly device

Step 1:

Access the Shelly device web page by entering its local IP address in your web browser search bar, then go to the Networks section.

Accessing the Shelly device web page

Step 2:

1. Open the MQTT menu. 2. Enable the Generic status update over MQTT option. 3. Add the local IP address of the Ilevia server. 4. Click APPLY to confirm the changes: the device will restart.

Enabling the MQTT protocol on the Shelly device for connection to the Ilevia server

Ilevia Manager project configuration

Step 3:

1. Open Ilevia Manager and create a new gateway. 2. Set the protocol to MQTT broker. 3. Set the “Address” parameter by entering the IP address of the Ilevia server. 4. Finally, set the Quality of service to “Exactly once”.

Creating an MQTT gateway in the Ilevia Manager software

Step 4:

Add a new Switch component and make sure it uses the newly created gateway (MQTT).

Creating a component in the Ilevia Manager project to complete MQTT configuration

Step 5:

The first topic to configure is the Topic Write, that is, the one used to write the command. The topic to configure is: “<shelly-deviceID>/rpc”, where <shelly-deviceID> must be replaced with your device ID. All information on JSON setup is available on the Shelly website.

NOTE: the script shown in the figure is not displayed in full. Click here to view the script.

Setting the Write Topic for sending commands to the Shelly device via MQTT

The second topic to configure is the Topic Event, that is, the one used to receive the status from the Shelly device. The topic to configure is: “<shelly-deviceID>/status/switch:0”, where <shelly-deviceID> must be replaced with your device ID. All information on JSON setup is available on the Shelly website.

Step 6:The second topic to configure is the Topic Event, that is, the topic used to receive the status from the Shelly device. The topic to configure is: “<shelly-deviceID>/status/switch:0”, where <shelly-deviceID> is replaced by your device ID. All information regarding JSON setup is provided on the Shelly website.

NOTE: the script shown in the figure is not displayed in full. Click here to view the script.

Event topic configuration for receiving the status of the Shelly Plus 1 device

Step 7:

Add the component to the user interface and upload the project to the server, entering the correct IP address.

Adding the component configured with MQTT to the user interface and uploading the project to the Ilevia server

Functionality test

Step 8:

For illustrative purposes, we will use the MQTT fx software to view the flow of the various topics in the MQTT broker. For the complete MQTT fx configuration, refer to this guide. Once MQTT fx is configured, connect to the Ilevia server broker.

Connecting to the broker with MQTT fx software to view the messages passing through the Ilevia server broker

Step 9:

As shown in the image below, clicking the icon of our switch in the user interface of the Ilevia Control app sends the command and, as a result, the device status is received.

Subscribing to topics to view the messages passing between the Ilevia server and the MQTT device

Step 10:

As you can see in the image below, clicking the icon in the user interface turns the Shelly device on and off.

Testing the MQTT configurations made in the project

Click the link to download the Shelly Plus 1 sample project and try it.

Download the project here!

Find out more about our Shelly dedicated solution

Contact us.

Last updated: