Comments about "My home automation projects built with MQTT and Node Red" topic

how can I convert the RGB o/p from Blynk ws Zergba to HEX

msg : Object 
object
payload: array[3]
pin: "40"
hex: "#4d9800"
r: 77
g: 152
b: 0
rgb: "77;152;0"
 _msgid: "9edbe053.923fb"

from RGBW to HEX

color: "#4d980000"

Well, because the Hex value is already in the message from Blynk, but just not the payload, it’s easy to switch the Hex value across to the payload with a Change node…

Capture0

You could do it in a function as well…

msg.payload = msg.hex;
return msg;

Pete.

thanks Pete

Did you work-out the “00” on the end?
I’m not near a PC at the moment, but maybe msg.payload = msg.hex + “00”;

Or maybe single quotes like this ‘00’ ?

Pete.

As I know nothing about js I need your help for two functions.
Both functions should output this format for Magic Home to work.

 json
    {"on":  true,"brightness": 0,"color": "#0F0F0F00"}

it works OK with Inject Nodes.

the Convert Node HSV—>RGB is not working correctly
https://flows.nodered.org/node/node-red-contrib-color-convert

Here is my working code function from Arduino

  void HSV_to_RGB(float h, float s, float v, byte rgb[])
    {
      int i;
      float f,p,q,t;   //http://www.easyrgb.com/en/math.php
  
    h = constrain(h, 0.0, 360.0);
    s = constrain(s, 0.0, 100.0);
    v = constrain(v, 0.0, 100.0);
  
    s /= 100;
    v /= 100;
  
    if (s == 0) {
      // Achromatic (grey)
      rgb[0] = rgb[1] = rgb[2] = round(v*255);
      return;
    }

    h /= 60.0; 
    i = floor(h); // sector 0 to 5
    f = h - (float)i; // factorial part of h
    p = v * (1.0 - s);
    q = v * (1.0 - s * f);
    t = v * (1.0 - s * (1 - f));
  
    switch(i) {                //http://colorizer.org/
      case 0:
        rgb[0] = round(255*v);
        rgb[1] = round(255*t);
        rgb[2] = round(255*p);
        break;
      case 1:
        rgb[0] = round(255*q);
        rgb[1] = round(255*v);
        rgb[2] = round(255*p);
        break;
      case 2:
        rgb[0] = round(255*p);
        rgb[1] = round(255*v);
        rgb[2] = round(255*t);
        break;
      case 3:
        rgb[0] = round(255*p);
        rgb[1] = round(255*q);
        rgb[2] = round(255*v);
        break;
      case 4:
        rgb[0] = round(255*t);
        rgb[1] = round(255*p);
        rgb[2] = round(255*v);
        break;
      default: // case 5:
        rgb[0] = round(255*v);
        rgb[1] = round(255*p);
        rgb[2] = round(255*q);
      }
  }                   
//---------------------------------

the two functions are:

"zeRGBa to MagicHome"
"Alexa to MagicHome"

of course I am asking this if you can.
thanks again
Joe

Hmmm… a bit over my head I’m afraid!

I’m not near a PC now, but could have a look later, although it might take a while to get my head around it.

An alternative might be to look for people that have done this before. If found this Node-Red contrib for Magichome that seems to do what you’re looking for:

Do you fancy giving that a try and seeing how you get on with it?

Pete.

this is the node I am using for Magic Home (the blue one)

but there is no examples or help or youtube

any way take your time .

perhaps I can also ask help @scargill

@PeteKnight
Today I solved my first function :face_with_raised_eyebrow:
Here it is:

Name:    zeRGBa to MagicHome

 Function:
1.  msg.payload = {"on": true,"brightness": 0,"color": msg.hex+"00"}
2.  return msg;

As simple as that.

you can try it.
it works fine.

Okay, I’m sat at my PC now and have installed the blue Magichome UFO node.
As I don’t have a MagicHome system that I can connect it to, it’s messing-up my Node-Red system so I’m getting failed deployment errors in Node-Red and Offline errors in the Blynk app.

I only use RGB lighting, so don’t really understand the WW and CW elements of the Hex string. I’ve done a bit of googling on the subject, but I’m still struggling to understand how the zeRGBa widget (which only outputs RGB data) can be use to define the brightness data. I would have thought you’d need an extra control such as as slider to give the brightness data that’s needed for the RRGGBBWW string?

Also, I’m not sure how you’re going to be using Alexa to control the LEDs. Will it be a simple On/Off command, or will there be brightness and colour commands as well?

So, I don’t really understand where the HSV to RGB conversion comes in to the equation.

I noticed that there’s also a Node-Red contrib called “magichome-led-node”. This only works with RGB data, so I guess it’s not of any use to you?

Pete.

If you take a close look to this picture you will understand how I reduce RGB brightness for [blue violet] color.

concerning the WW (Warm White) and W (for Cool White ) they are separate LEDs that Magic Home can control with a 5th Wire present in the RGBW models.

About HSV to RGB , Amazon Echo send color in this format also GH use another technique for colors.

Pls. read here:
[HSV to RGB] How to use Google Home + Blynk with ESP8266 { without " IFTTT " }

You can test Amazon node by saying “turn room to green” and take a look to payload.

payload: object
hue: 0                          //  Amazon Red color
saturation: 1
brightness: 1

{"hue":120,"saturation":1,"brightness":1}      // Green

{"hue":240,"saturation":1,"brightness":1}      // Blue

Okay, I’m still confused about the Brightness thing.
Your app screenshot shows a brightness slider. Is this used independently of the RGB sliders/zeRGBa widget?

If so, isn’t this input needed as an input into Node-Red to give the BB component of your RRGGBBWW data?

If not, you need to explain where this data is coming from, because i can’t work it out from the code you linked me to.

Pete.

RGB White    100%   brightness    = #FFFFFF   R=255   G=255     B=255
RGB White     50%   brightness    = #7F7F7F   R=127   G=127     B=127

from my code

  BLYNK_WRITE(vPIN_BRIGHTNESS_SLIDER)             
  {
    V = param.asInt() ;                     // BRIGHTNESS channel value.
    rrr = round(rr*V/100) ; ggg = round(gg*V/100) ; bbb = round(bb*V/100) ;

As Simple as that :grinning:

I don’t get what you mean?

because we don’t have the “W” LEDs in our Magic Home so I leave it as “00” or “#FFFFFF00

Okay, I think I understand whats needed now, and I’v made some progress - but there’s a bit more to do.

I gave-up on the HSV to RGB conversion node and have spent a while finding an alternative solution and making that part of a function.
I decided that it would be easier if both Alexa and the zeRGBa widget outputted the same data in their messages, so the next stage will be to take that data and convert it into the format you need.

This is the function called “Make Alexa Output same as zeRGBa”:

var hue = msg.payload.hue /360;
var sat = msg.payload.saturation;
var bri = msg.payload.brightness;

RGB=HSVtoRGB(hue, sat, bri) // Call the function below to convert Alexa output to RGB

// Split the result from the function into its constituent parts...
var RED = RGB.r; 
var BLUE = RGB.b;
var GREEN = RGB.g;

// Convert the parts into Hex values...
var RED_HEX = (RGB.r).toString(16);
if (RED_HEX == "0")
{
    RED_HEX="00"
}    

var GREEN_HEX = (RGB.g).toString(16);
if (GREEN_HEX == "0")
{
    GREEN_HEX="00"
}  

var BLUE_HEX = (RGB.b).toString(16);
if (BLUE_HEX == "0")
{
    BLUE_HEX="00"
}   


// Build a message called hex with the RGB Hex value, to mimick the zeRGBa Widget output
msg.hex = "#" +  RED_HEX + GREEN_HEX + BLUE_HEX;

// Replace msg.payload with the same RGB Hex value, to mimick the zeRGBa Widget output
msg.payload = "#" +  RED_HEX + GREEN_HEX + BLUE_HEX;

// Build a message called rgb with the RGB Hex value in a different format, to mimick the zeRGBa Widget output
msg.rgb = RED_HEX + ";" + GREEN_HEX + ";" + BLUE_HEX;

 
// Add the r, g & b objects to the message, to mimick the zeRGBa Widget output
msg.r=RED;
msg.g=GREEN;
msg.b=BLUE;

// Update the text on the node to show the RGB colour
node.status({text: "[" + RED + ", " + GREEN + ", " + BLUE + "]"});


// Output all the new message objects
return msg;



// Function code taken from:
// https://stackoverflow.com/questions/17242144/javascript-convert-hsb-hsv-color-to-rgb-accurately
/* accepts parameters
 * h  Object = {h:x, s:y, v:z}
 * OR 
 *h, s, v
*/
function HSVtoRGB(h, s, v) {
    var r, g, b, i, f, p, q, t;
    if (arguments.length === 1) {
        s = h.s, v = h.v, h = h.h;
    }
    i = Math.floor(h * 6);
    f = h * 6 - i;
    p = v * (1 - s);
    q = v * (1 - f * s);
    t = v * (1 - (1 - f) * s);
    switch (i % 6) {
        case 0: r = v, g = t, b = p; break;
        case 1: r = q, g = v, b = p; break;
        case 2: r = p, g = v, b = t; break;
        case 3: r = p, g = q, b = v; break;
        case 4: r = t, g = p, b = v; break;
        case 5: r = v, g = p, b = q; break;
    }
    return {
        r: Math.round(r * 255),
        g: Math.round(g * 255),
        b: Math.round(b * 255)
    };
}

Capture8

The output from the debug node now has the same colour data. The same info is represented in a variety of different ways in the output from zeRGBa, so I’ve replicated each of them in the output from the function. The data doesn’t look identical, but all the same colour data elements are there, so at the nest stage we can use them in any way we wish and they’ll all be interchangeable.

zeRGBa output:

1/1/2018, 10:23:20 PMnode: 7af39606.fa5ad8
msg : Object
object
payload: "#ff0000"
pin: "0"
hex: "#ff0000"
r: 255
g: 0
b: 0
rgb: "255;0;0"
_msgid: "750d69b1.7b1aa8"

Output from the function:

11/1/2018, 10:26:52 PMnode: 2ead6b28.c51954
msg : Object
object
topic: ""
name: "Room"
_messageId: "28f840a2-bdb0-4daa-a13d-3511f5c6c145"
_applianceId: "35106"
_confId: "c0110d92.aab95"
command: "SetColorRequest"
extraInfo: object
payload: "#ff0000"
_msgid: "afa3b68.bd64348"
hex: "#ff0000"
rgb: "ff;00;00"
r: 255
g: 0
b: 0

I’ve also mimicked the RGB status shown below the zeRGBa node, which might be handy for debugging.

The next task is to create a function that takes one of these RGB elements from the outputs of the two nodes and calculates the brightness then JSON string. This will be the tricky bit for me, as I can’t test it, but it shouldn’t be too difficult to get most of the way there and let you tweak the rest.

I probably wont get chance to do any more until tomorrow evening.

Pete.

Okay @Ze_Pico, I think i have something for you to try…

I gave this a bit more thought today and realised that it’s actually a lot more complicated than I originally imagined, because there can be on/off commands coming from Alexa and also (presumably) a Blynk switch widget. Also, brightness commands can come from both the Blynk slider and Alexa.

To overcome this I changed the function I wrote to have three outputs:
RGB
Brightness
On/Off

The RGB output is unchanged from what the function did yesterday, but ios only triggered if the command given to alesa was about colour.

The Brightness outputs the percentage brightness (Alexa limits this from 0-100 automatically, and the Blynk slider needs to be limited to 0-100 as well - which I think yours is).

On/Off simply outputs a 0 or 1 to mimic the output from a Blynk switch widget.

In the flow, I’m using these outputs to update the zeRGBa, brightness and on/off widgets so that they stay synchronised with Alexa.

When the RGB vales are changed by either Blynk or Alexa, these are being stored to global (well, flow-level actually) variables called rr, gg and bb. When these values change, I’m forcing a sync on the Brightness slider widget, which triggers the new dimmed RGB levels and outputs these to MagicHome. The “real” RGB values in the zeRGBa widget remain unchanged, so that you know what base value to use when re-calculating the brightness.
For example, setting the room to red, with 50% dimming gives an output to MagicHome of 800000, but the zeRGBa still shows 255,00,00. Changing the brightness to 100% changes the MagicHome output to ff0000. I assume that this is how your current system works?

I’ve tested the outputs intended for MagicHome in debug nodes and they seem okay, but I obviously can’t test the real thing.

Here’s what the flow looks like:

and here’s the the Node-Red flow:

[
    {
        "id": "5ca5bfb8.5917d",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": ""
    },
    {
        "id": "d1579cdd.7445",
        "type": "blynk-ws-zergba",
        "z": "5ca5bfb8.5917d",
        "name": "",
        "pin": "1",
        "client": "859549ef.52e4b8",
        "x": 130,
        "y": 120,
        "wires": [
            [
                "c5d51c9f.c7271"
            ]
        ]
    },
    {
        "id": "1e2ec852.2be608",
        "type": "alexa-home",
        "z": "5ca5bfb8.5917d",
        "conf": "c0110d92.aab95",
        "device": "35106",
        "acknoledge": true,
        "name": "Room",
        "topic": "",
        "x": 90,
        "y": 260,
        "wires": [
            [
                "150ebc8c.7cf363"
            ]
        ]
    },
    {
        "id": "150ebc8c.7cf363",
        "type": "function",
        "z": "5ca5bfb8.5917d",
        "name": "Process Alexa Output",
        "func": "if (msg.command ==\"TurnOffRequest\")\n{\n    node.status({text: \"Off\"});\n    return [null, null, {'payload': \"0\"}];\n}\n    node.status({text: \"On\"});\nif (msg.command ==\"TurnOnRequest\")\n{\n    \n    return [null, null, {'payload': \"1\"}]; \n}\n\nif (msg.command ==\"SetPercentageRequest\")\n{\nnode.status({text: \"Brightness \" + msg.payload});    \n    return [null, {'payload': msg.payload}, null]; \n}\n\n\nif (msg.command ==\"SetColorRequest\")\n{\n\nvar hue = msg.payload.hue /360;\nvar sat = msg.payload.saturation;\nvar bri = msg.payload.brightness;\n\nRGB=HSVtoRGB(hue, sat, bri) // Call the function below to convert Alexa output to RGB\n\n// Split the result from the function into its constituent parts...\nvar RED = RGB.r; \nvar BLUE = RGB.b;\nvar GREEN = RGB.g;\n\n// Convert the parts into Hex values...\nvar RED_HEX = (RGB.r).toString(16);\nif (RED_HEX == \"0\")\n{\n    RED_HEX=\"00\"\n}    \n\nvar GREEN_HEX = (RGB.g).toString(16);\nif (GREEN_HEX == \"0\")\n{\n    GREEN_HEX=\"00\"\n}  \n\nvar BLUE_HEX = (RGB.b).toString(16);\nif (BLUE_HEX == \"0\")\n{\n    BLUE_HEX=\"00\"\n}   \n\n\n// Build a message called hex with the RGB Hex value, to mimic the zeRGBa Widget output\nmsg.hex = \"#\" +  RED_HEX + GREEN_HEX + BLUE_HEX;\n\n// Replace msg.payload with the same RGB Hex value, to mimic the zeRGBa Widget output\nmsg.payload = \"#\" +  RED_HEX + GREEN_HEX + BLUE_HEX;\n\n// Build a message called rgb with the RGB Hex value in a different format, to mimic the zeRGBa Widget output\nmsg.rgb = RED_HEX + \";\" + GREEN_HEX + \";\" + BLUE_HEX;\n\n \n// Add the r, g & b objects to the message, to mimic the zeRGBa Widget output\nmsg.r=RED;\nmsg.g=GREEN;\nmsg.b=BLUE;\n\n// Update the text on the node to show the RGB colour\nnode.status({text: \"[\" + RED + \", \" + GREEN + \", \" + BLUE + \"]\"});\n\n\n// Output all the new message objects\nreturn [msg, null, null]; \n}\n\n\n// Function code taken from:\n// https://stackoverflow.com/questions/17242144/javascript-convert-hsb-hsv-color-to-rgb-accurately\n/* accepts parameters\n * h  Object = {h:x, s:y, v:z}\n * OR \n *h, s, v\n*/\nfunction HSVtoRGB(h, s, v) {\n    var r, g, b, i, f, p, q, t;\n    if (arguments.length === 1) {\n        s = h.s, v = h.v, h = h.h;\n    }\n    i = Math.floor(h * 6);\n    f = h * 6 - i;\n    p = v * (1 - s);\n    q = v * (1 - f * s);\n    t = v * (1 - (1 - f) * s);\n    switch (i % 6) {\n        case 0: r = v, g = t, b = p; break;\n        case 1: r = q, g = v, b = p; break;\n        case 2: r = p, g = v, b = t; break;\n        case 3: r = p, g = q, b = v; break;\n        case 4: r = t, g = p, b = v; break;\n        case 5: r = v, g = p, b = q; break;\n    }\n    return {\n        r: Math.round(r * 255),\n        g: Math.round(g * 255),\n        b: Math.round(b * 255)\n    };\n}",
        "outputs": 3,
        "noerr": 0,
        "x": 280,
        "y": 260,
        "wires": [
            [
                "c5d51c9f.c7271",
                "9ffe84dc.6ab2b8"
            ],
            [
                "f13be880.025d38",
                "3c57c82b.ccd298"
            ],
            [
                "464da668.1f3258",
                "62cf19a5.6e6028"
            ]
        ],
        "inputLabels": [
            "Input from Alexa or zeRGBa"
        ],
        "outputLabels": [
            "RGB Data",
            "Brightness Data",
            "On/Off Command"
        ]
    },
    {
        "id": "c5d51c9f.c7271",
        "type": "function",
        "z": "5ca5bfb8.5917d",
        "name": "Store RGB values",
        "func": "// store the red green and blue values to flow-level variables so thatwe can use them\n// later in the brightness calculation\n\nflow.set('rr',msg.r);  // store the red value  \nflow.set('gg',msg.g);  // store the green value  \nflow.set('bb',msg.b);  // store the blue value \n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 370,
        "y": 120,
        "wires": [
            [
                "bf96436f.d2d65"
            ]
        ]
    },
    {
        "id": "f13be880.025d38",
        "type": "function",
        "z": "5ca5bfb8.5917d",
        "name": "Calc Brightness",
        "func": "// initialise PingFailCount_1 to 0 if it doesn't exist already\nvar rr = flow.get('rr')||0; //existing red value\nvar gg = flow.get('gg')||0; //existing green value\nvar bb = flow.get('bb')||0; //existing blue value\n\nvar V = msg.payload; // Brightness value\n\nvar rrr = Math.round(rr*V/100); // dimmed red value\nvar ggg = Math.round(gg*V/100); // dimmed green value\nvar bbb = Math.round(bb*V/100); // dimmed blue value\n\nnode.status({text: \"Dimmed \" + rrr + \", \" + ggg + \", \" + bbb});  \n\n// Convert the parts into Hex values...\nvar RED_HEX = (rrr).toString(16);\nif (RED_HEX == \"0\")\n{\n    RED_HEX=\"00\"\n}    \n\nvar GREEN_HEX = (ggg).toString(16);\nif (GREEN_HEX == \"0\")\n{\n    GREEN_HEX=\"00\"\n}  \n\nvar BLUE_HEX = (bbb).toString(16);\nif (BLUE_HEX == \"0\")\n{\n    BLUE_HEX=\"00\"\n}   \n\n// Build a message called hex with the RGB Hex value, to mimick the zeRGBa Widget output\nmsg.hex = \"#\" +  RED_HEX + GREEN_HEX + BLUE_HEX;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 540,
        "y": 400,
        "wires": [
            [
                "e0b14d7f.457e2"
            ]
        ],
        "outputLabels": [
            "On/Off"
        ]
    },
    {
        "id": "bf975384.c924",
        "type": "blynk-ws-in-write",
        "z": "5ca5bfb8.5917d",
        "name": "Slider Widget on V2  (0-100)",
        "pin": "2",
        "pin_all": 0,
        "client": "859549ef.52e4b8",
        "x": 160,
        "y": 400,
        "wires": [
            [
                "f13be880.025d38"
            ]
        ]
    },
    {
        "id": "3c57c82b.ccd298",
        "type": "blynk-ws-out-write",
        "z": "5ca5bfb8.5917d",
        "name": "Slider Widget V2 - Update Brightness value",
        "pin": "2",
        "pinmode": 0,
        "client": "859549ef.52e4b8",
        "x": 670,
        "y": 260,
        "wires": []
    },
    {
        "id": "464da668.1f3258",
        "type": "function",
        "z": "5ca5bfb8.5917d",
        "name": "Output On/Off command to MagicHome",
        "func": "if (msg.payload ==\"0\")\n{\n   return [{'payload': '\"on\"' + \":\"  + \"false\"}]; \n}\n\nif (msg.payload ==\"1\")\n{\n   return [{'payload': '\"on\"' + \":\"  + \"true\"}]; \n}",
        "outputs": 1,
        "noerr": 0,
        "x": 620,
        "y": 560,
        "wires": [
            [
                "61da61d0.5c7af",
                "6a3534a9.0c85fc"
            ]
        ],
        "outputLabels": [
            "On/Off"
        ]
    },
    {
        "id": "62cf19a5.6e6028",
        "type": "blynk-ws-out-write",
        "z": "5ca5bfb8.5917d",
        "name": "Button Widget V3 - Update On/Off satus",
        "pin": "3",
        "pinmode": 0,
        "client": "859549ef.52e4b8",
        "x": 660,
        "y": 500,
        "wires": []
    },
    {
        "id": "90fd5b03.3816e8",
        "type": "blynk-ws-in-write",
        "z": "5ca5bfb8.5917d",
        "name": "Button Widget on V3 (0/1)",
        "pin": "3",
        "pin_all": 0,
        "client": "859549ef.52e4b8",
        "x": 150,
        "y": 560,
        "wires": [
            [
                "464da668.1f3258"
            ]
        ]
    },
    {
        "id": "9ffe84dc.6ab2b8",
        "type": "blynk-ws-zergba",
        "z": "5ca5bfb8.5917d",
        "name": "zeRGBa Widget V1 - Update Colour value",
        "pin": "1",
        "client": "859549ef.52e4b8",
        "x": 660,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "61da61d0.5c7af",
        "type": "debug",
        "z": "5ca5bfb8.5917d",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 1090,
        "y": 560,
        "wires": []
    },
    {
        "id": "e0b14d7f.457e2",
        "type": "function",
        "z": "5ca5bfb8.5917d",
        "name": "Output Dimmed RGB values to MagicHome",
        "func": "return [{'payload': '\"color\"' + \":\" + msg.hex + \"00\"}]; ",
        "outputs": 1,
        "noerr": 0,
        "x": 830,
        "y": 400,
        "wires": [
            [
                "61da61d0.5c7af",
                "6a3534a9.0c85fc"
            ]
        ]
    },
    {
        "id": "bf96436f.d2d65",
        "type": "blynk-ws-out-sync",
        "z": "5ca5bfb8.5917d",
        "name": "",
        "pin": "2",
        "pinmode": 0,
        "client": "859549ef.52e4b8",
        "x": 580,
        "y": 120,
        "wires": []
    },
    {
        "id": "6a3534a9.0c85fc",
        "type": "MagicHome UFO",
        "z": "5ca5bfb8.5917d",
        "name": "",
        "ip": "",
        "style": "RGBW",
        "x": 1150,
        "y": 480,
        "wires": [
            []
        ]
    },
    {
        "id": "859549ef.52e4b8",
        "type": "blynk-ws-client",
        "z": "",
        "name": "Development",
        "path": "ws://blynk-cloud.com/websockets",
        "key": "REDACTED",
        "dbg_all": false,
        "dbg_read": false,
        "dbg_write": false,
        "dbg_notify": false,
        "dbg_mail": false,
        "dbg_prop": false,
        "dbg_sync": false,
        "dbg_bridge": false,
        "dbg_low": false,
        "dbg_pins": "",
        "multi_cmd": false,
        "proxy_type": "no",
        "proxy_url": ""
    },
    {
        "id": "c0110d92.aab95",
        "type": "alexa-home-conf",
        "z": "",
        "username": "REDACTED"
    }
]

Copy the flow code to your clipboard then in Node-Red click the three horizontal bars in the top right hand cornet and choose Import then Clipboard. Paste the code in the box then click the Import to New Flow button then Import.
You’ll need to go into the Blynk and Amazon and MagicHome nodes to change them to your own stored connections, and change the virtual pins in the Blynk nodes.

Let me know how you get on. If the MagicHome stuff doesn’t work, but the debug message looks about right, then I guess the format of the code in the two functions that output data to MagicHome may need tweaking a little.

I realise that you have RGB sliders sitting alongside your zeRGBa widhet. We (or maybe you) can add these later, once this example works. Adding them in at this stage would just add to the complexity of the flow and make it difficult to get the basics working.

Cheers,

Pete.

Sorry Pete for the delay, I was far from Home.
Today I will test both functions and let you know.

1 Like

when I tried your latest Flow I got an error and i don’t know how to solve it.
I disabled all my old flows and still same error message.
I disabled your flow same error and Node-Red stop running.

3 Nov 13:02:05 - [info] [blynk-ws-client:Development] Client logged
3 Nov 13:02:05 - [info] [blynk-ws-client:Development] SEND -> Cmd: INTERNAL, Id: 2, len: 82, data: "ver|0.5.3|h-beat|10|buff-in|32767|dev|node-red|con|Blynk-ws|build|0.7.1 2018-08-04"
3 Nov 13:02:05 - [info] [blynk-ws-client:50178c3e.8203c4] Client logged
3 Nov 13:02:05 - [info] [blynk-ws-client:Development] RECV <- Cmd: RSP, Id: 2, responseCode: OK
3 Nov 13:02:09 - [red] Uncaught Exception:
3 Nov 13:02:09 - Error: connect ECONNREFUSED 127.0.0.1:5577
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
pi@hassbian:~ $

It looks like the type of issue you get if you have dodgy Blynk or Alexa credentials on one of your nodes.
I redacted my Blynk Auth code from the exported flow, along with my Alexa credentials. Did you change all of the Blynk nodes so that they are using a connection to one of your projects, and set-up the Alexa node to use your credentials?

Pete.

Yes I did.

Hmmm… I guess the MagicHome UFO node needs to be configured as well. When I put this node on my flow and deploy it, it fills everything else because it’s not configured. That’s why the screenshot of my flow shows the Alexa and MagicHome nodes with red dots against them.

What does it say if you type node-red-start in the command line of your Pi?

Pete.

pi@hassbian:~ $ node-red
3 Nov 13:29:38 - [info]

Welcome to Node-RED
===================

3 Nov 13:29:38 - [info] Node-RED version: v0.19.4
3 Nov 13:29:38 - [info] Node.js  version: v8.11.1
3 Nov 13:29:38 - [info] Linux 4.14.71-v7+ arm LE
3 Nov 13:29:43 - [info] Loading palette nodes
3 Nov 13:29:58 - [info] Dashboard version 2.10.0 started at /ui
3 Nov 13:29:59 - [info] Settings file  : /home/pi/.node-red/settings.js
3 Nov 13:29:59 - [info] Context store  : 'default' [module=memory]
3 Nov 13:29:59 - [info] User directory : /home/pi/.node-red
3 Nov 13:29:59 - [warn] Projects disabled : editorTheme.projects.enabled=false
3 Nov 13:29:59 - [info] Flows file     : /home/pi/.node-red/flows_hassbian.json
3 Nov 13:29:59 - [info] Server now running at http://127.0.0.1:1880/
3 Nov 13:30:00 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

3 Nov 13:30:00 - [info] Starting flows
3 Nov 13:30:00 - [info] [blynk-ws-client:50178c3e.8203c4] LOG PINS ["0"]
3 Nov 13:30:00 - [info] [blynk-ws-client:50178c3e.8203c4]  ws:///xxx.xxx.xxx.xxx/websockets
3 Nov 13:30:00 - [info] [blynk-ws-client:Development] LOG PINS ["0"]
3 Nov 13:30:00 - [info] [blynk-ws-client:Development]  ws://xxx.xxx.xxx.xxx/websockets
Callback URL = http:///xxx.xxx.xxx.xxx:1880/wemoNG/notification
3 Nov 13:30:00 - [info] [blynk-ws-client:50178c3e.8203c4] Register input node - type: style-btn pin: 37
3 Nov 13:30:00 - [info] [blynk-ws-client:50178c3e.8203c4] Register input node - type: write pin: 37
3 Nov 13:30:01 - [info] [blynk-ws-client:50178c3e.8203c4] Register email node
3 Nov 13:30:01 - [info] [MagicHome UFO:Living Room Strip] RGBW
3 Nov 13:30:01 - [info] [blynk-ws-client:50178c3e.8203c4] Register input node - type: zergba pin: 40
3 Nov 13:30:01 - [info] [MagicHome UFO:Living Room Strip] RGBW
3 Nov 13:30:01 - [info] [blynk-ws-client:50178c3e.8203c4] Register input node - type: zergba pin: 40
3 Nov 13:30:01 - [info] [blynk-ws-client:50178c3e.8203c4] Register input node - type: zergba pin: 40
3 Nov 13:30:02 - [info] [blynk-ws-client:Development] Register input node - type: write pin: 2
3 Nov 13:30:02 - [info] [blynk-ws-client:50178c3e.8203c4] Register input node - type: write pin: 37
3 Nov 13:30:02 - [info] [blynk-ws-client:Development] Register input node - type: zergba pin: 1
3 Nov 13:30:02 - [info] [MagicHome UFO:3ebf6e5b.4ac8a2] RGBW
3 Nov 13:30:02 - [info] Started flows
3 Nov 13:30:02 - [info] [mqtt-broker:MQTT] Connected to broker: mqtt:///xxx.xxx.xxx.xxx:1883
3 Nov 13:30:02 - [error] [alexa-home-conf:aaf3258b.fe05a8] Error: connect ECONNREFUSED 34.240.81.189:8883
3 Nov 13:30:02 - [error] [alexa-home-conf:83b02cb9.19b74] Error: connect ECONNREFUSED 34.240.81.189:8883
3 Nov 13:30:02 - [info] [blynk-ws-client:Development] login -> ***************************5eb45
3 Nov 13:30:02 - [info] [blynk-ws-client:Development] SEND -> Cmd: LOGIN, Id: 1, len: 32, data: "***************************5eb45"
3 Nov 13:30:02 - [info] [blynk-ws-client:50178c3e.8203c4] Client logged
3 Nov 13:30:02 - [info] [blynk-ws-client:Development] RECV <- Cmd: RSP, Id: 1, responseCode: OK
3 Nov 13:30:02 - [info] [blynk-ws-client:Development] Client logged
3 Nov 13:30:02 - [info] [blynk-ws-client:Development] SEND -> Cmd: INTERNAL, Id: 2, len: 82, data: "ver|0.5.3|h-beat|10|buff-in|32767|dev|node-red|con|Blynk-ws|build|0.7.1 2018-08-04"
3 Nov 13:30:02 - [info] [blynk-ws-client:Development] RECV <- Cmd: RSP, Id: 2, responseCode: OK
3 Nov 13:30:07 - [red] Uncaught Exception:
3 Nov 13:30:07 - Error: connect ECONNREFUSED 127.0.0.1:5577
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
pi@hassbian:~ $