Shelly Pro RGB and MQTT

Hi guys,
I was able to readout a Shelly Pro RGB (not the Shelly RGBW2) via MQTT to Node Red, but I´m not able to control it.
color picker outputs a string or an object, but I´d need an array. I´m also not sure if it would be enough to send RGB(W) data, or if I need to send brightness as well.

Here´s what I have so far:
flows.json (15.6 KB)

Anyone knows how to handle that?
Regards and many thanks in advance

Isn't the pro controlled the same way as the standard RGB device?

If so, I send the following MQTT message to shellies/shelly_rgbw2_01/color/0/set with the content set to:

{
    "red": payload.r, 
    "green": payload.g, 
    "blue": payload.b
}

That happens to be JSONata in a change node and the payloads come from a web input.

Hi,
the plus needs different communication, like the gen3 units. They provide much more data, like internal temp, voltage and so on.
Regards

You should be able to enable mqtt control in the devices http/lan interface, which allows the legacy control over mqtt. you should find it in the mqtt settings page. Then @TotallyInformation suggestion should work.

1 Like

Hi guys,
many thnaks for your input, but I´m still stuck on this issue.
shellies/"mqtt prefix"/....... is for Gen1 units, Gen2 & 3 are using somethin like "mqtt prefix"/......
For reading out the shelly I´m using "mqtt prefix"/status/rgbw:0, but I have no clue what I should use for commands. Usually Shelly provides all neccessary data, but since Gen2, documentation gets less and less.
Regards

Gen 2 and 3 use rpc, but as I stated above you can enable mqtt control in the mqtt settings.

Did you attempt that?

Else try using the rpc method RGB.set and send the correct params. You set the response topic in the params. RPC Channels | Shelly Technical Documentation - RGB | Shelly Technical Documentation

Example flow and response topic. set the topic to to <device_id>/rpc

[{"id":"e52690129360bd8a","type":"mqtt in","z":"d1395164b4eec73e","name":"","topic":"shelly_RGBset/rpc","qos":"2","datatype":"auto-detect","broker":"b288429d0f6eacbf","nl":false,"rap":false,"inputs":0,"x":390,"y":7580,"wires":[["588a356d8f0d8a25"]]},{"id":"588a356d8f0d8a25","type":"debug","z":"d1395164b4eec73e","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":7580,"wires":[]},{"id":"69cbdf6e61c4f96a","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"id\":100000,\"src\":\"shelly_RGBset\",\"method\":\"RGB.set\",\"params\":{\"id\":0,\"on\":true,\"brightness\":50,\"rgb\":[255,255,255]}}","payloadType":"json","x":350,"y":7640,"wires":[["2fc172e9f6ab846e"]]},{"id":"2fc172e9f6ab846e","type":"mqtt out","z":"d1395164b4eec73e","name":"","topic":"<device_id>/rpc","qos":"2","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"b288429d0f6eacbf","x":580,"y":7640,"wires":[]},{"id":"b288429d0f6eacbf","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

Hi,
yes ... I did set it up like you and did some adjustments for the MQTT In & Out node, but without success.


I´m able to control it directly via a browser using:
e.g. http://192.168.1.225/rpc/RGBW.Set?id=0&on=true&brightness=5&rgb=[0,255,255]&white=0

So communication seems to be possible, there´s just something wrong the way I´m doin it :frowning:

I teached myself how to communicate with lots of othe shelly products using examples provided by the manufacturer, but this Plus RGBW is a pain in the ass.
Regards

The topic is not 225/rpc

As stated before it should be <device id>/rpc AS shown in the link provided prior (RPC Channels).

  • Topic for publishing requests: <shelly-id>/rpc. To be able to send requests to a device, you must subscribe to this topic, substituting <shelly-id> with the relative data for your Shelly device. For example, shellypro4pm-f008d1d8b8b8/rpc.

There is an example of switch.set method to on that page.

mosquitto_pub -h ${MQTT_SERVER} -p ${MQTT_PORT} -t shellyplus1-c4dd57877294/rpc \ -m '{"id":123, "src":"user_1", "method":"Switch.Set", "params":{"id":0,"on":true}}'

You would just change the params and method for RGB.set, and set your response topic src.

The device id would be the shelly id in your image. and you should remove the topic prefix of 225 from your settings. You can change the shelly id to make an easier device id if you wish.

Hi,
I feel like a dork, but it´s still not woking. I imported your example once more had just changed the <device_id> to the real device_id. I removed the prefix and after areboot ID & prefix are the same.
I changed:


into

Sorry for consuming so much of your time

Images are of no help and provide little info, export the flow.

I notice your http request uses RGBW.set, you may need to use this method.

Hi,
please find the flow attached:
flows(1).json (2.7 KB)

or here:

[
    {
        "id": "bc0e2b9ac2648d94",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "0b6ed99e2d913072",
        "type": "mqtt in",
        "z": "bc0e2b9ac2648d94",
        "name": "",
        "topic": "shelly_RGBset/rpc",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "bf3cd836.8e48e8",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 170,
        "y": 60,
        "wires": [
            [
                "d944826d26d7d71e"
            ]
        ]
    },
    {
        "id": "d944826d26d7d71e",
        "type": "debug",
        "z": "bc0e2b9ac2648d94",
        "name": "debug 2",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 490,
        "y": 60,
        "wires": []
    },
    {
        "id": "a3da6a5fae1a470a",
        "type": "inject",
        "z": "bc0e2b9ac2648d94",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"id\":100000,\"src\":\"shelly_RGBset\",\"method\":\"RGB.set\",\"params\":{\"id\":0,\"on\":true,\"brightness\":50,\"rgb\":[255,255,255]}}",
        "payloadType": "json",
        "x": 130,
        "y": 120,
        "wires": [
            [
                "26f0ff2931ca1ba8"
            ]
        ]
    },
    {
        "id": "26f0ff2931ca1ba8",
        "type": "mqtt out",
        "z": "bc0e2b9ac2648d94",
        "name": "",
        "topic": "shellyplusrgbwpm-30c92257ad08/rpc",
        "qos": "2",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "bf3cd836.8e48e8",
        "x": 430,
        "y": 120,
        "wires": []
    },
    {
        "id": "bf3cd836.8e48e8",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.1.30",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": false,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]

Please share code in the preferred method as it makes copying much easier.

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

p.s. please read prior post as I added an edit.

Sir, done Sir :wink:

Confused

Are you saying it is working using RGBW.set method, rather than RGB.set method?

or

Are you saying you posted the flow correctly?

Hi,
the flow was copy-pasted, so I´m sure there are no misstypings. But in the end I´d like to control RGBW. But honestly I got lost it tons of code, I also got some help from shelly support, but they just sending strings, no idea where and how to send.
I just fogot to adjust QoS and the retain option, before I shared my flow.
Hopefully that helps for fixing my issue.
Regards

I am refering to my edit in a previous post, not a typo.

I am saying your http request via browser uses RGBW.set, So the mqtt message should possibly use RGBW.set not RGB.set. Try changing the method in the inject node to RGBW.set.

[edit] just for info

The mqtt node will take the incoming msg.payload message and convert it to a JSON(string) then send that over mqtt.

It works :partying_face: :tada:
Now I have to find out, how I can link my node red dashboard to control the stripe.
Thank you so much for your patience.
Regards

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