# Shelly Plus Wall dimmer switch

**URL:** https://discourse.nodered.org/t/shelly-plus-wall-dimmer-switch/89305
**Category:** General
**Tags:** docker, mqtt
**Created:** [5 July 2024 21:07 UTC](https://discourse.nodered.org/t/shelly-plus-wall-dimmer-switch/89305 "2024-07-05T21:07:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Charlietuna](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@Charlietuna](https://discourse.nodered.org/u/Charlietuna)
#### Post date: [5 July 2024 21:07 UTC](https://discourse.nodered.org/t/shelly-plus-wall-dimmer-switch/89305/1 "2024-07-05T21:07:23Z")

</div>

Hi All,  
I need your help. I am pretty much a novice with Node Red, HA, and MQTT. However, I have set up several flows to turn on and off lights based on motion and door sensors. I am using HA, Node Red, and Mosquitto in a Docker container. I have used MQTT Explored, and I am able to see messages, and I also know that in the data object there is an attribute brightness or brightness\_pct. I’ve read the Shelly documentation which gets me no where.I’ve looked on this forum. I’ve looked at various YouTubes with some help. I have used the MQTT in and out nodes for subscribe and publish. I just don’t understand the Shelly API documentation.  
It’s something like ShellyId/events/rpc/command, but after that I’m stuck.  
TIA,  
Steve

---

<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: [6 July 2024 07:46 UTC](https://discourse.nodered.org/t/shelly-plus-wall-dimmer-switch/89305/2 "2024-07-06T07:46:11Z")

</div>

Here is a example flow untested as i do not have a wall dimmer

```auto
[{"id":"7fadbcca8501f4ce","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"id\":123,\"src\":\"wall_dimmer_response_topic\",\"method\":\"light.set\",\"params\":{\"id\":0,\"on\":true,\"brightness\":50}}","payloadType":"json","x":150,"y":120,"wires":[["c8197469af9849cf"]]},{"id":"c8197469af9849cf","type":"mqtt out","z":"d1395164b4eec73e","name":"","topic":"<shelly_device_id>/rpc","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e8ba3ef5.22f4a8","x":340,"y":120,"wires":[]},{"id":"d76a5a38dd1df171","type":"mqtt in","z":"d1395164b4eec73e","name":"","topic":"wall_dimmer_response_topic/rpc","qos":"2","datatype":"auto-detect","broker":"e8ba3ef5.22f4a8","nl":false,"rap":true,"rh":0,"inputs":0,"x":210,"y":200,"wires":[["cbaf3b776bc67c2f"]]},{"id":"cbaf3b776bc67c2f","type":"debug","z":"d1395164b4eec73e","name":"debug 2558","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":390,"y":200,"wires":[]},{"id":"e8ba3ef5.22f4a8","type":"mqtt-broker","name":"testb","broker":"192.168.1.10","port":"1883","clientid":"","autoConnect":true,"usetls":false,"compatmode":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

```

```auto
topic 
<shellyid>/rpc

payload
{
    "id": 123,
    "src": "wall_dimmer_response_topic",
    "method": "light.set",
    "params": {
        "id": 0,
        "on": true,
        "brightness": 50
    }
}

```

The response mqtt topic is set in the "src" of the payload.  
You will need to add your shelly device id in the mqtt out topic.

Some example here under mqtt section. [RPC Channels | Shelly Technical Documentation](https://shelly-api-docs.shelly.cloud/gen2/General/RPCChannels)  
-t is the topic -m is the payload  
Here are the methods available [Light | Shelly Technical Documentation](https://shelly-api-docs.shelly.cloud/gen2/ComponentsAndServices/Light)

---

<div class="post-metadata">

### Author: ![Charlietuna](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@Charlietuna](https://discourse.nodered.org/u/Charlietuna)
#### Post date: [9 July 2024 23:57 UTC](https://discourse.nodered.org/t/shelly-plus-wall-dimmer-switch/89305/3 "2024-07-09T23:57:03Z")

</div>

Thanks so much for your help. I really was able to advance my flow. I need to learn more about JSON and how to form JSON expressions. I was confused with all the publish and subscribe stuff. I think I get it now. The Shelly Wall dimmer publishes on the device id/rpc. The src got me really confused. I guess it is a means of giving a topic to a returned message from the Shelly Wall Dimmer. As far as I can tell you really don't need to receive the return message.  
Anyhow, thanks so much for your time. I was getting very frustrated, because I just couldn't understand the api.

---

<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: [7 October 2024 23:57 UTC](https://discourse.nodered.org/t/shelly-plus-wall-dimmer-switch/89305/4 "2024-10-07T23:57:52Z")

</div>

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