How to put FA codes into a msg.topic from a function

Guys,

Hopefully i am asking this question the right way

I have a flow that i want to put a display on a dashboard of the running status of a pump i.e. running or stopped

I have found the codes to do it and have placed them into inject nodes and then pushed them to a Dashboard Text node and all works fine for the initial testing - as per below

[{"id":"89d5b067.7701c","type":"inject","z":"6865126d.1bde1c","name":"","topic":"press","payload":"<i class=\"fa fa-refresh fa-spin fa-3x fa-fw\"></i>","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":1010,"y":480,"wires":[["abf71e7c.4fb0c"]]},{"id":"abf71e7c.4fb0c","type":"ui_text","z":"6865126d.1bde1c","group":"c4fb7801.2972a8","order":1,"width":"1","height":"1","name":"Water Tank Pump Running Status","label":"","format":"{{msg.payload}}","layout":"row-center","x":1240,"y":480,"wires":[]},{"id":"90919ebb.9e648","type":"inject","z":"6865126d.1bde1c","name":"","topic":"","payload":"<i class=\"fa fa-stop-circle-o fa-3x\" aria-hidden=\"true\"</i>","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":990,"y":540,"wires":[["abf71e7c.4fb0c"]]},{"id":"c4fb7801.2972a8","type":"ui_group","z":"","name":"Status Messages","tab":"7ded32a1.cf8ccc","order":2,"disp":true,"width":"10","collapse":false},{"id":"7ded32a1.cf8ccc","type":"ui_tab","z":"","name":"Water Tank","icon":"","order":2}]

Now that i have tested it and "semi" know what i am doing, i would like to put the inject code into a function

In this function i am essentially testing the incoming message payload and if it is equal to a certain value (on or off) i want to display the appropriate running or stopped icon on the dashboard

This is where i am stuck - i think i have to escape the characters somehow but not sure on that

Payload 3 is the one i am trying to load up - will obviously put some tests in there and set the value as appropriate once i understand the basic concept - is there a way to do this ?

Here is the function node

if (msg.payload === "1") {
    var p = "On";
    } 
else if (msg.payload === "0") { 
    var p = "Off";
    }
else var p = "Unknown";

var d = flow.get("MyDateTime") || "0";
//var myCount = flow.get("count", storeName);

//create message to write to the log file
var payload1 = (d + " Tank Pump is " + p + " Topic is: " + msg.topic);
//Store message so it can be output on output 1
var msg1 = { payload:payload1 };

//Create 2nd message for screen writing on scrolling table
var payload2 = (d + " Tank Pump is " + p);
//Store message so it can be output on output 2
var msg2 = { payload:payload2 };

//var payload3 = "<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i>";

//var msg3 = { payload:"<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i>" };

//End Function and return two messages on two outputs
return [msg1, msg2, msg3,];

regards

Craig

Sorry Guys - solved it - realised i had messed up some of the quotes etc

Been at it for hours !

Craig