Control Shelly Plus Plug S with "node-red-contrib-shelly" node

Hi there,

i need some help cause i´m not able to find out how to control the newer version of shelly components Gen2.

First of all i'm not the Java-Script expert ... more the copy&paste with try'n error.

So, other (older) Gen1 components (Shelly Plug s) are able to control with a function node like this:

msg.payload = {
    switch:0,
    on:true
};
return msg;

the newer Version (Gen2) Shelly Plus Plug S needs other commands. i tried some i could find here:

There´s a chapter for Shelly Node (Generation 2 and Generation 3) and the first Position is for the Shelly Plug S but not Plus Plug S i`m not sure if there´s a difference. Here I find a sample like this commad:

{
    method : 'Switch.Set'
    parameters : {
        id : 0,
        on : true,
        toggle_after : 2 // optional flip back time in seconds
    }
}

If i copy it it shows me some red signs in the function node and i have no clue ... so i need help.

I have a few Plug S which are working fine but i´d like to work the same way with the new Plus Plug S without change to MQTT ... maybe some of you can help me find a solution.

thx in advance

Hi @Flixm I dont use Shelly, but the above snippet is slightly fouled.

it should be (you were missing , after the method property) - I'm not sure if that was the problem

msg.payload = {
    method : 'Switch.Set',
    parameters : {
        id : 0,
        on : true,
        toggle_after : 2 // optional flip back time in seconds
    }
}
return msg

In a JavaScript object, each property needs to be separated with a comma, and I have wrapped it in a payload (just in case that's also missing)

1 Like

You may find it easier to use the standard mqtt out node, the topic is
<shelly_deviceid>/rpc
with payload

{
    "id":123, 
    "src":"user_1", 
    "method":"Switch.Set", 
    "params":{
        "id":0,
        "on":true
    }
}

The topic user_1/rpc would return the status of the command in a mqtt in node.

You can see the available methods and the params for each method here Switch | Shelly Technical Documentation

1 Like

Thats'it !!!

Thx a lot. Now i can finish my project, perfect.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.