title: How can I inject a boolean of value true into a payload in Node-RED
body: <p>I have 3 sensors set up, I add a timestamp to each of these sensors and then I want to inject a boolean value into their payload.</p>
  
  <p>I have successfully injected the boolean into the payload of my <code>sensordata</code>, but I cannot get the boolean to be <code>true</code> as it should be whenever the inject node is activated.</p>
  
  <p>My code is below:</p>
  
  <pre><code>[{"id":"bca1865d.435e78","type":"websocket-listener","z":"","path":"/ws/iot","wholemsg":"false"},{"id":"981eb056.67e15","type":"ibmiot in","z":"c645a0e3.39ba6","authentication":"quickstart","apiKey":"","inputType":"evt","deviceId":"e197b6bd8a80","applicationId":"","deviceType":"+","eventType":"+","commandType":"","format":"json","name":"Sensor #1","service":"quickstart","allDevices":false,"allApplications":false,"allDeviceTypes":true,"allEvents":true,"allCommands":false,"allFormats":false,"x":220,"y":120,"wires":[["e4c932e3.1b36d","58a6047e.a759fc"]]},{"id":"e4c932e3.1b36d","type":"debug","z":"c645a0e3.39ba6","name":"Sensor data","active":false,"console":"false","complete":"true","x":482.5,"y":83,"wires":[]},{"id":"13ce88e9.ec3177","type":"websocket out","z":"c645a0e3.39ba6","name":"WebSocket","server":"bca1865d.435e78","client":"","x":903,"y":174,"wires":[]},{"id":"d0db918a.2f247","type":"cloudant out","z":"c645a0e3.39ba6","service":"gwens-iottrial2-cloudantNoSQLDB","cloudant":"","name":"","database":"iotsensortdata","payonly":true,"operation":"insert","x":912.5,"y":126,"wires":[]},{"id":"6979b2fb.96864c","type":"debug","z":"c645a0e3.39ba6","name":"Sensor JSON","active":false,"console":"false","complete":"true","x":913,"y":230,"wires":[]},{"id":"58a6047e.a759fc","type":"function","z":"c645a0e3.39ba6","name":"Add timestamp","func":"msg.topic = \"Sensor Data\";\nmsg.payload.time = Date.now();\nreturn msg;","outputs":1,"noerr":0,"x":483,"y":174,"wires":[["d24cfce6.fed3a"]]},{"id":"4c4be7e7.b3b418","type":"ibmiot in","z":"c645a0e3.39ba6","authentication":"quickstart","apiKey":"","inputType":"evt","deviceId":"64833708ebbf","applicationId":"","deviceType":"+","eventType":"+","commandType":"","format":"json","name":"Sensor #2","service":"quickstart","allDevices":false,"allApplications":false,"allDeviceTypes":true,"allEvents":true,"allCommands":false,"allFormats":false,"x":220,"y":174,"wires":[["58a6047e.a759fc"]]},{"id":"e5570623.1aa8f8","type":"ibmiot in","z":"c645a0e3.39ba6","authentication":"quickstart","apiKey":"","inputType":"evt","deviceId":"00933ded85c4","applicationId":"","deviceType":"+","eventType":"+","commandType":"","format":"json","name":"Sensor #3","service":"quickstart","allDevices":false,"allApplications":false,"allDeviceTypes":true,"allEvents":true,"allCommands":false,"allFormats":false,"x":221,"y":227,"wires":[["58a6047e.a759fc"]]},{"id":"fd41e3f7.d77f48","type":"inject","z":"c645a0e3.39ba6","name":"Occupancy","topic":"OccupancyBool","payload":"true","payloadType":"bool","repeat":"1","crontab":"","once":true,"x":485,"y":126.5,"wires":[["d24cfce6.fed3a"]]},{"id":"d24cfce6.fed3a","type":"function","z":"c645a0e3.39ba6","name":"Occupancy Injection","func":"var Occupancy = false;\n\nconsole.log(\"hi \" + msg);\n\nif(msg.topic == \"OccupancyBool\") {\n    if(msg.payload === true) {\n        Occupancy = true;\n    }\n}\n\nelse if(msg.topic == \"Sensor Data\") {\n    msg.payload.occupancy = Occupancy;\n    return msg;\n}\n/*\nswitch(msg.topic) {\n    case \"OccupancyBool\":\n        if(msg.payload === true) {\n            Occupancy = msg.payload;\n        }\n        console.log(\"occupancy bool\");\n        break;\n    case \"Sensor Data\":\n        msg.payload.occupancy = Occupancy;\n        console.log(\"sensor data\");\n        return msg;\n        break;\n    default:\n        console.log(\"default\");\n        break;\n}*/","outputs":1,"noerr":0,"x":691.5,"y":174.5,"wires":[["d0db918a.2f247","13ce88e9.ec3177","6979b2fb.96864c","76b1bbbe.8f57fc"]]},{"id":"76b1bbbe.8f57fc","type":"debug","z":"c645a0e3.39ba6","name":"","active":true,"console":"false","complete":"payload","x":844,"y":68,"wires":[]}]
  </code></pre>
  
  <p>How can I inject a boolean value of true into the payload of my sensor data?</p>