Here are two others in the context of a set of sequences that demonstrate how to capture the state of an RGBW device to a set of flow variables, and restore that captured state using the previously saved flow variables.
I've demonstrated two ways to pass H+S+L or CT+L to msg.arguments during the restore. The first method uses a join node. The second, which is cleaner, uses a template node.
Sequence that can be imported
[
{
"id": "91a3133eb0da7fd1",
"type": "tab",
"label": "Capture/Restore",
"disabled": false,
"info": ""
},
{
"id": "bd43a28e31299b4e",
"type": "join",
"z": "91a3133eb0da7fd1",
"name": "json join",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "3",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 900,
"y": 580,
"wires": [
[
"1a20d06b3e2b00de"
]
]
},
{
"id": "33c87a8fe098f670",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "hue",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "hue",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "nightstand_hue",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 690,
"y": 540,
"wires": [
[
"bd43a28e31299b4e"
]
]
},
{
"id": "9e9ff88f8850ec97",
"type": "delay",
"z": "91a3133eb0da7fd1",
"name": "",
"pauseType": "delay",
"timeout": "1",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 775,
"y": 580,
"wires": [
[
"bd43a28e31299b4e"
]
],
"l": false
},
{
"id": "882f9aa4ccd461d8",
"type": "delay",
"z": "91a3133eb0da7fd1",
"name": "",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 775,
"y": 620,
"wires": [
[
"bd43a28e31299b4e"
]
],
"l": false
},
{
"id": "1a20d06b3e2b00de",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "setColor",
"rules": [
{
"t": "set",
"p": "command",
"pt": "msg",
"to": "setColor",
"tot": "str"
},
{
"t": "set",
"p": "arguments",
"pt": "msg",
"to": "$string(payload)",
"tot": "jsonata"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1060,
"y": 580,
"wires": [
[
"752c91c1499e6c0d"
]
]
},
{
"id": "ebaff8760d384dad",
"type": "inject",
"z": "91a3133eb0da7fd1",
"name": "capture",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payloadType": "str",
"x": 190,
"y": 220,
"wires": [
[
"d493e99a42f7e962"
]
]
},
{
"id": "b844cd04e44b82c2",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "sat",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "saturation",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "nightstand_sat",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 580,
"wires": [
[
"9e9ff88f8850ec97"
]
]
},
{
"id": "a068ec247987c0a3",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "lvl",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "level",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "nightstand_level",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 620,
"wires": [
[
"882f9aa4ccd461d8"
]
]
},
{
"id": "752c91c1499e6c0d",
"type": "hubitat command",
"z": "91a3133eb0da7fd1",
"deviceLabel": "Nightstand",
"name": "",
"server": "a22e0ea9.276dc8",
"deviceId": "1848",
"command": "",
"commandArgs": "",
"x": 1230,
"y": 520,
"wires": [
[]
]
},
{
"id": "34509478991b20e0",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "setCT",
"rules": [
{
"t": "set",
"p": "command",
"pt": "msg",
"to": "setColorTemperature",
"tot": "str"
},
{
"t": "set",
"p": "arguments",
"pt": "msg",
"to": "$string(payload)",
"tot": "jsonata"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1070,
"y": 460,
"wires": [
[
"752c91c1499e6c0d"
]
]
},
{
"id": "0b1d78c881efdaa9",
"type": "join",
"z": "91a3133eb0da7fd1",
"name": "string join",
"mode": "custom",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "3",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 900,
"y": 460,
"wires": [
[
"34509478991b20e0"
]
]
},
{
"id": "3a6e9026443d9a4b",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "CT",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "CT",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "nightstand_ct",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 690,
"y": 420,
"wires": [
[
"0b1d78c881efdaa9"
]
]
},
{
"id": "fa09d8b57c2cae11",
"type": "delay",
"z": "91a3133eb0da7fd1",
"name": "",
"pauseType": "delay",
"timeout": "1",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 775,
"y": 460,
"wires": [
[
"0b1d78c881efdaa9"
]
],
"l": false
},
{
"id": "a172a41701dca630",
"type": "delay",
"z": "91a3133eb0da7fd1",
"name": "",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 775,
"y": 500,
"wires": [
[
"0b1d78c881efdaa9"
]
],
"l": false
},
{
"id": "a29e26c0b164ffaa",
"type": "inject",
"z": "91a3133eb0da7fd1",
"name": "restore",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payloadType": "str",
"x": 190,
"y": 520,
"wires": [
[
"d7d131b5316c0ae1"
]
]
},
{
"id": "6c7591caf5a8ae1b",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "lvl",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "level",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "nightstand_level",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 460,
"wires": [
[
"fa09d8b57c2cae11"
]
]
},
{
"id": "adc81e31e3a921e5",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "time",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "time",
"tot": "str"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "0",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 670,
"y": 500,
"wires": [
[
"a172a41701dca630"
]
]
},
{
"id": "d493e99a42f7e962",
"type": "hubitat device",
"z": "91a3133eb0da7fd1",
"deviceLabel": "Nightstand",
"name": "",
"server": "a22e0ea9.276dc8",
"deviceId": "1848",
"attribute": "",
"sendEvent": false,
"x": 350,
"y": 220,
"wires": [
[
"335faf55a5b1b2e2"
]
]
},
{
"id": "335faf55a5b1b2e2",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "nightstand",
"rules": [
{
"t": "set",
"p": "nightstand_switch",
"pt": "flow",
"to": "payload.switch.value",
"tot": "msg"
},
{
"t": "set",
"p": "nightstand_colorMode",
"pt": "flow",
"to": "payload.colorMode.value",
"tot": "msg"
},
{
"t": "set",
"p": "nightstand_ct",
"pt": "flow",
"to": "payload.colorTemperature.value",
"tot": "msg"
},
{
"t": "set",
"p": "nightstand_hue",
"pt": "flow",
"to": "payload.hue.value",
"tot": "msg"
},
{
"t": "set",
"p": "nightstand_sat",
"pt": "flow",
"to": "payload.saturation.value",
"tot": "msg"
},
{
"t": "set",
"p": "nightstand_level",
"pt": "flow",
"to": "payload.level.value",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 530,
"y": 220,
"wires": [
[]
]
},
{
"id": "d7d131b5316c0ae1",
"type": "switch",
"z": "91a3133eb0da7fd1",
"name": "on/off",
"property": "nightstand_switch",
"propertyType": "flow",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 330,
"y": 520,
"wires": [
[
"ae9b298edeef2436"
],
[
"190351b1c435ba0d"
]
]
},
{
"id": "ae9b298edeef2436",
"type": "switch",
"z": "91a3133eb0da7fd1",
"name": "CT or RGB",
"property": "nightstand_colorMode",
"propertyType": "flow",
"rules": [
{
"t": "eq",
"v": "CT",
"vt": "str"
},
{
"t": "eq",
"v": "RGB",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 490,
"y": 520,
"wires": [
[
"3a6e9026443d9a4b",
"6c7591caf5a8ae1b",
"adc81e31e3a921e5"
],
[
"33c87a8fe098f670",
"b844cd04e44b82c2",
"a068ec247987c0a3"
]
]
},
{
"id": "de897648d00e3312",
"type": "comment",
"z": "91a3133eb0da7fd1",
"name": "CAPTURE",
"info": "",
"x": 180,
"y": 160,
"wires": []
},
{
"id": "88864d62853db2d2",
"type": "comment",
"z": "91a3133eb0da7fd1",
"name": "RESTORE",
"info": "",
"x": 180,
"y": 340,
"wires": []
},
{
"id": "190351b1c435ba0d",
"type": "hubitat command",
"z": "91a3133eb0da7fd1",
"deviceLabel": "Nightstand",
"name": "",
"server": "a22e0ea9.276dc8",
"deviceId": "1848",
"command": "off",
"commandArgs": "",
"x": 490,
"y": 580,
"wires": [
[]
]
},
{
"id": "014055f77ed84f67",
"type": "inject",
"z": "91a3133eb0da7fd1",
"name": "restore",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payloadType": "str",
"x": 190,
"y": 760,
"wires": [
[
"017ab3f736444c0e"
]
]
},
{
"id": "017ab3f736444c0e",
"type": "switch",
"z": "91a3133eb0da7fd1",
"name": "on/off",
"property": "nightstand_switch",
"propertyType": "flow",
"rules": [
{
"t": "eq",
"v": "on",
"vt": "str"
},
{
"t": "eq",
"v": "off",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 330,
"y": 760,
"wires": [
[
"2094f7829799edf6"
],
[
"d1285baa82986252"
]
]
},
{
"id": "2094f7829799edf6",
"type": "switch",
"z": "91a3133eb0da7fd1",
"name": "CT or RGB",
"property": "nightstand_colorMode",
"propertyType": "flow",
"rules": [
{
"t": "eq",
"v": "CT",
"vt": "str"
},
{
"t": "eq",
"v": "RGB",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 490,
"y": 760,
"wires": [
[
"74f5c9f8c6c486b0"
],
[
"1ef53261633bc945"
]
]
},
{
"id": "d1285baa82986252",
"type": "hubitat command",
"z": "91a3133eb0da7fd1",
"deviceLabel": "Nightstand",
"name": "",
"server": "a22e0ea9.276dc8",
"deviceId": "1848",
"command": "off",
"commandArgs": "",
"x": 490,
"y": 820,
"wires": [
[]
]
},
{
"id": "69cde6cad2b9be64",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "setCT",
"rules": [
{
"t": "set",
"p": "command",
"pt": "msg",
"to": "setColorTemperature",
"tot": "str"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 870,
"y": 740,
"wires": [
[
"0e98fd79fdae948f"
]
]
},
{
"id": "c3cd84f69eb81d80",
"type": "change",
"z": "91a3133eb0da7fd1",
"name": "setColor",
"rules": [
{
"t": "set",
"p": "command",
"pt": "msg",
"to": "setColor",
"tot": "str"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 860,
"y": 780,
"wires": [
[
"0e98fd79fdae948f"
]
]
},
{
"id": "0e98fd79fdae948f",
"type": "hubitat command",
"z": "91a3133eb0da7fd1",
"deviceLabel": "Nightstand",
"name": "",
"server": "a22e0ea9.276dc8",
"deviceId": "1848",
"command": "",
"commandArgs": "",
"x": 1050,
"y": 760,
"wires": [
[]
]
},
{
"id": "74f5c9f8c6c486b0",
"type": "template",
"z": "91a3133eb0da7fd1",
"name": "CT arguments",
"field": "arguments",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{flow.nightstand_ct}},{{flow.nightstand_level}},0",
"output": "str",
"x": 680,
"y": 740,
"wires": [
[
"69cde6cad2b9be64"
]
]
},
{
"id": "1ef53261633bc945",
"type": "template",
"z": "91a3133eb0da7fd1",
"name": "color arguments",
"field": "arguments",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{\"hue\":{{flow.nightstand_hue}},\"saturation\":{{flow.nightstand_sat}},\"level\":{{flow.nightstand_level}}}",
"output": "str",
"x": 680,
"y": 780,
"wires": [
[
"c3cd84f69eb81d80"
]
]
},
{
"id": "a22e0ea9.276dc8",
"type": "hubitat config",
"name": "HubitatM",
"usetls": false,
"host": "192.168.1.46",
"port": "80",
"appId": "1522",
"nodeRedServer": "http://192.168.1.4:1880",
"webhookPath": "/hubitat/webhook",
"autoRefresh": true,
"useWebsocket": false,
"colorEnabled": true,
"color": "#5dd049"
}
]