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

**URL:** <https://discourse.nodered.org/t/control-shelly-plus-plug-s-with-node-red-contrib-shelly-node/90973>\
**Category:** General\
**Created:** [14 September 2024 13:21 UTC](https://discourse.nodered.org/t/control-shelly-plus-plug-s-with-node-red-contrib-shelly-node/90973 "2024-09-14T13:21:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flixm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flixm/32/17122_2.png) [@Flixm](https://discourse.nodered.org/u/Flixm)\
**Post date:** [14 September 2024 13:21 UTC](https://discourse.nodered.org/t/control-shelly-plus-plug-s-with-node-red-contrib-shelly-node/90973/1 "2024-09-14T13:21:19Z")

</div>

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:

```auto
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:

> **[node-red-contrib-shelly](https://flows.nodered.org/node/node-red-contrib-shelly)**
>
> Shelly nodes.

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:

```auto
{
    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

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [14 September 2024 14:13 UTC](https://discourse.nodered.org/t/control-shelly-plus-plug-s-with-node-red-contrib-shelly-node/90973/2 "2024-09-14T14:13:46Z")

</div>

> [@Flixm](#):
>
> ```auto
> {
> 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.

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

```auto
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)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [14 September 2024 15:12 UTC](https://discourse.nodered.org/t/control-shelly-plus-plug-s-with-node-red-contrib-shelly-node/90973/3 "2024-09-14T15:12:19Z")

</div>

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

```auto
{
    "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](https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Switch/)

---

<div class="post-metadata">

**Author:** ![Flixm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flixm/32/17122_2.png) [@Flixm](https://discourse.nodered.org/u/Flixm)\
**Post date:** [14 September 2024 19:31 UTC](https://discourse.nodered.org/t/control-shelly-plus-plug-s-with-node-red-contrib-shelly-node/90973/4 "2024-09-14T19:31:34Z")

</div>

Thats'it !!!

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 September 2024 19:31 UTC](https://discourse.nodered.org/t/control-shelly-plus-plug-s-with-node-red-contrib-shelly-node/90973/5 "2024-09-28T19:31:53Z")

</div>

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