NodeRed Control - Scripted Parameters

I am automating many devices. For logic requiring on/off I have to create 2 branches, one for each state as the the node does not allow paramenters to be passed to it. The on/off is set in the node

For a light the situation is worse. Changing brightness I have many branches for different perecentages i.e.10,20,20,…,90,100

Can the control node be enhanced to allow paramenters to be passed in via somelike like msg.state, msg.brightness etc.? That would massively simplify flows in NodeRed

related post:

Thx for the feedback.

Can understand creating dimming flows is messy at the moment.

This should work for virtual devices created for eWeLink CUBE if you are referring to passing arguments to device control. But for devices pulled from CUBE, it won’t work at the moment.

This was also one of my suggestions. The messages msg.payload should be available for use as a activation, as is found in many other palettes. For now you can use a switch node and copy it around to avoid doing this more than once. If you can bothered to have 11 outputs you can do 0, <10. <20 etc and have it only activate the first rule. 10% granularity is probably okay. I may go to 5% when I can be bothered.

I had a look at the source code for the noderedlibrary to see how its making the calls. I then had a play with the API calls, and managed to get it to work.
That kind of negates the point of the ICube controls, so I consider it a work around for now. Ideally this same functionality can be added to the control themselves by allowing passed parameters

I am using the control to get the current brightness and storing whenever it changes ( So I dont have to make a call when dimmer is pressed ). Then a loop sending brightness commands every 250ms via MQTT, mainly because I had issues with link call nodes, initiated via a trigger node.

It works fine apart from the system ca get overloaded, so I am looking at a syncronous rather than asyncronous process now to prevent that

Zigbee2MQTT has a great feature. You just say incrementBrightness and it does all of the processing for you at hub level so many of the delays and points of failure are eliminated

If it is a virtual device you have registered with a register device node you can use a template node put (example of curtain) that links to a ‘put device state’ node

{
    "percentage": {
      "percentage": {{payload}}
    }
  }

shows it is already possible and just needs to not just be virtual devices

Hi everybody!

I’m creating some automations on Node-RED based on a generic zigbee rotary knob bought on Aliexpress. It has the following functions: single press, long press, double press, rotate right, rotate left.
I already created some nodes to parse their events and I have all running except controlling the target devices.
Using the control device node from node-red-contrib-ewelink-cube package I can only set fixed numbers. I would like to pass the brightness level of a lamp through a variable set on the msg on a previous node. Is there a way to do that?

eWeLink CUBE Version: 2.3.4
Node-RED version: 4.0.5
node-red-contrib-ewelink-cube version: 1.0.0

May i ask if it’s the same or similar request? Is so, I’m merging the topics.

1 Like

That does look like hte same request as mine so I think it can be merged.

An extension to this request, which would actually make it much easier with dimming is to allow “change brightness by %”. If that was available as an option there would be kess need to send a variable value,
Thast could be added to built in IHost scene triggers to, which would then also be useful to people that dont use NodeRed i.e. If “rotate left” then “decrease Brightness”

1 Like

You can do this with virtual devices, using a put-device-state node, but with real ones I’ve ended up using a multi-output switch node in Node Red and lots of control device nodes. I couldn’t be bothered to make it super granular but 5% changes seems okay and once you’ve done it you can copy and paste it.