# Shelly Gen2 MQTT Help

**URL:** <https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024>\
**Category:** General\
**Created:** [31 October 2021 19:41 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024 "2021-10-31T19:41:37Z")\
**Posts on this page:** 18\
**Page:** 2

<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:** [1 November 2021 11:19 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/21 "2021-11-01T11:19:17Z")

</div>

With Shelly's you can disconnect the switch from the relay, so switching the switch does not need to toggle the relay., you can change state of relay separately.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [1 November 2021 11:28 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/22 "2021-11-01T11:28:30Z")

</div>

Yes, but of course the danger with relying upon the switch state, is that it could easily become out of sync with the actual light state, if for example the OP used the shelly app or voice activation to change the light state.

---

<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:** [1 November 2021 11:32 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/23 "2021-11-01T11:32:06Z")

</div>

If he changes the state of the relay then power to the light, which i think is a lifx will be turned of, so the lifx lamp will not work any way.

I would probably not use the relay and have the lifx fully powered. ( having it connected to relay does mean he can disable the lifx any time he wishes though).

I think the OP is using the switch to control the lifx lamp

---

<div class="post-metadata">

**Author:** ![CTRDevelopments](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ctrdevelopments/32/50298_2.png) [@CTRDevelopments](https://discourse.nodered.org/u/CTRDevelopments)\
**Post date:** [1 November 2021 12:02 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/24 "2021-11-01T12:02:57Z")

</div>

Yes, I use the relay as effectively a master power.

My normal use is to use the switch which using node red to command the bulb to turn on/off (not powered on/off). I also use voice commands or other automation to turn on the bulb.

Yes, it can get out of sync with the switch but this is fine for my use

---

<div class="post-metadata">

**Author:** ![CTRDevelopments](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ctrdevelopments/32/50298_2.png) [@CTRDevelopments](https://discourse.nodered.org/u/CTRDevelopments)\
**Post date:** [1 November 2021 12:06 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/25 "2021-11-01T12:06:33Z")

</div>

> [@E1cid](#):
>
> There is no "output" in the mqtt payload  
> Just a matter of moving `input:0.state` to msg.payload.

Is there an easy way if achieving this? Clearly my function node doesn't work

---

<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:** [1 November 2021 12:10 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/26 "2021-11-01T12:10:05Z")

</div>

Check my example in post 14

---

<div class="post-metadata">

**Author:** ![CTRDevelopments](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ctrdevelopments/32/50298_2.png) [@CTRDevelopments](https://discourse.nodered.org/u/CTRDevelopments)\
**Post date:** [1 November 2021 16:58 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/27 "2021-11-01T16:58:04Z")

</div>

Works perfectly, many thanks

---

<div class="post-metadata">

**Author:** ![CTRDevelopments](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ctrdevelopments/32/50298_2.png) [@CTRDevelopments](https://discourse.nodered.org/u/CTRDevelopments)\
**Post date:** [1 February 2022 09:35 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/28 "2022-02-01T09:35:43Z")

</div>

Hi, I have another linked question now, sorry.  
I want to control the relay state from node red. I can do this easily enough with the gen1 devices, but I have tried something similar to the above for the gen2 but it has not worked

any help really appreciated

cheers

```auto
[{"id":"07fd7e470e77672f","type":"tab","label":"Evening Scene","disabled":false,"info":"","env":[]},{"id":"0be5abfbd5f32acf","type":"ha-entity","z":"07fd7e470e77672f","name":"Evening_Scene","server":"1b6d2de3.6c8fc2","version":2,"debugenabled":false,"outputs":2,"entityType":"switch","config":[{"property":"name","value":"Evening Scene"},{"property":"device_class","value":""},{"property":"icon","value":"mdi:weather-night"},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":160,"y":80,"wires":[[],[]]},{"id":"dfd6bffc968aab6d","type":"hue-group","z":"07fd7e470e77672f","name":"Kitchen","bridge":"5337ec1e7bfba1c4","groupid":"1","colornamer":true,"skipevents":false,"universalevents":false,"x":1200,"y":380,"wires":[[]]},{"id":"937a56ffb984ef44","type":"server-state-changed","z":"07fd7e470e77672f","name":"Evening Scene Selected","server":"1b6d2de3.6c8fc2","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.evening_scene","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"{\"on\":true}","valueType":"str"}],"x":490,"y":360,"wires":[["f3539dcf2f5ac756","abba1d8c7f7f4801","996ff6117c295bdc"],[]]},{"id":"a30b9755ae810cb0","type":"debug","z":"07fd7e470e77672f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1070,"y":760,"wires":[]},{"id":"207446196b766ecc","type":"mqtt out","z":"07fd7e470e77672f","name":"","topic":"shellies/shelly1-Studio/relay/0/command","qos":"2","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2fd5bebaac766e96","x":1300,"y":320,"wires":[]},{"id":"f3539dcf2f5ac756","type":"change","z":"07fd7e470e77672f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":320,"wires":[["207446196b766ecc"]]},{"id":"abba1d8c7f7f4801","type":"change","z":"07fd7e470e77672f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":380,"wires":[["41fa36b44e8daf35"]]},{"id":"41fa36b44e8daf35","type":"function","z":"07fd7e470e77672f","name":"","func":"if(msg.payload==\"on\")\n{\n msg.payload={\"on\":true}\n}\n\nif(msg.payload==false)\n{\n msg.payload={\"on\":false}\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1040,"y":380,"wires":[["dfd6bffc968aab6d"]]},{"id":"b2013fc11b2a5fbc","type":"mqtt out","z":"07fd7e470e77672f","name":"","topic":"Kitchen_Main params","qos":"2","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2fd5bebaac766e96","x":1100,"y":520,"wires":[]},{"id":"996ff6117c295bdc","type":"change","z":"07fd7e470e77672f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":":{\"id\":0,\"on\":false}}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":520,"wires":[["b2013fc11b2a5fbc","a30b9755ae810cb0"]]},{"id":"1b6d2de3.6c8fc2","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30},{"id":"5337ec1e7bfba1c4","type":"hue-bridge","name":"Philips hue","bridge":"192.168.86.250","key":"S1hfxJ2iHRObyTwfh2s7jUBRTbH5CaI2a5rsxXgb","interval":"3000","disableupdates":false},{"id":"2fd5bebaac766e96","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

---

<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:** [1 February 2022 12:03 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/29 "2022-02-01T12:03:43Z")

</div>

The shelly gen2 uses rpc channel to switch the device, so the topic is totally different.

There is an example here which should be similar

> [@Shellyplus1 (gen2) Nodered to MQTT](https://discourse.nodered.org/t/shellyplus1-gen2-nodered-to-mqtt/56522/4):
>
> I do not have any gen2 devices. But what have you tried? As far as i can make out you send {"id":123, "src":"user\_1", "method":"Switch.Set", "params":{"id":0,"on":true}} to topic shelly\_id/rpc id : number/string, identifier of this request, will be used to match the response frame. Required src : string, name of the source of the request (you can choose whatever string you like to identify you as the source of the request). Required method : string, name of the procedure to be called.…

and the shelly docs here

> **[Switch | Shelly Technical Documentation](https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Switch/)**
>
> The Switch component handles a switch (relay) output terminal with optional power metering capabilities. It uses Switch as an RPC namespace and provides the following methods:

---

<div class="post-metadata">

**Author:** ![CTRDevelopments](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ctrdevelopments/32/50298_2.png) [@CTRDevelopments](https://discourse.nodered.org/u/CTRDevelopments)\
**Post date:** [1 February 2022 13:59 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/30 "2022-02-01T13:59:12Z")

</div>

I have had a good look at that and it looks like what I need. I have tried to copy it and i get nothing.

```auto
[{"id":"f6ee0c7b.18c73","type":"inject","z":"07fd7e470e77672f","name":"on","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Kitchen_Main/rpc","payload":"{\"id\":123, \"src\":\"user_1\", \"method\":\"Switch.Set\", \"params\":{\"id\":0,\"on\":true}}","payloadType":"json","x":850,"y":600,"wires":[["b2013fc11b2a5fbc","a30b9755ae810cb0"]]}]

```

using mqtt explorer I can see the device (Kitchen\_Main)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/1/f1521ca7d5e604e5dae2769daf40463b6ff9e637.png)

---

<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:** [1 February 2022 14:43 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/31 "2022-02-01T14:43:28Z")

</div>

Try `shellyplus1-a ************/rpc` as the topic. or a combination `shellyplus1-a****** /kitchen_Main/rpc`

---

<div class="post-metadata">

**Author:** ![CTRDevelopments](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ctrdevelopments/32/50298_2.png) [@CTRDevelopments](https://discourse.nodered.org/u/CTRDevelopments)\
**Post date:** [1 February 2022 14:48 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/32 "2022-02-01T14:48:53Z")

</div>

> [@E1cid](#):
>
> kitchen\_Main/rpc

I have changed to this and still no joy

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/a/ea6f5c157e3b2e437b33d394e51b042f8255fa16.png)

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fe914d93c35c8c4a4448a204defe2e44e2142ffb.png)

---

<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:** [1 February 2022 15:01 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/33 "2022-02-01T15:01:18Z")

</div>

How is the mqtt out node configured?

---

<div class="post-metadata">

**Author:** ![CTRDevelopments](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ctrdevelopments/32/50298_2.png) [@CTRDevelopments](https://discourse.nodered.org/u/CTRDevelopments)\
**Post date:** [1 February 2022 15:03 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/34 "2022-02-01T15:03:29Z")

</div>

```auto
[{"id":"b2013fc11b2a5fbc","type":"mqtt out","z":"07fd7e470e77672f","name":"","topic":"Kitchen_Main params","qos":"2","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2fd5bebaac766e96","x":1100,"y":520,"wires":[]},{"id":"2fd5bebaac766e96","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

---

<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:** [1 February 2022 15:09 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/35 "2022-02-01T15:09:13Z")

</div>

Well there is an issue, why have you set the topic in the mqtt out? If you have set it in the msg topic.

P.S. I think you should mark this topic resolved and any future issues start a new topic as it will be hard for future users to find answers if you keep adding questions.

---

<div class="post-metadata">

**Author:** ![CTRDevelopments](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ctrdevelopments/32/50298_2.png) [@CTRDevelopments](https://discourse.nodered.org/u/CTRDevelopments)\
**Post date:** [1 February 2022 15:23 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/36 "2022-02-01T15:23:11Z")

</div>

ahh, i see now, sorry for that. I will mark as closed. Many thanks for help, all working now

---

<div class="post-metadata">

**Author:** ![Joop](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@Joop](https://discourse.nodered.org/u/Joop)\
**Post date:** [11 February 2022 19:47 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/37 "2022-02-11T19:47:12Z")

</div>

try;

```auto
[
    {
        "id": "f3531e533928b6a7",
        "type": "mqtt in",
        "z": "68c5e3c3eff4dfe1",
        "name": "",
        "topic": "shellypro4pm-84cca87fb628/events/#",
        "qos": "2",
        "datatype": "auto",
        "broker": "d675b749.04b9c8",
        "nl": false,
        "rap": false,
        "rh": 0,
        "inputs": 0,
        "x": 350,
        "y": 100,
        "wires": [
            [
                "92f56d1533c4d138"
            ]
        ]
    },
    {
        "id": "92f56d1533c4d138",
        "type": "json",
        "z": "68c5e3c3eff4dfe1",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 870,
        "y": 100,
        "wires": [
            [
                "7ea807548bcdf27f",
                "4d664089e0e061d5",
                "ba76ac59e7c3ad26",
                "aaae150abf316ac3",
                "a74967b5f5449f35",
                "5d32e4102cd5386f",
                "ac1ea4a67cf6e630",
                "5e50c7807c879dcd",
                "65aec9dfa16b867b",
                "9571b76e12c7c709",
                "d90e03a5361de2d0",
                "fa90b4c4dbdc47b9",
                "c4a99c47459d8996",
                "eecb35d397df66fe",
                "04c62609515fe6bd",
                "1a321ef4781e080f"
            ]
        ]
    },
    {
        "id": "168561d3fc4fcd8d",
        "type": "link out",
        "z": "68c5e3c3eff4dfe1",
        "name": "out 0",
        "mode": "link",
        "links": [
            "02227c5d2a48142b",
            "226bd881a7a66b68"
        ],
        "x": 2070,
        "y": 100,
        "wires": [],
        "l": true
    },
    {
        "id": "8c9385582e2442aa",
        "type": "debug",
        "z": "68c5e3c3eff4dfe1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1840,
        "y": 100,
        "wires": []
    },
    {
        "id": "fa90b4c4dbdc47b9",
        "type": "change",
        "z": "68c5e3c3eff4dfe1",
        "name": "0 out",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.params[\"switch:0\"].output",
                "tot": "msg",
                "dc": true
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1030,
        "y": 100,
        "wires": [
            [
                "c0a528dc183c8cac"
            ]
        ]
    },
    {
        "id": "c0a528dc183c8cac",
        "type": "switch",
        "z": "68c5e3c3eff4dfe1",
        "name": "Relais",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1230,
        "y": 100,
        "wires": [
            [
                "b0cf35d2c8b55fc3"
            ],
            [
                "b0cf35d2c8b55fc3"
            ]
        ]
    },
    {
        "id": "b0cf35d2c8b55fc3",
        "type": "rbe",
        "z": "68c5e3c3eff4dfe1",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1430,
        "y": 100,
        "wires": [
            [
                "a7fa1b2b693a2940"
            ]
        ]
    },
    {
        "id": "c4a99c47459d8996",
        "type": "change",
        "z": "68c5e3c3eff4dfe1",
        "name": "0 volt",
        "rules": [
            {
                "t": "set",
                "p": "device",
                "pt": "msg",
                "to": "payload.params[\"switch:0\"].voltage",
                "tot": "msg",
                "dc": true
            },
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "device",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1030,
        "y": 160,
        "wires": [
            [
                "3813ba8cfe9e4ee0"
            ]
        ]
    },
    {
        "id": "4c537048ee90a982",
        "type": "debug",
        "z": "68c5e3c3eff4dfe1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1840,
        "y": 160,
        "wires": []
    },
    {
        "id": "3813ba8cfe9e4ee0",
        "type": "switch",
        "z": "68c5e3c3eff4dfe1",
        "name": "voltage",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "btwn",
                "v": "0",
                "vt": "num",
                "v2": "1000",
                "v2t": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1240,
        "y": 160,
        "wires": [
            [
                "c453f8d4fe1ff9aa"
            ],
            []
        ]
    },
    {
        "id": "3220a64104b4ab68",
        "type": "debug",
        "z": "68c5e3c3eff4dfe1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1840,
        "y": 220,
        "wires": []
    },
    {
        "id": "1b7392cab60c17bf",
        "type": "switch",
        "z": "68c5e3c3eff4dfe1",
        "name": "energie",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "btwn",
                "v": "0",
                "vt": "num",
                "v2": "3600",
                "v2t": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1240,
        "y": 220,
        "wires": [
            [
                "3220a64104b4ab68",
                "32b33a13e1918cee"
            ],
            []
        ]
    },
    {
        "id": "eecb35d397df66fe",
        "type": "change",
        "z": "68c5e3c3eff4dfe1",
        "name": "0 KVA",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.params[\"switch:1\"].output",
                "tot": "msg",
                "dc": true
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1030,
        "y": 220,
        "wires": [
            [
                "1b7392cab60c17bf"
            ]
        ]
    },
    {
        "id": "a7fa1b2b693a2940",
        "type": "change",
        "z": "68c5e3c3eff4dfe1",
        "name": "on/off",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "true",
                "fromt": "bool",
                "to": "on",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "false",
                "fromt": "bool",
                "to": "off",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1590,
        "y": 100,
        "wires": [
            [
                "8c9385582e2442aa",
                "168561d3fc4fcd8d"
            ]
        ]
    },
    {
        "id": "04c62609515fe6bd",
        "type": "change",
        "z": "68c5e3c3eff4dfe1",
        "name": "0 Input",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.params[\"input:0\"].state",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1030,
        "y": 280,
        "wires": [
            [
                "c75a45fe5d894fa5"
            ]
        ]
    },
    {
        "id": "6d205992a168df16",
        "type": "debug",
        "z": "68c5e3c3eff4dfe1",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1840,
        "y": 280,
        "wires": []
    },
    {
        "id": "c75a45fe5d894fa5",
        "type": "switch",
        "z": "68c5e3c3eff4dfe1",
        "name": "Input",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            },
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1230,
        "y": 280,
        "wires": [
            [
                "2803baba78cdbbfe"
            ],
            [
                "2803baba78cdbbfe"
            ]
        ]
    },
    {
        "id": "2803baba78cdbbfe",
        "type": "rbe",
        "z": "68c5e3c3eff4dfe1",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1430,
        "y": 280,
        "wires": [
            [
                "fe2ecd3f54c83504"
            ]
        ]
    },
    {
        "id": "fe2ecd3f54c83504",
        "type": "change",
        "z": "68c5e3c3eff4dfe1",
        "name": "on/off",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "true",
                "fromt": "bool",
                "to": "on",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "false",
                "fromt": "bool",
                "to": "off",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1590,
        "y": 280,
        "wires": [
            [
                "6d205992a168df16",
                "bfef252b429cdd86"
            ]
        ]
    },
    {
        "id": "c453f8d4fe1ff9aa",
        "type": "rbe",
        "z": "68c5e3c3eff4dfe1",
        "name": "",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 1430,
        "y": 160,
        "wires": [
            [
                "4c537048ee90a982",
                "03955e6676e1dd85"
            ]
        ]
    },
    {
        "id": "03955e6676e1dd85",
        "type": "link out",
        "z": "68c5e3c3eff4dfe1",
        "name": "volt 0",
        "mode": "link",
        "links": [
            "2f56dc712f70b770"
        ],
        "x": 2070,
        "y": 160,
        "wires": [],
        "l": true
    },
    {
        "id": "32b33a13e1918cee",
        "type": "link out",
        "z": "68c5e3c3eff4dfe1",
        "name": "watt 0",
        "mode": "link",
        "links": [
            "4a322f1075347fc8"
        ],
        "x": 2070,
        "y": 220,
        "wires": [],
        "l": true
    },
    {
        "id": "bfef252b429cdd86",
        "type": "link out",
        "z": "68c5e3c3eff4dfe1",
        "name": "input 0",
        "mode": "link",
        "links": [
            "aab074ab7ee11fb3"
        ],
        "x": 2070,
        "y": 280,
        "wires": [],
        "l": true
    },
    {
        "id": "d675b749.04b9c8",
        "type": "mqtt-broker",
        "name": "Localhost",
        "broker": "localhost",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "3",
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willPayload": "",
        "willMsg": {},
        "sessionExpiry": ""
    }
]

```

---

<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:** [25 February 2022 19:47 UTC](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024/38 "2022-02-25T19:47:44Z")

</div>

Closed on 25 February 2022 19:47 UTC

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

[Previous page](https://discourse.nodered.org/t/shelly-gen2-mqtt-help/53024.md?page=1)
