Node Red - Automate LZW45 pixel effect calculations via Subflow

With the assistance of one of my good friends, I’ve finally finished putting together a couple different node red subflows for use with the new LZW45 light strip. The first one will pull all of your light strips from a group titled “group.inovelli_led_strips”. It will take every lightstrip within this group and set it to the brightness and pixel effect of your choice (defined on the subflow itself). Simply double click the subflow, enter in a value between 1-99 for brightness and 1-46 for pixel effect, then attach the subflow to your automation. It will calculate the correct number for the effect you’re attempting to set.

Set Pixel effect of a Group:

[{"id":"ca7050b9.e2978","type":"subflow","name":"Set Pixel Effect of a Group","info":"","category":"","in":[{"x":120,"y":240,"wires":[{"id":"be42716.a8b289"}]}],"out":[{"x":1420,"y":340,"wires":[{"id":"f1dd549a.8bdb08","port":0}]}],"env":[{"name":"brightness","type":"num","value":""},{"name":"pixel_effect","type":"num","value":""}],"color":"#DDAA99","status":{"x":280,"y":160,"wires":[{"id":"32a7fb8e.cdc894","port":0}]}},{"id":"3fd7e9a4.af9616","type":"function","z":"ca7050b9.e2978","name":"Throw Value Error","func":"throw(\"Invalid Brightness Intensity. Value must be a number between 1 and 99.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":490,"y":420,"wires":[]},{"id":"32a7fb8e.cdc894","type":"status","z":"ca7050b9.e2978","name":"","scope":null,"x":160,"y":160,"wires":[[]]},{"id":"97ca420d.05be5","type":"function","z":"ca7050b9.e2978","name":"Throw Color Error","func":"throw(\"Invalid Pixel Effect. Value must be a number between 1 and 46.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":910,"y":420,"wires":[]},{"id":"f1dd549a.8bdb08","type":"join","z":"ca7050b9.e2978","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1310,"y":340,"wires":[[]]},{"id":"be42716.a8b289","type":"ha-get-entities","z":"ca7050b9.e2978","server":"497693ef.d5e6bc","name":"Get all LED Strips","rules":[{"property":"entity_id","logic":"in_group","value":"group.inovelli_led_strips","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":270,"y":240,"wires":[["8b27cdb4.77cff"]]},{"id":"42e84d13.84f1b4","type":"switch","z":"ca7050b9.e2978","name":"Check if Pixel Effect choice is valid","property":"pixel_effect","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"46","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":620,"y":360,"wires":[["513c6cf2.0e3934"],["97ca420d.05be5"]]},{"id":"8f4f377d.4b7e98","type":"switch","z":"ca7050b9.e2978","name":"Check if Pixel Effect choice is valid","property":"brightness","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"99","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":240,"y":360,"wires":[["42e84d13.84f1b4"],["3fd7e9a4.af9616"]]},{"id":"513c6cf2.0e3934","type":"function","z":"ca7050b9.e2978","name":"Calculate pixel effect","func":"var pixelEffect = parseInt(env.get(\"pixel_effect\"));\nvar brightness = parseInt(env.get(\"brightness\"));\n\nmsg.value = {};\nmsg.value = ((brightness * 256) + pixelEffect);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":920,"y":340,"wires":[["7ce415a1.df09bc"]]},{"id":"8b27cdb4.77cff","type":"split","z":"ca7050b9.e2978","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":450,"y":240,"wires":[["dd80f5f8.7a4868"]]},{"id":"dd80f5f8.7a4868","type":"delay","z":"ca7050b9.e2978","name":"","pauseType":"rate","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.25","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":610,"y":240,"wires":[["35c319cc.d8de56"]]},{"id":"35c319cc.d8de56","type":"change","z":"ca7050b9.e2978","name":"Set Node Id in Payload","rules":[{"t":"set","p":"payload.node_id","pt":"msg","to":"payload.attributes.node_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":240,"wires":[["8f4f377d.4b7e98"]]},{"id":"7ce415a1.df09bc","type":"api-call-service","z":"ca7050b9.e2978","name":"Set Pixel Effect","server":"497693ef.d5e6bc","version":1,"debugenabled":false,"service_domain":"ozw","service":"set_config_parameter","entityId":"","data":"{\t   \"node_id\":msg.payload.node_id,\t   \"parameter\":31,\t   \"value\":msg.value\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1140,"y":340,"wires":[["f1dd549a.8bdb08"]]},{"id":"341ba468.47fb4c","type":"comment","z":"ca7050b9.e2978","name":"Pull Pixel Effect, Brightness Values and Node Information","info":"","x":830,"y":60,"wires":[]},{"id":"497693ef.d5e6bc","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"5343703a.ffe37","type":"subflow:ca7050b9.e2978","z":"f1e1b905.e9a56","name":"","env":[{"name":"brightness","value":"99","type":"str"},{"name":"pixel_effect","value":"45","type":"str"}],"x":800,"y":320,"wires":[[]]}]

And some screenshots of the subflow itself:

The second subflow will work by manually adding in the node ID of your light strip. This would work better if you’re attempting to avoid groups and/or just have one light strip.

Set Pixel Effect of a Single Node:

[{"id":"9f38d792.8a5038","type":"subflow","name":"Set Pixel Effect of a Single Node","info":"","category":"","in":[{"x":120,"y":240,"wires":[{"id":"9d164d05.2a9a8"}]}],"out":[{"x":780,"y":440,"wires":[{"id":"5d6cad29.be2ad4","port":0}]}],"env":[{"name":"brightness","type":"num","value":""},{"name":"pixel_effect","type":"num","value":""},{"name":"node_id","type":"num","value":""}],"color":"#DDAA99","status":{"x":280,"y":160,"wires":[{"id":"c92a48fc.742ef8","port":0}]}},{"id":"280c685d.6858b8","type":"function","z":"9f38d792.8a5038","name":"Throw Value Error","func":"throw(\"Invalid Brightness Intensity. Value must be a number between 1 and 99.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":570,"y":300,"wires":[]},{"id":"c92a48fc.742ef8","type":"status","z":"9f38d792.8a5038","name":"","scope":null,"x":160,"y":160,"wires":[[]]},{"id":"4ffd875e.67b128","type":"function","z":"9f38d792.8a5038","name":"Throw Color Error","func":"throw(\"Invalid Pixel Effect. Value must be a number between 1 and 46.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":930,"y":300,"wires":[]},{"id":"2237c494.10057c","type":"switch","z":"9f38d792.8a5038","name":"Check if Pixel Effect choice is valid","property":"pixel_effect","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"46","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":680,"y":240,"wires":[["13445159.b7ca9f"],["4ffd875e.67b128"]]},{"id":"9d164d05.2a9a8","type":"switch","z":"9f38d792.8a5038","name":"Check if Pixel Effect choice is valid","property":"brightness","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"99","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":320,"y":240,"wires":[["2237c494.10057c"],["280c685d.6858b8"]]},{"id":"13445159.b7ca9f","type":"function","z":"9f38d792.8a5038","name":"Calculate pixel effect","func":"var pixelEffect = parseInt(env.get(\"pixel_effect\"));\nvar brightness = parseInt(env.get(\"brightness\"));\nvar nodeid = parseInt(env.get(\"node_id\"));\n\nmsg.value = {};\nmsg.value = ((brightness * 256) + pixelEffect);\n\nmsg.node = {};\nmsg.node = (nodeid);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":420,"y":440,"wires":[["5d6cad29.be2ad4"]]},{"id":"5d6cad29.be2ad4","type":"api-call-service","z":"9f38d792.8a5038","name":"Set Pixel Effect","server":"497693ef.d5e6bc","version":1,"debugenabled":false,"service_domain":"ozw","service":"set_config_parameter","entityId":"","data":"{\t   \"node_id\":msg.node,\t   \"parameter\":31,\t   \"value\":msg.value\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":640,"y":440,"wires":[[]]},{"id":"4b770613.d72eb8","type":"comment","z":"9f38d792.8a5038","name":"Pull Pixel Effect, Brightness Values and Node Information","info":"","x":610,"y":120,"wires":[]},{"id":"497693ef.d5e6bc","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"ab1a2c4b.d8fbb","type":"subflow:9f38d792.8a5038","z":"f1e1b905.e9a56","name":"","env":[{"name":"brightness","value":"99","type":"num"},{"name":"pixel_effect","value":"46","type":"num"},{"name":"node_id","value":"29","type":"num"}],"x":810,"y":260,"wires":[[]]}]

And some more screenshots:

I’m not the best at all with Javascript and as such the function may not be the prettiest or most optimized, but it works. For those of you interested, feel free to build upon this or optimize it however you’d like. It’s come in handy for me a few times setting different effects for different automations I have at home, so wanted to share it with others.

If you have any questions let me know.

1 Like

Works well, thanks.

Why no pixel effect 46 (Aurora)?

Anyway to add a duration to an effect? (i dont if its even possible to add duraiton to pixel effects)

Do you got any other flows related to the strip? Such as just setting simple colors? I cant figure out how to send parameter 9 (default color)

Aurora 46 works, although if you don’t want the entire strip to be the same color all at once, you want Rainbow Aurora 45. It’s probably more of what you would expect an Aurora Borealis effect to be.

Oops, miscounted and accidently left 46 out. Thanks for the heads up, I fixed the above subflows to allow up to 46 now :slight_smile:

From my understanding of the documentation there is no way to bake in a pixel effect duration as is, but I’m sure this is possible to do. I’ll see if I can figure out a more configurable option later on (no time at the moment but I have a few ideas already). In the mean time if you attach this node at the end of the subflow you’re using, it should turn the lightstrip off after your timer expires:

[{"id":"d647d167.8eda7","type":"api-call-service","z":"f1e1b905.e9a56","name":"Turn off Lightstrip","server":"497693ef.d5e6bc","version":1,"debugenabled":false,"service_domain":"ozw","service":"set_config_parameter","entityId":"","data":"{\t   \"node_id\":29,\t   \"parameter\":31,\t   \"value\":0\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1130,"y":180,"wires":[[]]},{"id":"fb82e332.a2ab3","type":"stoptimer","z":"f1e1b905.e9a56","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":910,"y":180,"wires":[["d647d167.8eda7"],[]]},{"id":"497693ef.d5e6bc","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

The only thing you need to do is edit the data field and replace 29 with your node ID.

And for your final question, not at the moment. This one was my first project with the lightstrip, but I was planning to see what else I could calculate. I can let you know whenever I figure anything else out. At the moment my other subflows all relate to only the Red series switches.

2 Likes

Just stumbled across this. Thanks!

1 Like

I’m trying to use with zwavejs2mqtt in nodered. I get the following error when I try to set the rainbow auroa. I set my domain to “zwave_js”. Is that correct?

5/5/2021, 10:06:32 PM[node: Set Pixel Effect]

msg : string[80]

"Call-service API error. Error Message: extra keys not allowed @ data['node_id']"

Gotcha thanks for the heads up! This guy’s a little outdated at this point, I’ll work on updating it tomorrow and let you know once it’s good to go.

Awesome! Fyi in the final function it uses msg.node_id. It says the user of msg is deprecated and to just use node_id. Same with value.

Alrighty, finished updating it. I also added in support to define a random pixel effect, as well as a configurable timeout. Since I can’t update my original post, I’ll update the directions here. This only works with zwavejs as is, but can be easily updated for OZW or Zwave 1.4.

This single subflow can now be used for either groups of light strips, or a single lightstrip only. Just set single_or_group accordingly.

If you’re only updating a single lightstrip, provide the entity ID of the device for the field device_id. If you’re running it for a group of lightstrips, provide the group name for device_id.

Set brightness to any number between 1 and 99.

Set pixel_effect to any number between 1 and 45 (apparently there’s no support for 46 in zwavejs). Or set the field to random for a randomly chosen effect. This can be left blank or set to forever if this is never to turn off your lightstrip.

set total_time to a number between ideally 1 and 99, though there are no checks in place for that. Then set measure_time to whatever measure of time you’re working off of, seconds, minutes, hours, or forever to never turn the lightstrip off.

Screenshot example:

This will set my lightstrip to the aurora effect at max brightness for 30 seconds.

Here’s the subflow:

Please let me know if there are any issues or anyone has any questions!

[{"id":"9f38d792.8a5038","type":"subflow","name":"Set Pixel Effect","info":"","category":"","in":[{"x":120,"y":240,"wires":[{"id":"a1d83d1d.12d09"}]}],"out":[{"x":1220,"y":700,"wires":[{"id":"da77dc7.f17462","port":0},{"id":"ee825fe8.364d7","port":0},{"id":"ee825fe8.364d7","port":1}]}],"env":[{"name":"single_or_group","type":"str","value":"single"},{"name":"device_id","type":"str","value":""},{"name":"brightness","type":"num","value":""},{"name":"pixel_effect","type":"str","value":""},{"name":"total_time","type":"str","value":"30"},{"name":"measure_time","type":"str","value":"seconds"}],"meta":{},"color":"#C7E9C0"},{"id":"280c685d.6858b8","type":"function","z":"9f38d792.8a5038","name":"Throw Value Error","func":"throw(\"Invalid Brightness Intensity. Value must be a number between 1 and 99.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":330,"y":600,"wires":[]},{"id":"4ffd875e.67b128","type":"function","z":"9f38d792.8a5038","name":"Throw Color Error","func":"throw(\"Invalid Pixel Effect. Value must be a number between 1 and 46.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":650,"y":600,"wires":[]},{"id":"2237c494.10057c","type":"switch","z":"9f38d792.8a5038","name":"Check if Pixel Effect choice is valid","property":"pixel_effect","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"45","v2t":"num"},{"t":"eq","v":"random","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":600,"y":540,"wires":[["13445159.b7ca9f"],["13445159.b7ca9f"],["4ffd875e.67b128"]]},{"id":"9d164d05.2a9a8","type":"switch","z":"9f38d792.8a5038","name":"Check if brightness is valid","property":"brightness","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"99","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":300,"y":540,"wires":[["2237c494.10057c"],["280c685d.6858b8"]]},{"id":"13445159.b7ca9f","type":"function","z":"9f38d792.8a5038","name":"Calculate pixel effect","func":"var pixelEffect = env.get(\"pixel_effect\");\nvar bright = parseInt(env.get(\"brightness\"));\nmsg.value = {};\n\nif (pixelEffect === 'random') {\n    msg.value = Math.floor(Math.random() * 45) + 1;\n    msg.bright = parseInt(bright);\n} else {\n    msg.value = parseInt(pixelEffect);\n    msg.bright = parseInt(bright);\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":540,"wires":[["3326de72.c17d12"]]},{"id":"4b770613.d72eb8","type":"comment","z":"9f38d792.8a5038","name":"Pull Pixel Effect, Brightness Values and Node Information","info":"","x":690,"y":100,"wires":[]},{"id":"813d369a.54f748","type":"ha-get-entities","z":"9f38d792.8a5038","server":"497693ef.d5e6bc","name":"Get all LED Strips","rules":[{"property":"entity_id","logic":"in_group","value":"group","valueType":"msg"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":810,"y":400,"wires":[["665443b8.102d7c"]]},{"id":"665443b8.102d7c","type":"split","z":"9f38d792.8a5038","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":990,"y":400,"wires":[["b9ef34bd.527538"]]},{"id":"b9ef34bd.527538","type":"delay","z":"9f38d792.8a5038","name":"","pauseType":"rate","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.25","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1150,"y":400,"wires":[["b10921b9.7f6a6"]]},{"id":"a1d83d1d.12d09","type":"change","z":"9f38d792.8a5038","name":"Set msg.singleorgroup","rules":[{"t":"set","p":"singleorgroup","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"singleorgroup","pt":"msg","to":"single_or_group","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":240,"wires":[["10123f23.1e4a41"]]},{"id":"aea70daa.c304f","type":"switch","z":"9f38d792.8a5038","name":"Is this a single node or group?","property":"singleorgroup","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"group","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":310,"y":380,"wires":[["f66a9193.bf6fc"],["5656b264.7cc5bc"],["2fa25c42.8b3464"]]},{"id":"2fa25c42.8b3464","type":"function","z":"9f38d792.8a5038","name":"Throw node error","func":"throw(\"Invalid selection for single or group. Valid entries include either single, or group. You provided: \" + msg.singleorgroup)\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":350,"y":440,"wires":[]},{"id":"10123f23.1e4a41","type":"function","z":"9f38d792.8a5038","name":"Correct value for singleorgroup if needed","func":"msg.singleorgroup = msg.singleorgroup.trim().replace(/\\ /g, \"_\").toLowerCase();\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":240,"wires":[["6f4b7998.7b1528"]]},{"id":"f66a9193.bf6fc","type":"change","z":"9f38d792.8a5038","name":"Set device ID","rules":[{"t":"set","p":"node","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"node","pt":"msg","to":"device_id","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":340,"wires":[["50eb1f81.3e079"]]},{"id":"50eb1f81.3e079","type":"switch","z":"9f38d792.8a5038","name":"Make sure there's a device defined","property":"node","propertyType":"msg","rules":[{"t":"istype","v":"string","vt":"string"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":840,"y":340,"wires":[["9d164d05.2a9a8"],["76a8ddca.a80a94"]]},{"id":"76a8ddca.a80a94","type":"function","z":"9f38d792.8a5038","name":"Throw device error","func":"throw(\"device_id cannot be 0 or blank if single_or_group is defined as single. Please either add in a device_id or change single_or_group to group and try again. Value provided was: \" + msg.node)\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":1170,"y":340,"wires":[]},{"id":"b10921b9.7f6a6","type":"change","z":"9f38d792.8a5038","name":"Set entity ID","rules":[{"t":"set","p":"node","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"node","pt":"msg","to":"payload.entity_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1330,"y":400,"wires":[["9d164d05.2a9a8"]]},{"id":"3326de72.c17d12","type":"api-call-service","z":"9f38d792.8a5038","name":"ZWaveJS Set Pixel Effect","server":"497693ef.d5e6bc","version":1,"debugenabled":false,"service_domain":"zwave_js","service":"bulk_set_partial_config_parameters","entityId":"","data":"{\t   \"entity_id\":msg.node,\t   \"parameter\":31,\t    \"value\": {\t        \"0xff\": msg.value,\t        \"0x7f00\": msg.brightness\t    }}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1130,"y":540,"wires":[["ee825fe8.364d7"]]},{"id":"33cf76bb.74ee2a","type":"delay","z":"9f38d792.8a5038","name":"Configurable Delay Node","pauseType":"delayv","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":830,"y":740,"wires":[["da77dc7.f17462"]]},{"id":"5656b264.7cc5bc","type":"change","z":"9f38d792.8a5038","name":"Set msg.group","rules":[{"t":"set","p":"group","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"group","pt":"msg","to":"device_id","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":400,"wires":[["813d369a.54f748"]]},{"id":"708e83bd.f9c7dc","type":"function","z":"9f38d792.8a5038","name":"Calculate light timeout amount","func":"var amount = parseInt(env.get(\"total_time\"));\n\nvar measure = msg.measuretime;\n\nmsg.delay = {};\n\nif (measure === 'seconds') {\n\n    msg.delay = parseInt(amount);\n\n} else if (measure === 'minutes') { //convert minutes to seconds\n\n    if (amount === 1) {\n        msg.delay = parseInt(amount * 60);\n    } else {\n        msg.delay = parseInt(amount + 60);\n    }\n\n} else if (measure === 'hours') { //convert hours to seconds\n\n    if (amount === 1) {\n        msg.delay = parseInt(amount * 120);\n    } else {\n        msg.delay = parseInt(amount + 120);\n    }\n\n}\n\nmsg.delay = parseInt(msg.delay * 1000); //convert seconds to ms\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":740,"wires":[["33cf76bb.74ee2a"]]},{"id":"6f4b7998.7b1528","type":"change","z":"9f38d792.8a5038","name":"Set msg.measuretime","rules":[{"t":"set","p":"measuretime","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"measuretime","pt":"msg","to":"measure_time","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":240,"wires":[["fc6b0793.8262b8"]]},{"id":"fc6b0793.8262b8","type":"function","z":"9f38d792.8a5038","name":"Correct value for measuretime if needed","func":"msg.measuretime = msg.measuretime.trim().replace(/\\ /g, \"_\").toLowerCase();\n\nvar measure = (msg.measuretime);\n\nif (measure === 'second'){\nmsg.measuretime = measure.replace(/second/g,'seconds');\n}\n\nelse if (measure === 'minute'){\nmsg.measuretime = measure.replace(/minute/g,'minutes');\n}\n\nelse if (measure === 'hour'){\nmsg.measuretime = measure.replace(/hour/g,'hours');\n}\n\nelse if (measure === 'infinite'){\nmsg.measuretime = measure.replace(/infinite/g,'forever');\n}\n\n//else {\n//return msg;\n//}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":240,"wires":[["aea70daa.c304f"]]},{"id":"da77dc7.f17462","type":"api-call-service","z":"9f38d792.8a5038","name":"Turn off LEDs","server":"497693ef.d5e6bc","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"","data":"{\t   \"entity_id\": msg.node\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1060,"y":740,"wires":[[]]},{"id":"ee825fe8.364d7","type":"switch","z":"9f38d792.8a5038","name":"Is a timeout defined?","property":"measuretime","propertyType":"msg","rules":[{"t":"eq","v":"forever","vt":"str"},{"t":"empty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":280,"y":700,"wires":[[],[],["708e83bd.f9c7dc"]]},{"id":"f94ca32c.71d2a","type":"function","z":"9f38d792.8a5038","name":"Calculate pixel effect","func":"var pixelEffect = env.get(\"pixel_effect\");\nvar brightness = parseInt(env.get(\"brightness\"));\nmsg.value = {};\n\nif (pixelEffect === 'random') {\n    var rand = Math.floor(Math.random() * 45) + 1;\n    msg.value = parseInt(((brightness * 256) + rand));\n} else {\n    msg.value = parseInt(((brightness * 256) + pixelEffect));\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":900,"wires":[[]]},{"id":"497693ef.d5e6bc","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"6e26bc11.f27b44","type":"subflow:9f38d792.8a5038","z":"f1e1b905.e9a56","name":"","env":[{"name":"device_id","value":"light.lzw45_light_strip_level_2","type":"str"},{"name":"brightness","value":"99","type":"str"},{"name":"pixel_effect","value":"45","type":"str"},{"name":"total_time","value":"5","type":"str"},{"name":"zwave","value":"zwavejs","type":"str"}],"x":1120,"y":300,"wires":[["99a362eb.6c00c"]]},{"id":"ce9cc4a2.2da688","type":"inject","z":"f1e1b905.e9a56","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":940,"y":300,"wires":[["6e26bc11.f27b44"]]},{"id":"99a362eb.6c00c","type":"debug","z":"f1e1b905.e9a56","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1290,"y":300,"wires":[]}]
1 Like

I used the same options as yours except I input my device name

Call-service API error. Error Message: Config parameter 31 failed validation on partial parameter 32512

I do have a pending config update that I cannot get to install. Maybe that is the problem? I’ve clicked “install” a dozen times, tried restarting the host, core, supervisor.
image
2021-05-06 20:45:08.416 INFO ZWAVE: Calling api installConfigUpdate with args: [ [length]: 0 ]
2021-05-06 20:45:08.992 INFO ZWAVE: Success zwave api call installConfigUpdate { success: true, message: ‘Success zwave api call’, result: false }

That’s so weird, after testing it all morning mine started returning the same error haha. I changed up how it was done, and this one appears to be working. Let me know if this one works for you as well, if not I’ll look back into it :slight_smile:

It could be related to that update issue, I’m having the same problem on my end. That notification is driving me crazy!

[{"id":"9f38d792.8a5038","type":"subflow","name":"Set Pixel Effect","info":"","category":"","in":[{"x":120,"y":240,"wires":[{"id":"a1d83d1d.12d09"}]}],"out":[{"x":1220,"y":700,"wires":[{"id":"da77dc7.f17462","port":0},{"id":"ee825fe8.364d7","port":0},{"id":"ee825fe8.364d7","port":1}]}],"env":[{"name":"single_or_group","type":"str","value":"single"},{"name":"device_id","type":"str","value":""},{"name":"brightness","type":"num","value":""},{"name":"pixel_effect","type":"str","value":""},{"name":"total_time","type":"str","value":"30"},{"name":"measure_time","type":"str","value":"seconds"}],"meta":{},"color":"#C7E9C0"},{"id":"280c685d.6858b8","type":"function","z":"9f38d792.8a5038","name":"Throw Value Error","func":"throw(\"Invalid Brightness Intensity. Value must be a number between 1 and 99.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":330,"y":600,"wires":[]},{"id":"4ffd875e.67b128","type":"function","z":"9f38d792.8a5038","name":"Throw Color Error","func":"throw(\"Invalid Pixel Effect. Value must be a number between 1 and 46.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":650,"y":600,"wires":[]},{"id":"2237c494.10057c","type":"switch","z":"9f38d792.8a5038","name":"Check if Pixel Effect choice is valid","property":"pixel_effect","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"45","v2t":"num"},{"t":"eq","v":"random","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":600,"y":540,"wires":[["13445159.b7ca9f"],["13445159.b7ca9f"],["4ffd875e.67b128"]]},{"id":"9d164d05.2a9a8","type":"switch","z":"9f38d792.8a5038","name":"Check if brightness is valid","property":"brightness","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"99","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":300,"y":540,"wires":[["2237c494.10057c"],["280c685d.6858b8"]]},{"id":"13445159.b7ca9f","type":"function","z":"9f38d792.8a5038","name":"Calculate pixel effect","func":"var pixelEffect = env.get(\"pixel_effect\");\nvar bright = parseInt(env.get(\"brightness\"));\nmsg.value = {};\n\nif (pixelEffect === 'random') {\n    msg.value = Math.floor(Math.random() * 45) + 1;\n    msg.bright = parseInt(bright);\n} else {\n    msg.value = parseInt(pixelEffect);\n    msg.bright = parseInt(bright);\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":540,"wires":[["3326de72.c17d12"]]},{"id":"4b770613.d72eb8","type":"comment","z":"9f38d792.8a5038","name":"Pull Pixel Effect, Brightness Values and Node Information","info":"","x":690,"y":100,"wires":[]},{"id":"813d369a.54f748","type":"ha-get-entities","z":"9f38d792.8a5038","server":"497693ef.d5e6bc","name":"Get all LED Strips","rules":[{"property":"entity_id","logic":"in_group","value":"group","valueType":"msg"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":810,"y":400,"wires":[["665443b8.102d7c"]]},{"id":"665443b8.102d7c","type":"split","z":"9f38d792.8a5038","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":990,"y":400,"wires":[["b9ef34bd.527538"]]},{"id":"b9ef34bd.527538","type":"delay","z":"9f38d792.8a5038","name":"","pauseType":"rate","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.25","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1150,"y":400,"wires":[["b10921b9.7f6a6"]]},{"id":"a1d83d1d.12d09","type":"change","z":"9f38d792.8a5038","name":"Set msg.singleorgroup","rules":[{"t":"set","p":"singleorgroup","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"singleorgroup","pt":"msg","to":"single_or_group","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":240,"wires":[["10123f23.1e4a41"]]},{"id":"aea70daa.c304f","type":"switch","z":"9f38d792.8a5038","name":"Is this a single node or group?","property":"singleorgroup","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"group","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":310,"y":380,"wires":[["f66a9193.bf6fc"],["5656b264.7cc5bc"],["2fa25c42.8b3464"]]},{"id":"2fa25c42.8b3464","type":"function","z":"9f38d792.8a5038","name":"Throw node error","func":"throw(\"Invalid selection for single or group. Valid entries include either single, or group. You provided: \" + msg.singleorgroup)\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":350,"y":440,"wires":[]},{"id":"10123f23.1e4a41","type":"function","z":"9f38d792.8a5038","name":"Correct value for singleorgroup if needed","func":"msg.singleorgroup = msg.singleorgroup.trim().replace(/\\ /g, \"_\").toLowerCase();\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":580,"y":240,"wires":[["6f4b7998.7b1528"]]},{"id":"f66a9193.bf6fc","type":"change","z":"9f38d792.8a5038","name":"Set device ID","rules":[{"t":"set","p":"node","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"node","pt":"msg","to":"device_id","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":340,"wires":[["50eb1f81.3e079"]]},{"id":"50eb1f81.3e079","type":"switch","z":"9f38d792.8a5038","name":"Make sure there's a device defined","property":"node","propertyType":"msg","rules":[{"t":"istype","v":"string","vt":"string"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":840,"y":340,"wires":[["9d164d05.2a9a8"],["76a8ddca.a80a94"]]},{"id":"76a8ddca.a80a94","type":"function","z":"9f38d792.8a5038","name":"Throw device error","func":"throw(\"device_id cannot be 0 or blank if single_or_group is defined as single. Please either add in a device_id or change single_or_group to group and try again. Value provided was: \" + msg.node)\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":1170,"y":340,"wires":[]},{"id":"b10921b9.7f6a6","type":"change","z":"9f38d792.8a5038","name":"Set entity ID","rules":[{"t":"set","p":"node","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"node","pt":"msg","to":"payload.entity_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1330,"y":400,"wires":[["9d164d05.2a9a8"]]},{"id":"3326de72.c17d12","type":"api-call-service","z":"9f38d792.8a5038","name":"ZWaveJS Set Pixel Effect","server":"497693ef.d5e6bc","version":1,"debugenabled":false,"service_domain":"zwave_js","service":"bulk_set_partial_config_parameters","entityId":"","data":"{\t   \"entity_id\":msg.node,\t   \"parameter\":31,\t    \"value\": {\t        \"0xff\": msg.value,\t        \"0x7f00\": msg.brightness\t    }}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1130,"y":540,"wires":[["ee825fe8.364d7"]]},{"id":"33cf76bb.74ee2a","type":"delay","z":"9f38d792.8a5038","name":"Configurable Delay Node","pauseType":"delayv","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":830,"y":740,"wires":[["da77dc7.f17462"]]},{"id":"5656b264.7cc5bc","type":"change","z":"9f38d792.8a5038","name":"Set msg.group","rules":[{"t":"set","p":"group","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"group","pt":"msg","to":"device_id","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":400,"wires":[["813d369a.54f748"]]},{"id":"708e83bd.f9c7dc","type":"function","z":"9f38d792.8a5038","name":"Calculate light timeout amount","func":"var amount = parseInt(env.get(\"total_time\"));\n\nvar measure = msg.measuretime;\n\nmsg.delay = {};\n\nif (measure === 'seconds') {\n\n    msg.delay = parseInt(amount);\n\n} else if (measure === 'minutes') { //convert minutes to seconds\n\n    if (amount === 1) {\n        msg.delay = parseInt(amount * 60);\n    } else {\n        msg.delay = parseInt(amount + 60);\n    }\n\n} else if (measure === 'hours') { //convert hours to seconds\n\n    if (amount === 1) {\n        msg.delay = parseInt(amount * 120);\n    } else {\n        msg.delay = parseInt(amount + 120);\n    }\n\n}\n\nmsg.delay = parseInt(msg.delay * 1000); //convert seconds to ms\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":740,"wires":[["33cf76bb.74ee2a"]]},{"id":"6f4b7998.7b1528","type":"change","z":"9f38d792.8a5038","name":"Set msg.measuretime","rules":[{"t":"set","p":"measuretime","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"measuretime","pt":"msg","to":"measure_time","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":240,"wires":[["fc6b0793.8262b8"]]},{"id":"fc6b0793.8262b8","type":"function","z":"9f38d792.8a5038","name":"Correct value for measuretime if needed","func":"msg.measuretime = msg.measuretime.trim().replace(/\\ /g, \"_\").toLowerCase();\n\nvar measure = (msg.measuretime);\n\nif (measure === 'second'){\nmsg.measuretime = measure.replace(/second/g,'seconds');\n}\n\nelse if (measure === 'minute'){\nmsg.measuretime = measure.replace(/minute/g,'minutes');\n}\n\nelse if (measure === 'hour'){\nmsg.measuretime = measure.replace(/hour/g,'hours');\n}\n\nelse if (measure === 'infinite'){\nmsg.measuretime = measure.replace(/infinite/g,'forever');\n}\n\n//else {\n//return msg;\n//}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":240,"wires":[["aea70daa.c304f"]]},{"id":"da77dc7.f17462","type":"api-call-service","z":"9f38d792.8a5038","name":"Turn off LEDs","server":"497693ef.d5e6bc","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"","data":"{\t   \"entity_id\": msg.node\t}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1060,"y":740,"wires":[[]]},{"id":"ee825fe8.364d7","type":"switch","z":"9f38d792.8a5038","name":"Is a timeout defined?","property":"measuretime","propertyType":"msg","rules":[{"t":"eq","v":"forever","vt":"str"},{"t":"empty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":280,"y":700,"wires":[[],[],["708e83bd.f9c7dc"]]},{"id":"f94ca32c.71d2a","type":"function","z":"9f38d792.8a5038","name":"Calculate pixel effect","func":"var pixelEffect = env.get(\"pixel_effect\");\nvar brightness = parseInt(env.get(\"brightness\"));\nmsg.value = {};\n\nif (pixelEffect === 'random') {\n    var rand = Math.floor(Math.random() * 45) + 1;\n    msg.value = parseInt(((brightness * 256) + rand));\n} else {\n    msg.value = parseInt(((brightness * 256) + pixelEffect));\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":840,"y":900,"wires":[[]]},{"id":"497693ef.d5e6bc","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"6e26bc11.f27b44","type":"subflow:9f38d792.8a5038","z":"f1e1b905.e9a56","name":"","env":[{"name":"device_id","value":"light.lzw45_light_strip_level_2","type":"str"},{"name":"brightness","value":"99","type":"str"},{"name":"pixel_effect","value":"45","type":"str"},{"name":"total_time","value":"5","type":"str"},{"name":"zwave","value":"zwavejs","type":"str"}],"x":1120,"y":300,"wires":[["99a362eb.6c00c"]]},{"id":"ce9cc4a2.2da688","type":"inject","z":"f1e1b905.e9a56","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":940,"y":300,"wires":[["6e26bc11.f27b44"]]},{"id":"99a362eb.6c00c","type":"debug","z":"f1e1b905.e9a56","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1290,"y":300,"wires":[]}]
1 Like

Success! Thanks for updating the flow.

1 Like

Seems this may have broke again? Effects don’t happen, but nixie display turns on to indicate light.turn_off has triggered.
I was able to copy the data from the node inside the subflow into the dev tools and get it to work, so I’m guessing something about the “ZWaveJS Set Pixel Effect” node has an error now. This works for me directly:

service: zwave_js.bulk_set_partial_config_parameters
target:
  entity_id: light.inovelli_lzw45_led_light_strip_level
data:
  parameter: '31'
  value:
    '0xff': '11'
    '0x7f00': '90'

Yes that part was an issue for sure! I did end up getting the same errors both you and stu1811 were having last night. That function was definitely a problem though, it was left over from when bulkset was first released and I forgot to update it once better methods came around. Finally updated the function node below, then changed the zwave service to use multicast instead of bulk set partial configs. Hopefully this one works for you!

[{"id":"9f38d792.8a5038","type":"subflow","name":"Set Pixel Effect","info":"","category":"","in":[{"x":120,"y":240,"wires":[{"id":"a1d83d1d.12d09"}]}],"out":[{"x":1220,"y":700,"wires":[{"id":"da77dc7.f17462","port":0},{"id":"ee825fe8.364d7","port":0},{"id":"ee825fe8.364d7","port":1}]}],"env":[{"name":"single_or_group","type":"str","value":"single"},{"name":"device_id","type":"str","value":""},{"name":"brightness","type":"num","value":""},{"name":"pixel_effect","type":"str","value":""},{"name":"total_time","type":"str","value":"30"},{"name":"measure_time","type":"str","value":"seconds"}],"meta":{},"color":"#C7E9C0"},{"id":"280c685d.6858b8","type":"function","z":"9f38d792.8a5038","name":"Throw Value Error","func":"throw(\"Invalid Brightness Intensity. Value must be a number between 1 and 99.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":330,"y":600,"wires":[]},{"id":"4ffd875e.67b128","type":"function","z":"9f38d792.8a5038","name":"Throw Color Error","func":"throw(\"Invalid Pixel Effect. Value must be a number between 1 and 46.\")\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":650,"y":600,"wires":[]},{"id":"2237c494.10057c","type":"switch","z":"9f38d792.8a5038","name":"Check if Pixel Effect choice is valid","property":"pixel_effect","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"45","v2t":"num"},{"t":"eq","v":"random","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":600,"y":540,"wires":[["13445159.b7ca9f"],["13445159.b7ca9f"],["4ffd875e.67b128"]]},{"id":"9d164d05.2a9a8","type":"switch","z":"9f38d792.8a5038","name":"Check if brightness is valid","property":"brightness","propertyType":"env","rules":[{"t":"btwn","v":"1","vt":"num","v2":"99","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":300,"y":540,"wires":[["2237c494.10057c"],["280c685d.6858b8"]]},{"id":"13445159.b7ca9f","type":"function","z":"9f38d792.8a5038","name":"Calculate pixel effect","func":"var pixelEffect = env.get(\"pixel_effect\");\nvar bright = parseInt(env.get(\"brightness\"));\nmsg.value = {};\nmsg.calculation = {};\n\nif (pixelEffect === 'random') {\n    msg.value = Math.floor(Math.random() * 45) + 1;\n    msg.bright = parseInt(bright);\n    msg.calculation = msg.value + (msg.bright * 256);\n} else {\n    msg.calculation = parseInt(pixelEffect) + (parseInt(bright) * 256);\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":880,"y":540,"wires":[["3326de72.c17d12"]]},{"id":"4b770613.d72eb8","type":"comment","z":"9f38d792.8a5038","name":"Pull Pixel Effect, Brightness Values and Node Information","info":"","x":750,"y":100,"wires":[]},{"id":"813d369a.54f748","type":"ha-get-entities","z":"9f38d792.8a5038","name":"Get all LED Strips","server":"497693ef.d5e6bc","version":0,"rules":[{"property":"entity_id","logic":"in_group","value":"group","valueType":"msg"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":810,"y":400,"wires":[["665443b8.102d7c"]]},{"id":"665443b8.102d7c","type":"split","z":"9f38d792.8a5038","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":990,"y":400,"wires":[["b9ef34bd.527538"]]},{"id":"b9ef34bd.527538","type":"delay","z":"9f38d792.8a5038","name":"","pauseType":"rate","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.25","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":1150,"y":400,"wires":[["b10921b9.7f6a6"]]},{"id":"a1d83d1d.12d09","type":"change","z":"9f38d792.8a5038","name":"Set msg.singleorgroup","rules":[{"t":"set","p":"singleorgroup","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"singleorgroup","pt":"msg","to":"single_or_group","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":240,"wires":[["10123f23.1e4a41"]]},{"id":"aea70daa.c304f","type":"switch","z":"9f38d792.8a5038","name":"Is this a single node or group?","property":"singleorgroup","propertyType":"msg","rules":[{"t":"eq","v":"single","vt":"str"},{"t":"eq","v":"group","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":310,"y":380,"wires":[["f66a9193.bf6fc"],["5656b264.7cc5bc"],["2fa25c42.8b3464"]]},{"id":"2fa25c42.8b3464","type":"function","z":"9f38d792.8a5038","name":"Throw node error","func":"throw(\"Invalid selection for single or group. Valid entries include either single, or group. You provided: \" + msg.singleorgroup)\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":350,"y":440,"wires":[]},{"id":"10123f23.1e4a41","type":"function","z":"9f38d792.8a5038","name":"Correct value for singleorgroup if needed","func":"msg.singleorgroup = msg.singleorgroup.trim().replace(/\\ /g, \"_\").toLowerCase();\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":580,"y":240,"wires":[["6f4b7998.7b1528"]]},{"id":"f66a9193.bf6fc","type":"change","z":"9f38d792.8a5038","name":"Set device ID","rules":[{"t":"set","p":"node","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"node","pt":"msg","to":"device_id","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":340,"wires":[["50eb1f81.3e079"]]},{"id":"50eb1f81.3e079","type":"switch","z":"9f38d792.8a5038","name":"Make sure there's a device defined","property":"node","propertyType":"msg","rules":[{"t":"istype","v":"string","vt":"string"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":840,"y":340,"wires":[["9d164d05.2a9a8"],["76a8ddca.a80a94"]]},{"id":"76a8ddca.a80a94","type":"function","z":"9f38d792.8a5038","name":"Throw device error","func":"throw(\"device_id cannot be 0 or blank if single_or_group is defined as single. Please either add in a device_id or change single_or_group to group and try again. Value provided was: \" + msg.node)\nreturn msg;","outputs":0,"noerr":0,"initialize":"","finalize":"","x":1170,"y":340,"wires":[]},{"id":"b10921b9.7f6a6","type":"change","z":"9f38d792.8a5038","name":"Set entity ID","rules":[{"t":"set","p":"node","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"node","pt":"msg","to":"payload.entity_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1330,"y":400,"wires":[["9d164d05.2a9a8"]]},{"id":"3326de72.c17d12","type":"api-call-service","z":"9f38d792.8a5038","name":"ZWaveJS Set Pixel Effect","server":"497693ef.d5e6bc","version":3,"debugenabled":false,"service_domain":"zwave_js","service":"multicast_set_value","entityId":"","data":"{    \t    \"entity_id\": msg.node,\t    \"command_class\": 112,\t    \"endpoint\": 0,\t    \"property\": 31,    \t    \"value\": msg.calculation\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1130,"y":540,"wires":[["ee825fe8.364d7"]]},{"id":"33cf76bb.74ee2a","type":"delay","z":"9f38d792.8a5038","name":"Configurable Delay Node","pauseType":"delayv","timeout":"30","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"outputs":1,"x":830,"y":740,"wires":[["da77dc7.f17462"]]},{"id":"5656b264.7cc5bc","type":"change","z":"9f38d792.8a5038","name":"Set msg.group","rules":[{"t":"set","p":"group","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"group","pt":"msg","to":"device_id","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":400,"wires":[["813d369a.54f748"]]},{"id":"708e83bd.f9c7dc","type":"function","z":"9f38d792.8a5038","name":"Calculate light timeout amount","func":"var amount = parseInt(env.get(\"total_time\"));\n\nvar measure = msg.measuretime;\n\nmsg.delay = {};\n\nif (measure === 'seconds') {\n\n    msg.delay = parseInt(amount);\n\n} else if (measure === 'minutes') { //convert minutes to seconds\n\n    if (amount === 1) {\n        msg.delay = parseInt(amount * 60);\n    } else {\n        msg.delay = parseInt(amount + 60);\n    }\n\n} else if (measure === 'hours') { //convert hours to seconds\n\n    if (amount === 1) {\n        msg.delay = parseInt(amount * 120);\n    } else {\n        msg.delay = parseInt(amount + 120);\n    }\n\n}\n\nmsg.delay = parseInt(msg.delay * 1000); //convert seconds to ms\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":740,"wires":[["33cf76bb.74ee2a"]]},{"id":"6f4b7998.7b1528","type":"change","z":"9f38d792.8a5038","name":"Set msg.measuretime","rules":[{"t":"set","p":"measuretime","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"measuretime","pt":"msg","to":"measure_time","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":240,"wires":[["fc6b0793.8262b8"]]},{"id":"fc6b0793.8262b8","type":"function","z":"9f38d792.8a5038","name":"Correct value for measuretime if needed","func":"msg.measuretime = msg.measuretime.trim().replace(/\\ /g, \"_\").toLowerCase();\n\nvar measure = (msg.measuretime);\n\nif (measure === 'second'){\nmsg.measuretime = measure.replace(/second/g,'seconds');\n}\n\nelse if (measure === 'minute'){\nmsg.measuretime = measure.replace(/minute/g,'minutes');\n}\n\nelse if (measure === 'hour'){\nmsg.measuretime = measure.replace(/hour/g,'hours');\n}\n\nelse if (measure === 'infinite'){\nmsg.measuretime = measure.replace(/infinite/g,'forever');\n}\n\n//else {\n//return msg;\n//}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1180,"y":240,"wires":[["aea70daa.c304f"]]},{"id":"da77dc7.f17462","type":"api-call-service","z":"9f38d792.8a5038","name":"Turn off LEDs","server":"497693ef.d5e6bc","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"","data":"{\t   \"entity_id\": msg.node\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1060,"y":740,"wires":[[]]},{"id":"ee825fe8.364d7","type":"switch","z":"9f38d792.8a5038","name":"Is a timeout defined?","property":"measuretime","propertyType":"msg","rules":[{"t":"eq","v":"forever","vt":"str"},{"t":"empty"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":280,"y":700,"wires":[[],[],["708e83bd.f9c7dc"]]},{"id":"497693ef.d5e6bc","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30},{"id":"f7437c51c81b5456","type":"subflow:9f38d792.8a5038","z":"d6d19e53.ff92c","name":"","env":[],"x":800,"y":1180,"wires":[[]]},{"id":"8b81956b29620cf5","type":"inject","z":"d6d19e53.ff92c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":620,"y":1180,"wires":[["f7437c51c81b5456"]]}]