Using the Node-Red Shelly Nodes

Shelly devices support both the http and the MQTT protocol and you can use either protocol to control and change the settings of Shelly devices.

Just as with Tasmota devices you can use either the standard HTTP and MQTT nodes or alternatively install the Shelly nodes.



Shelly HTTP Nodes

These are installed via the manage Pallete option and are called node-red-contrib-shelly.

Shelly-nodes-install
When you install them a menu group called Shelly is created with three nodes as shown below:

shelly-nodes-menu

To use you simple drag and drop into the workspace. A simple flow is shown below:

simple-shelly-flow

Before you can use it you will need to configure the node.You will need to add.

  1. IP or host name of the device
  2. description -optional
  3. User name -optional device dependant
  4. Password –optional device dependant
  5. relay type
  6. Polling or Callbacks
  7. Callback settings if callbacks used
  8. Polling interval if polling used.
  9. Polling Interval
  10. enable status output after poll and each command should normally be enabled

Polling and Callbacks

These are ways of determining the status of the Shelly device. The node documentation has a good description of these options.

Polling is easy to use and configure and is is old an trusted technique.

All you need to do is to set the polling interval. I choose 5 secs as a reasonable compromise.

Node Output

Provided you have enabled status output after each poll then you should see the device status along with other data on the output node.

Node Input

You need to inject a JSON array on msg.payload.

You can change device settings and also give device commands. In the case of a simple relay like Shelly 1 this is simply turning the device on and off.

Again the documentation gives examples. The example flow has two examples to turn the device off with a timer (turns back on after time out) and to turn off without timer.

Shelly Nodes vs Generic HTTP nodes

Using the Shelly nodes as opposed to the generic HTTP node is much easier as you don’t need to worry about building the correct URL.

Shelly MQTT Node

This you need to install via the manage pallete.It is called node-red-contrib-shellymqtt.

shellymqtt

It creates a single node in the nodes menu under the shelly group

shelly-mqtt-node

The node is a wrapper for the MQTT node and allows you to send a single action to a single Shelly device.

shelly mqtt-node-scree

It also allows you to monitor the state of a single device.

The big advantage is that you don’t need to understand the topic or payload structure to use it.

Documentation is here

Shelly MQTT Nodes vs Generic MQTT Node

The Shelly MQTT node is useful if you only have one or two Shelly devices but not really of use if you have lots of devices.

It doesn’t allow you to set any device settings like you can with the generic MQTT node.

Summary

Although the Shelly HTTP and MQTT nodes are useful for getting started and managing a few Shelly devices they are not really suitable for more than a few devices with basic control requirements.

Related Tutorials and resources:

Click to rate this post!
[Total: 1 Average: 5]

Leave a Reply

Your email address will not be published. Required fields are marked *