Changing the Color of an LED on the Mobile Dashboard with Node-Red

I have a Node-Red project that uses a Raspberry Pi and relays to switch on and off the fuel and starter solenoids on my generator. I have a dashboard in node-red with switches to control each of the solenoids and LED widgets to indicate whether they are on or off.
I wanted to try to create a Blynk mobile dashboard to show similar information. I can’t figure out how to change the color of the LED widget on the Blynk dashboard. I found the below post but am unable to replicate those results. I am using Blynk-IOT in node-red. I am not sure what type the data stream should be and am wondering if that is the problem. The data stream the LED widgets are connected to is set to integer. If I create a data stream of type string, I can’t connect the LED Widget to it in the Blynk app. This is the node red flow I have

the switch node:
image

the green change node:
image

the blynk set property node:
image

As noted pin V2 is a integer data stream. I tried creating a string datastream but I can’t assign that datastream to the LED widget in the blynk app.

Node-red - How I change the background color of LCD widget? - Need Help With My Project - Blynk Community

What does your debug 5 node show?

Pete.

I am using a styled button set to ‘switch’ mode in the mobile dashboard. if it is tapped from the blynk app to turn off. :

{"payload":"0","pin":"0","arrayOfValues":["0"],"_msgid":"4954c08d610ea629","color":"#FF0000"}

if it is tapped to turn on:

{"payload":"1","pin":"0","arrayOfValues":["1"],"_msgid":"ee3468ecc6e964fa","color":"#23C48E"}

The Blynk set properties node is connected to pin V2. pin mode is fixed. the LED widgets are also connected to pin V2. I assumed that meant anything sent to the properties node in node red would then be sent out pin v2.

I was trying to do this with a styled button on Blynk. I added a switch to the mobile dashboard and connected that to the virtual pins for the LEDs and now they are changing color like I want them to. I don’t think I care per se whether I use a styled button or a switch. I am wondering what I am missing with the styled button.

Well I am not quite there yet. The LEDs are changing color but when the switch is toggled on they are changing color to red. I want them to be red when the switch is off and green when the switch is on.

It’s difficult to know why red/green Chang is occring the wrong way without info regarding how your V0 datastream is configured.

As far as the Styled Button widget is concerned, did you have it set to Push or Switch mode?

The simplest way to observe the differe g behaviours would be to add both a switch and a Styled Button widget (in Switch mode) to your mobile dashboard. And link them both to the V0 datastream then observe your debug 4 output when you operate them.

Pete.

Here’s the data stream configuration for pin V0:

I added a styled button back to the mobile dashboard connected to pin V0 so the dashboard looks like this with the button and switches off

the button and the first 3 switches are all connecdted to pin V0. The relay LEDs and fuel LEDs are also connected to pin V0.
when I tap either the styled button or one of the switches to turn it on it looks like this:

I have a write event in node-red attached to a debug node. whether I tap the button or the switch the output is the same.

from a switch:

{"payload":"0","pin":"0","arrayOfValues":["0"],"_msgid":"19f009df8919489d"}

from the styled button:

{"payload":"0","pin":"0","arrayOfValues":["0"],"_msgid":"e521c8cb372e03a1"}

I figured it out. I misunderstood a different post. I had to set the msg.color property in the Blynk Set Property node to the hex value of the color. it’s working now.