[SOLVED] Getting change node to match text EXACTLY?

I am trying to use a change node to take a light strip effect and translate it to a number that the strip understands.

So the effect “Rainbow” should send a 10 along the flow.
The effect “Rainbow_aurora” should send a 45.

Issue is when I choose “rainbow_aurora”, it translates that to 10_aurora.

Is there anyway to get the change node to match the entire phrase? (Other than changing it to 1 word, RainbowAurora)

[{"id":"7f36d3a2.d1a03c","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"2eb30c2f.a21954","type":"function","z":"7f36d3a2.d1a03c","name":"Calculate pixel effect","func":"var pixelEffect = msg.payload;\nvar brightness = msg.brightness;\n\n\nmsg.value = {};\nmsg.value = ((brightness * 256) + pixelEffect);\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":838,"y":234,"wires":[["a3a9d9b3.fa9b88","c92d757.9b09388"]]},{"id":"54d5ca0b.4ba4c4","type":"api-current-state","z":"7f36d3a2.d1a03c","name":"Check brightness setting","server":"ab3e2c53.e3491","version":1,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","override_topic":false,"entity_id":"input_number.light_strip_effect_brightness","state_type":"num","state_location":"brightness","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":605,"y":234,"wires":[["2eb30c2f.a21954"]]},{"id":"a3a9d9b3.fa9b88","type":"api-call-service","z":"7f36d3a2.d1a03c","name":"Set Pixel Effect","server":"497693ef.d5e6bc","version":1,"debugenabled":false,"service_domain":"ozw","service":"set_config_parameter","entityId":"","data":"{\t   \"node_id\":57,\t   \"parameter\":31,\t   \"value\":{{value}}\t}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1043,"y":207,"wires":[[]]},{"id":"78d6c71f.dc8798","type":"server-state-changed","z":"7f36d3a2.d1a03c","name":"Light strip effect changed","server":"ab3e2c53.e3491","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_select.light_strip_effect","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":164,"y":234,"wires":[["4445a53f.3166bc","dfd61061.a0e7f"]]},{"id":"4445a53f.3166bc","type":"change","z":"7f36d3a2.d1a03c","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"Static","fromt":"str","to":"1","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Blink","fromt":"str","to":"2","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Breath","fromt":"str","to":"3","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Color_wipe","fromt":"str","to":"4","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Color_wipe_reverse_inverse","fromt":"str","to":"5","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Color_wipe_random","fromt":"str","to":"6","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Random_color","fromt":"str","to":"7","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Single_dynamic","fromt":"str","to":"8","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Multi_dynamic","fromt":"str","to":"9","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Rainbow","fromt":"str","to":"10","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"Rainbow_cycle","fromt":"str","to":"11","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Scan","fromt":"str","to":"12","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Dual_scan","fromt":"str","to":"13","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Fade","fromt":"str","to":"14","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Running_lights","fromt":"str","to":"15","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Twinkle","fromt":"str","to":"16","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Twinkle_random","fromt":"str","to":"17","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Twinkle_fade","fromt":"str","to":"18","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Twinkle_fade_random","fromt":"str","to":"19","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Sparkle","fromt":"str","to":"20","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Flash_sparkle","fromt":"str","to":"21","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Hyper_sparkle","fromt":"str","to":"22","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Strobe","fromt":"str","to":"23","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Blink_rainbow","fromt":"str","to":"24","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Chase_white","fromt":"str","to":"25","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Chase_color","fromt":"str","to":"26","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Chase_random","fromt":"str","to":"27","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Chase_rainbow","fromt":"str","to":"28","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Chase_flash","fromt":"str","to":"29","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Chase_flash_random","fromt":"str","to":"30","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Chase_rainbow_white","fromt":"str","to":"31","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Chase_blackout","fromt":"str","to":"32","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Chase_blackout_rainbow","fromt":"str","to":"33","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Color_sweep_random","fromt":"str","to":"34","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Running_color","fromt":"str","to":"35","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Running_red_blue","fromt":"str","to":"36","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Running_random","fromt":"str","to":"37","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Larson_scanner","fromt":"str","to":"38","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Comet","fromt":"str","to":"39","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Fireworks","fromt":"str","to":"40","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Fireworks_random","fromt":"str","to":"41","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Merry_christmas","fromt":"str","to":"42","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Circus_combustus","fromt":"str","to":"43","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"Halloween","fromt":"str","to":"44","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"Rainbow_aurora","fromt":"str","to":"45","tot":"num"},{"t":"change","p":"payload","pt":"msg","from":"Aurora","fromt":"str","to":"46","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":377,"y":234,"wires":[["54d5ca0b.4ba4c4","dfd61061.a0e7f"]]},{"id":"c92d757.9b09388","type":"api-call-service","z":"7f36d3a2.d1a03c","name":"Set Pixel Effect","server":"497693ef.d5e6bc","version":1,"debugenabled":false,"service_domain":"ozw","service":"set_config_parameter","entityId":"","data":"{\t   \"node_id\":58,\t   \"parameter\":31,\t   \"value\":{{value}}\t}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1043,"y":270,"wires":[[]]},{"id":"dfd61061.a0e7f","type":"debug","z":"7f36d3a2.d1a03c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":592,"y":108,"wires":[]},{"id":"ab3e2c53.e3491","type":"server","name":"AvilaSmartHomeRpi","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"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}]

image

[{"id":"22a23b98.3b93b4","type":"inject","z":"70481014.55bbc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test","payloadType":"str","x":160,"y":832,"wires":[["5d1ad015.3641"]]},{"id":"75f16de0.37d9d4","type":"debug","z":"70481014.55bbc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":518,"y":832,"wires":[]},{"id":"5d1ad015.3641","type":"change","z":"70481014.55bbc","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"^test$","fromt":"re","to":"1","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"^test_abc$","fromt":"re","to":"2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":336,"y":832,"wires":[["75f16de0.37d9d4"]]},{"id":"89d952ad.21e48","type":"inject","z":"70481014.55bbc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test_abc","payloadType":"str","x":172,"y":880,"wires":[["5d1ad015.3641"]]},{"id":"ab815e90.66012","type":"function","z":"70481014.55bbc","name":"","func":"const list = {\n    test: 1,\n    test_abc: 2,\n    next: 3,\n}\n\nmsg.payload = list[msg.payload];\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":316,"y":928,"wires":[["10b51489.6b487b"]]},{"id":"10b51489.6b487b","type":"debug","z":"70481014.55bbc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":502,"y":928,"wires":[]},{"id":"210ec39e.436dfc","type":"inject","z":"70481014.55bbc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test","payloadType":"str","x":162,"y":928,"wires":[["ab815e90.66012"]]},{"id":"a902e731.c94ef8","type":"inject","z":"70481014.55bbc","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test_abc","payloadType":"str","x":174,"y":976,"wires":[["ab815e90.66012"]]}]
1 Like

Kermit, you help me so much with my node red problems. Thank you!!!