Homeseer Random Colour Bulb Change

Hi everybody, this is my first attempt at a node-red flow. The purpose of this was to get my Aeon z-wave light bulb to change colour randomly at random interval. This light bulb is part of my Christmas decoration outside. You'll need the following paletts "node-red-contrib-homeseer", "node-red-contrib-random-event-generator", and "node-red-node-random". In Homeseer, the bulb has 7 controls, a control for the red, blue and green channels, a control for the Cool-White and Warm-White, another for a RGB setting, and a control for Dimming. I couldn't get node-red to send anything to the RGB control and the dimmer is set to 100% when the bulb comes on in homeseer. So I'm only using 5 of the 7 controls.

I setup it up in Homeseer that I have a virtual switch that comes on when it's time for the Holiday lights to be on (sunset to 10pm). In Node-red, when this virtual switch comes on, it activates the random event which sends a trigger between 30 and 120 seconds. It also turns off the Cool & Warm white. When the event is triggered it sends a random number between 1 and 255 to the red channel, then another to green channel and finally another to the blue channel.

When the virtual switch turns off, it resets the bulb's colour to Warm-White and all the rest to off. It also turns off the event timer.


[
    {
        "id": "736c96e8.5b772",
        "type": "inject",
        "z": "2bcb81e0.3bf1ee",
        "name": "toggle",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            },
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "control",
        "payload": "toggle",
        "payloadType": "str",
        "x": 790,
        "y": 540,
        "wires": [
            [
                "5c3b1ea5.d3edf8"
            ]
        ]
    },
    {
        "id": "3c87bd13.713992",
        "type": "debug",
        "z": "2bcb81e0.3bf1ee",
        "name": "Event Message",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1320,
        "y": 480,
        "wires": []
    },
    {
        "id": "5c3b1ea5.d3edf8",
        "type": "event",
        "z": "2bcb81e0.3bf1ee",
        "name": "",
        "controlTopic": "control",
        "startCmd": "start",
        "stopCmd": "stop",
        "meanInterval": "120",
        "distribution": "uniform",
        "minInterval": "30",
        "maxInterval": "120",
        "outputTopic": "event",
        "outputPayload": "timestamp",
        "x": 1110,
        "y": 600,
        "wires": [
            [
                "3c87bd13.713992",
                "787f1624.3eb21",
                "97e255e.7707aa8",
                "e3b3ce0f.b33688"
            ]
        ]
    },
    {
        "id": "d8afe4cd.65a53",
        "type": "inject",
        "z": "2bcb81e0.3bf1ee",
        "name": "start",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            },
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "control",
        "payload": "start",
        "payloadType": "str",
        "x": 790,
        "y": 460,
        "wires": [
            [
                "5c3b1ea5.d3edf8"
            ]
        ]
    },
    {
        "id": "c4ce78c3.2705f8",
        "type": "inject",
        "z": "2bcb81e0.3bf1ee",
        "name": "stop",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            },
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "control",
        "payload": "stop",
        "payloadType": "str",
        "x": 790,
        "y": 500,
        "wires": [
            [
                "5c3b1ea5.d3edf8"
            ]
        ]
    },
    {
        "id": "6ad7b0f0.4d0a68",
        "type": "debug",
        "z": "2bcb81e0.3bf1ee",
        "name": "Holiday Switch",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 800,
        "y": 820,
        "wires": []
    },
    {
        "id": "106e319c.2d07ce",
        "type": "hs-device",
        "z": "2bcb81e0.3bf1ee",
        "name": "Holiday Lights Control",
        "device": "231",
        "server": "3e12b471.f3aa44",
        "feature": "232",
        "reportonstartup": true,
        "x": 600,
        "y": 760,
        "wires": [
            [
                "6ad7b0f0.4d0a68",
                "d6e343c6.56ae8",
                "691c1045.28a388"
            ]
        ]
    },
    {
        "id": "d6e343c6.56ae8",
        "type": "switch",
        "z": "2bcb81e0.3bf1ee",
        "name": "if (on) else",
        "property": "payload.value",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "100",
                "vt": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 610,
        "y": 600,
        "wires": [
            [
                "b9640f2b.cc02c"
            ],
            [
                "e82c8239.cf2fe8"
            ]
        ]
    },
    {
        "id": "b9640f2b.cc02c",
        "type": "change",
        "z": "2bcb81e0.3bf1ee",
        "name": "Start",
        "rules": [
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "start",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "control",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 790,
        "y": 580,
        "wires": [
            [
                "5c3b1ea5.d3edf8"
            ]
        ]
    },
    {
        "id": "e82c8239.cf2fe8",
        "type": "change",
        "z": "2bcb81e0.3bf1ee",
        "name": "Stop",
        "rules": [
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "stop",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "control",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 790,
        "y": 620,
        "wires": [
            [
                "5c3b1ea5.d3edf8",
                "6a4a1436.1fd56c",
                "4e1d4779.956088"
            ]
        ]
    },
    {
        "id": "34453b76.3e3414",
        "type": "hs-device",
        "z": "2bcb81e0.3bf1ee",
        "name": "Lamp Post Bulb Blue",
        "device": "1107",
        "server": "3e12b471.f3aa44",
        "feature": "1112",
        "reportonstartup": true,
        "x": 1780,
        "y": 540,
        "wires": [
            [
                "ce51e459.5015f"
            ]
        ]
    },
    {
        "id": "8b05f115.9cb06",
        "type": "hs-device",
        "z": "2bcb81e0.3bf1ee",
        "name": "Lamp Post Bulb Green",
        "device": "1107",
        "server": "3e12b471.f3aa44",
        "feature": "1111",
        "reportonstartup": true,
        "x": 1780,
        "y": 600,
        "wires": [
            [
                "ce51e459.5015f"
            ]
        ]
    },
    {
        "id": "94588645.c4aac8",
        "type": "hs-device",
        "z": "2bcb81e0.3bf1ee",
        "name": "Lamp Post Bulb Red",
        "device": "1107",
        "server": "3e12b471.f3aa44",
        "feature": "1110",
        "reportonstartup": true,
        "x": 1780,
        "y": 660,
        "wires": [
            [
                "ce51e459.5015f"
            ]
        ]
    },
    {
        "id": "9017aea0.c1f0d8",
        "type": "hs-device",
        "z": "2bcb81e0.3bf1ee",
        "name": "Lamp Post Bulb CW",
        "device": "1107",
        "server": "3e12b471.f3aa44",
        "feature": "1109",
        "reportonstartup": true,
        "x": 1780,
        "y": 740,
        "wires": [
            [
                "ce51e459.5015f"
            ]
        ]
    },
    {
        "id": "d2e9686d.ed0218",
        "type": "hs-device",
        "z": "2bcb81e0.3bf1ee",
        "name": "Lamp Post Bulb WW",
        "device": "1107",
        "server": "3e12b471.f3aa44",
        "feature": "1108",
        "reportonstartup": true,
        "x": 1780,
        "y": 800,
        "wires": [
            [
                "ce51e459.5015f"
            ]
        ]
    },
    {
        "id": "691c1045.28a388",
        "type": "change",
        "z": "2bcb81e0.3bf1ee",
        "name": "Off",
        "rules": [
            {
                "t": "set",
                "p": "payload.value",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "control",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1530,
        "y": 800,
        "wires": [
            [
                "9017aea0.c1f0d8",
                "d2e9686d.ed0218"
            ]
        ]
    },
    {
        "id": "ce51e459.5015f",
        "type": "debug",
        "z": "2bcb81e0.3bf1ee",
        "name": "Bulb Other Message",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 2060,
        "y": 660,
        "wires": []
    },
    {
        "id": "787f1624.3eb21",
        "type": "random",
        "z": "2bcb81e0.3bf1ee",
        "name": "",
        "low": "0",
        "high": "255",
        "inte": "true",
        "property": "payload",
        "x": 1300,
        "y": 540,
        "wires": [
            [
                "70bb1ba5.06031c"
            ]
        ]
    },
    {
        "id": "70bb1ba5.06031c",
        "type": "change",
        "z": "2bcb81e0.3bf1ee",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.value",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "control",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1500,
        "y": 540,
        "wires": [
            [
                "34453b76.3e3414"
            ]
        ]
    },
    {
        "id": "97e255e.7707aa8",
        "type": "random",
        "z": "2bcb81e0.3bf1ee",
        "name": "",
        "low": "0",
        "high": "255",
        "inte": "true",
        "property": "payload",
        "x": 1300,
        "y": 600,
        "wires": [
            [
                "899b9b1c.8b92d"
            ]
        ]
    },
    {
        "id": "e3b3ce0f.b33688",
        "type": "random",
        "z": "2bcb81e0.3bf1ee",
        "name": "",
        "low": "0",
        "high": "255",
        "inte": "true",
        "property": "payload",
        "x": 1300,
        "y": 660,
        "wires": [
            [
                "9d26c75d.a4a5d8"
            ]
        ]
    },
    {
        "id": "899b9b1c.8b92d",
        "type": "change",
        "z": "2bcb81e0.3bf1ee",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.value",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "control",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1500,
        "y": 600,
        "wires": [
            [
                "8b05f115.9cb06"
            ]
        ]
    },
    {
        "id": "9d26c75d.a4a5d8",
        "type": "change",
        "z": "2bcb81e0.3bf1ee",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.value",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "control",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1500,
        "y": 660,
        "wires": [
            [
                "94588645.c4aac8"
            ]
        ]
    },
    {
        "id": "6a4a1436.1fd56c",
        "type": "change",
        "z": "2bcb81e0.3bf1ee",
        "name": "Off",
        "rules": [
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "set",
                "p": "payload.value",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "control",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1530,
        "y": 720,
        "wires": [
            [
                "34453b76.3e3414",
                "8b05f115.9cb06",
                "94588645.c4aac8",
                "9017aea0.c1f0d8"
            ]
        ]
    },
    {
        "id": "4e1d4779.956088",
        "type": "change",
        "z": "2bcb81e0.3bf1ee",
        "name": "On",
        "rules": [
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            },
            {
                "t": "set",
                "p": "payload.value",
                "pt": "msg",
                "to": "255",
                "tot": "num"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "control",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1530,
        "y": 760,
        "wires": [
            [
                "d2e9686d.ed0218"
            ]
        ]
    },
    {
        "id": "1ca5586.0c02aa8",
        "type": "inject",
        "z": "2bcb81e0.3bf1ee",
        "name": "Off",
        "props": [
            {
                "p": "payload.value",
                "v": "0",
                "vt": "num"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "control",
        "payloadType": "str",
        "x": 390,
        "y": 780,
        "wires": [
            [
                "106e319c.2d07ce"
            ]
        ]
    },
    {
        "id": "dd83f2eb.b3ffb",
        "type": "inject",
        "z": "2bcb81e0.3bf1ee",
        "name": "On",
        "props": [
            {
                "p": "payload.value",
                "v": "100",
                "vt": "num"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "control",
        "x": 390,
        "y": 740,
        "wires": [
            [
                "106e319c.2d07ce"
            ]
        ]
    },
    {
        "id": "3e12b471.f3aa44",
        "type": "hs-server",
        "name": "homeseer",
        "host": "<your.homeseer.ip.address>",
        "port": "80"
    }
]

This topic was automatically closed after 60 days. New replies are no longer allowed.