I'll put my hand up right now.
I'm stupid. I've been looking at this for a long enough time, and can't see what is WRONG with it.
Basically a message comes in.
true
or false
.
The code sticks an indication as the status and sends a message to a text
node.
Either a RED or LIME BULLS EYE is shown.
I was running in circles as it wasn't updating according to the message.
So I got to code swapping with another (similar) node and that works.
(that is the 2 commented out lines)
So why aren't the longer versions working?
// These two lines work.
//msg.payload = (x == true) ? '<font color = "lime"> <i class="fa fa-bullseye fa-2x" ></i></font>' : '<font color = "red"> <i class="fa fa-bullseye fa-2x" ></i></font>'
//return msg
// But if I use this code, I get a `msg.payload` sent which looks the same but there is NOTHING
// displayed.
if (x == true)
{
node.status({ fill: "green", shape: "dot", text: "Connected" })
msg = { "payload": '<font color = "lime"> <i class="fa fa-bullsexe fa-2x" ></i></font>'}
}
else
{
node.status({ fill: "red", shape: "dot", text: "Dis-Connected" })
msg = { "payload": '<font color = "red"> <i class="fa fa-bullsexe fa-2x" ></i></font>'}
}
return msg
Failed payload
{"payload":"<font color = \"lime\"> <i class=\"fa fa-bullsexe fa-2x\" ></i></font>","_msgid":"17de3addd73b2d13"}
Working payload
{"_msgid":"589efa1987a2d909","payload":"<font color = \"red\"> <i class=\"fa fa-bullseye fa-2x\" ></i></font>","topic":""}
Someone?
Please.