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
Here is a example flow untested as i do not have a wall dimmer
[{"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":""}]
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
-t is the topic -m is the payload
Here are the methods available Light | Shelly Technical Documentation
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.