Jump to content
🌟 Shop Black Friday - up to 50% OFF 🌟 Black-Friday-Angebote - bis zu 50% Rabatt! 🌟 Offres Black Friday : jusqu’à -50%! 🌟 ×

Recommended Posts

Posted

Hello everyone,

I have spent several days looking for a solution that, I think, should be so simple, but I am having no success.

I am using Node Red on a Victron Cerbo GX for programming.  I want to use this relay to control a circuit based on certain Inverter conditions.  My first step is to get a basic control of the Shelly relay.  I am not using Home Assistant software.

The relay is registered on my local network.  I can login to the relay at that IP and turn it on/off.  I can access the relay using the Shelly App and control it.

I used the Node Red MQTT node to set up my MQTT broker access, and I registered the Shelly with the broker.  I have used MQTT Explorer tto look at the MQTT  broker and I see the relay with its ID.

I thought I would set up a simple flow with two injection nodes, one to turn 'On' and one to turn 'Off' the relay.  I am stuck.  I have tried various messages and commands and nothing is working.   I have read the documentation but it does not address using Node Red for the commands directly.

Any help would be appreciated.  Please let me know what pictures or setting you would like to see.  In the Shelly MQTT page, my device identifies as  shellyplus1pm-90380c36f9e4.

John

 

Posted

image.thumb.png.92f9cd8be04ddf08061ef36dd50544b9.png

The above is the Settings page for my device.  I got to this page by entering the local ip address for this device.  From this page, I see the client ID is "shellyplus1pm-90380c36f9e4".  My venus.local:1883 is at 192.168.50.107, and the shelly device is at 192.168.50.189.  I can turn the switch on and off from the Home page.

 

From the Shelly app, I can confirm that the device is connected to my local network and the client ID matches.  I can turn the switch off and on from the app.

I found the following technical page:

Shelly1/1PM: MQTT

Shelly1 and Shelly1PM uses the following topics, where <model> is either shelly1 or shelly1pm:

  • shellies/<model>-<deviceid>/relay/0 to report status: on, off or overpower (the latter only for Shelly1PM)
  • shellies/<model>-<deviceid>/relay/0/command accepts on, off or toggle and applies accordingly
  • shellies/<model>-<deviceid>/input/0 reports the state of the SW terminal
  • shellies/<model>-<deviceid>/longpush/0 reports longpush state as 0 (shortpush) or 1 (longpush)
  • shellies/<model>-<deviceid>/input_event/0 reports input event and event counter, e.g.: {"event":"S","event_cnt":2} see /status for details

Shelly1PM adds:

  • shellies/shelly1pm-<deviceid>/relay/0/power reports instantaneous power in Watts
  • shellies/shelly1pm-<deviceid>/relay/0/energy reports an incrementing energy counter in Watt-minute
  • shellies/shelly1pm-<deviceid>/temperature reports internal device temperature in °C
  • shellies/shelly1pm-<deviceid>/temperature_f reports internal device temperature in °F
  • shellies/shelly1pm-<deviceid>/overtemperature reports 1 when device has overheated, normally 0
  • shellies/shelly1pm-<deviceid>/temperature_status reports Normal, High, Very High
  • shellies/shelly1pm-<deviceid>/relay/0/overpower_value reports the value in Watts, on which an overpower condition is detected

If Shelly1/1PM is equipped with a temperature add-on, following topics are published as well:

From this list I am trying to use:  shellies/<model>-<deviceid>/relay/0/command accepts on, off or toggle and applies accordingly.  For /<model>-<deviceid>/ I am inserting /shellyplus1pm-90380c36f9e4/.

SimpleFlow.png.090c00acd7e424594453c39fdebacf4e.png

This is my very simple test flow.  It consists of an Injection Node, an MQTT out node, and MQTT In node and a Debug node.  When I click the Injection node, the Debug node reports "

4/9/2024, 1:24:34 PMnode: debug 4shellies/shellyplus1pm.90380c36f9e4/relay/0/command : msg.payload : string[2]

"on""

 

The MQTT Explorer shows the following

 

 

 

MQTTExplorer.thumb.png.954cca1dc548fd8d2a36d1677f29bfd1.png

Notice that shellies/input/0 command = on is displayed.  The relay does not respond.  Any help or suggestions would be appreciated.

  • 1 month later...
Posted (edited)

Hi John, the topic you are publishing is wrong. It should read    shellyplus1pm-90380c36f9e4/command/switch:0

(You omitted the "switch:0" part). Publishing "on" or "off" to this topic will do the trick.

And I would suggest to configure a meaningful mqtt prefix in the web. In the mqtt topic you can then use that prefix instead of the  12 digit device id.

Edited by Thomas

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...