Problems with node contrib-shelly

Hi,

i try to access a Shelly Plus RGBW PM via node-red-contrib-shelly.

The connection between the node and the shelly is working. And if i sent a message to the node, i got feedback from the shelly - like wifi state, colour settings, and a lot more.

But i´m not able to control the shelly via the node No matter what i try or if i use the examples flows.

The goal is to control the colour and brightness of the LED - but i got no idea how to the setup the message in the correct way.

Could anybody show me the correct way please?

Hi @gerribaldi,
is it a gen2+ RGBW like this one: Shelly Plus RGBW PM | Shelly Knowledge Base

Does the example rgbwpmplus.json not work for you?

You can modify the sample and use RGB.Set with its properties described here

Hi @gerribaldi ,

As @windkh also already said, you have to provide a little bit more information as you have done so far.
Important information is the following:

  1. Is it a Gen 1 or a Gen 2+ (Gen 2, Gen 3 or Gen 4) device?
  2. Which Node do you (want to) use? The local node or the cloud node.
  3. Or do you want to communicate with MQTT?

Regards

Sorry guys, i thought to provide the type of shelly is fine.

So here some more infos:

I use the node shelly gen 2+ without cloud. The shelly have only a connection to my wifi und my local mqtt broker.

I can access the shelly directly via mqtt and via

msg.payload = set,true,100,999,77,88,99,5,250

i´m able to control the shelly. But this is not realy comfortable :slight_smile:

@windkh
I use for all my test the nodes rgbw2* and not the which you are mentioned. :roll_eyes:
So after using the right node i can control the shelly via the example node. :+1:

Which will be the easiest way to access or change for example the rgb values?

In the example flow there should be a switch function. You can modify the payload: instead of Switch.Set you can use RGB.Set with the properties described here

I find that using NR core modules to be easier than the node-red-contrib-shelly. BUT, you do have to craft the messages yourself. I use this on a RGBW Gen 1 to control my lights for different 'levels' of lighting. This in a Function node...

switch (msg.payload) {
  case 1:
  msg.payload = {"turn": "off"};
    break;
  case 2:
    msg.payload = {"mode": "color", "red": 255, "green": 255, "blue": 255, "white": 100, "gain": 100, "effect": 0, "transition": 0, "turn": "on" };
    break;
  case 4:
    msg.payload = {"mode": "color", "red": 255, "green": 255, "blue": 255, "white": 100, "gain": 80, "effect": 0, "transition": 0, "turn": "on" };
    break;
  case 8:
    msg.payload = { "mode": "color", "red": 255, "green": 255, "blue": 255, "white": 100, "gain": 50, "effect": 0, "transition": 0, "turn": "on" };
    break;
  case 16:
    msg.payload = {"mode": "color", "red": 252, "green": 173, "blue": 25, "white": 100, "gain": 100, "effect": 0, "transition": 0, "turn": "on" };
    break;
  case 32:
    msg.payload = {"mode": "color", "red": 252, "green": 173, "blue": 25, "white": 20, "gain": 40, "effect": 0, "transition": 0, "turn": "on" };
    break;
  case 64:
    msg.payload = {"mode": "color", "red": 252, "green": 173, "blue": 25, "white": 20, "gain": 100, "effect": 0, "transition": 0, "turn": "on" };
    break;
  default:
    msg.payload = 1024
}

msg.topic = "shellies/Living_Room/color/0/set";
return msg;

Should have added, the output is to MQTT Output Node! Apologies.

Thanks to all for the support

@mudwalker
For my shelly switch units i also use the NR core modules with mqtt. I thought that the RGBW handling will be easier with the nr-contrib-shelly node.

Your Function node works with some presettings which you call via the different cases. But is there a way, that you can control the RGB colors directly?

Yes, you can use a direct HTTP request to the REST API (see https://shelly-api-docs.shelly.cloud/).

Funnily enough, I get rid of all my Shelly REST API Nodes about a month ago. They do work well, it is just that my system uses MQTT for control and monitoring by NR.

I will check to see if I have anything I can send as an example over the next couple of days.

Had a quick look and you can see in this little snippet of flow how to control a Shelly TRV using HTTP Request Node, you ned to look at this as well as the Shelly REST API Docs. I hope it helps, let me know if not and I can look further.

[{"id":"b18ebfdc11ad3b8c","type":"function","z":"0d80ab0dc9580192","g":"c07ef136bb2bdb1c","name":"Temp control","func":"msg.payload1 = \"1\";\nmsg.topic1 = \"target_t_enabled\"\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":490,"y":1140,"wires":[["7f495d987ce3b2a3","de1f05fdb38047e5"]]},{"id":"7fdcd989ca4729dc","type":"inject","z":"0d80ab0dc9580192","g":"c07ef136bb2bdb1c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"target_t","payload":"18","payloadType":"str","x":300,"y":1140,"wires":[["b18ebfdc11ad3b8c"]]},{"id":"4bbd60e4adbeea3f","type":"inject","z":"0d80ab0dc9580192","g":"c07ef136bb2bdb1c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"target_t","payload":"21","payloadType":"str","x":300,"y":1220,"wires":[["b18ebfdc11ad3b8c"]]},{"id":"7b9e1f0b27caefc2","type":"inject","z":"0d80ab0dc9580192","g":"c07ef136bb2bdb1c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"target_t","payload":"20","payloadType":"str","x":300,"y":1180,"wires":[["b18ebfdc11ad3b8c"]]},{"id":"7f495d987ce3b2a3","type":"http request","z":"0d80ab0dc9580192","g":"c07ef136bb2bdb1c","name":"/thermostat/0","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://<IP_ADDRESS>/thermostat/0/?{{{topic1}}}={{{payload1}}}&{{{topic}}}={{{payload}}}","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":830,"y":1140,"wires":[["4808aea8852ad2f2","a3e71e19ac44131a"]]},{"id":"4808aea8852ad2f2","type":"function","z":"0d80ab0dc9580192","g":"c07ef136bb2bdb1c","name":"Get 'status'","func":"msg.topic = \"status\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1010,"y":1140,"wires":[["811246e382f7e0e4"]]}]

One of the key advantages of the comparatively expensive Shelly devices is their built-in MQTT features. Unless there is a key reason you can't use MQTT, it is by far the better option in most cases I believe. I've never had any issues with it. No custom nodes needed.

Reading all the responses from @gerribaldi, I believe that the issue is not any longer "How can i communicate in Node RED with the Shelly devices", but how to control a RGBW module in a convenient way?

@mudwalker already offered a solution, which is more or less a kind of several presets, but I believe a color wheel , including an On/Off switch and Slider is needed.
Maybe I'm wrong, but that is at least my feelings.

Unfortunately Dashboard 2 hasn't such a widget, so you have to create something with a Template node.

However I found something on Github, but it did not work for me:

I tried it yesterday evening, but it did not work for me, Npm installation fails, so you have to install it manually.

I think it would be a nice solution for RGBW devices in Dashboard 2.

I do not use the Shelly contrib nodes either. Like many others I use as much as I can MQTT.

[quote="TotallyInformation, post:12, topic:101813"]
the comparatively expensive Shelly devices
[/quote]

Are they really expensive? I do not know the UK prices or prices for alternatives, but yes, in Germany they are cheaper than in The Netherlands. E.g if you use Philips Hue, I saw this week an announcement that the Signify web shop has increased the prices with 66%!

The Text Input node has a Colour Picker mode

I used the colour picker for Dashboard 1 when I was doing a prototype for my Shelly RGBW controller. I may still have it somewhere, doubtless you can do the same with D2.

I have a flow that controls the device via MQTT - typically I never change the colour actually, just on/off but I can absolutely do that.

Of course, my D1 prototype was replaced by UIBUILDER but the principles are the same.

From my point the shelly devices are a good solution with a fair price. A single switch for a socket cost 20,- € and support a tones of protocols.
And a big advantge is the wireless connections - so you can mount it quit everywhere.

I use NR to control my smart-home and set up some extra function depend of e.g. time or temperature. The basic layer are KNX which is quit everywhere - but not realy everywhere :frowning:
The shelly control a RGBW-LED for a display cabinet. And on the position for the cabinet, i only get a socket in the wall and no KNX cable.....
Thats the reason for the shelly

So, like @FireWizard52 wrote, the goal and also next step is to control the shelly via a color wheel.

The color wheel is inside a zenio knx controller. Via knx-ultimate i get this value for the color

The complete control from the RGBW is done via the zenio controller. So i just need to collect the infos from knx an sort it in the right way and sent it via mqtt.
And for this was my first idea to user the shelly-node - which i hope will be easier then to sort out the mqtt message

Okay,
Sorry Colin, I missed that, but, now you mentioned it, I remember.

I have to admit that it is not the most obvious place to look for a colour picker.

They are fantastic devices but one of my original motivations for getting into home automation was for it to be cost effective. A EUR20 switch for a single light is not, in my opinion, especially cost effective.

It is only worth buying in bulk and only when they have a significant sale on. Here is an example:


That is not cheap though it is certainly good. I have their original RGBW device. £30 for an LED controller is fairly expensive.

Yes, but there are alternative wireless options that are cheaper.

Yep, same here. But with MQTT, I've never used KNX.

I have a long LED strip around the back of my office desk and surrounding shelving. I have it set to a comfortable red on a relatively low light level. It comes on with a sun-position related timer and goes off with a set time. It is driven via a buck converter with the voltage set somewhat below the 12v the LED strip wants which makes it all last longer and draws less power.

As mentioned, I can do this with a flow. The flow can be manually controlled in the editor but I have my own web page that uses an HTML color input tag (and I also still have the old prototype D1 page as well - I rarely throw things away! :slightly_smiling_face:)

The flow outputs the appropriate control messages to MQTT and the Shelly is set to allow MQTT control.

@TotallyInformation
Could you share your flow for the control of the rgbw here please?