Help with how to parse this message

Ok, just for the sake of it:

The whole flow:

[{"id":"7264fb4e.c6e44c","type":"ui_template","z":"a1911aa3.c45be8","group":"ef4cdff9.3f4b4","name":"","order":2,"width":0,"height":0,"format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1120,"y":2140,"wires":[[]]},{"id":"cd36d859.72e13","type":"debug","z":"a1911aa3.c45be8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1110,"y":2240,"wires":[]},{"id":"d4b19fd2.f4c96","type":"switch","z":"a1911aa3.c45be8","name":"","property":"device","propertyType":"msg","rules":[{"t":"cont","v":"Marvin","vt":"str"},{"t":"cont","v":"S5","vt":"str"},{"t":"cont","v":"TABBYCAT","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":900,"y":2180,"wires":[[],[],["cd36d859.72e13","7264fb4e.c6e44c"]]},{"id":"497b5cc9.9dd91c","type":"function","z":"a1911aa3.c45be8","name":"","func":"msg.device = \"TABBYCAT\";\n\n//var x = msg.payload.split(\",\");\n//node.warn(\"X \"+x)\n\n//var y = x[2];\n//node.warn(y);\n\nvar dev = msg.device;\n\n//var spl = msg.payload.split(\",\");\n//var rgbPart = spl[0];   //get the   rgb   part  (element 0)\n//var idPart = spl[1];    //get the   id    part  (element 1)\n//var rgb = spl.slice(2); //get  remaining  parts (elements 2 ~ the end)\n//var rgbStr = rgb.join(\",\"); // join these last three parts by comma back to a string\n\nmsg = {\n\n    \"payload\":\"<i class='fa fa-bullseye fa-2x' ng-style=\\\"{color:'rgb(200,0,0)'}\\\"></i>\",\n\n\n//    \"payload\":\"<i class='fa fa-bullseye fa-2x' ng-style=\"{color:'rgb(200,0,0)'}\"></i>\"\n\n//    \"payload\":\"<font color='rgb(200,0,0)'><i class='fa fa-bullseye fa-2x'></i></font>\",\n    \"device\": dev\n}\nreturn msg;\n\n//set the payload as required - example...\n//msg.payload = {\n//  id: idPart,\n//  rgb: rgb,\n//  rgbStr: rgbStr\n//}\n//return msg;\n\n\n\n\n\n//node.warn(msg.colour)\n\n//return msg;","outputs":1,"noerr":0,"x":720,"y":2220,"wires":[["d4b19fd2.f4c96"]]},{"id":"180f4891.538f47","type":"inject","z":"a1911aa3.c45be8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":570,"y":2220,"wires":[["497b5cc9.9dd91c"]]},{"id":"ef4cdff9.3f4b4","type":"ui_group","z":"","name":"Mobile devices","tab":"325a9fd4.22bde8","order":4,"disp":true,"width":"6","collapse":false},{"id":"325a9fd4.22bde8","type":"ui_tab","z":"","name":"Big device status","icon":"mi-drag_indicator","order":2,"disabled":false,"hidden":false}]

The output of the debug node:

{"payload":"<i class='fa fa-bullseye fa-2x' ng-style=\"{color:'rgb(200,0,0)'}\"></i>","device":"TABBYCAT","_msgid":"c4103fbe.d386"}

The screen:

Screenshot from 2020-08-21 23-31-53

And I have the setting:
angular theme in ui-template set.
Just so it is declared.

(sorry)
But look at what is being sent to it. rgb.....
ng-style=\"{color:'rgb(200,0,0)'}

It is 23:44 local time.

I have been up since 07:15.

Bed is calling.
Bye and thanks for the help so far.
It isn't I am running away from the problem. I am just tired.

Change the function node to:

msg.device = "TABBYCAT";
color = "200,0,0"
msg.template ="<i class='fa fa-bullseye fa-2x' style='color:rgb("+color+")'></i>"
return msg;

In post 29 you said

The 'that' in question being the changed line with the quotes fixed, so you were saying that with the modified line you still got the error, which you now say was not correct.

That is the error the node had. Not what it was sending as a message.

I have shown the screen shot of the error.

(If you are still reading)

Got a night's sleep. Got up and thought about it.

The code was dumped as not being viable and I found another way to get it done.

Sometimes you have to walk away from something you don't understand and accept not understanding it or knowing a solution.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.