Here is a simple flow
[{"id":"b1d2e08.d89182","type":"inject","z":"5db76bc2.b15b94","name":"","topic":"","payload":"20","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":500,"wires":[["d37f18fe.13dc18"]]},{"id":"d37f18fe.13dc18","type":"function","z":"5db76bc2.b15b94","name":"","func":"var newMsg = {};\nif (typeof msg.payload === 'boolean') {\n newMsg.payload = true\n} else if (typeof msg.payload === 'number') {\n newMsg.payload = false\n}\nreturn newMsg;","outputs":1,"noerr":0,"x":426.0173645019531,"y":511.0104064941406,"wires":[["57bf5a9f.0435e4"]]},{"id":"57bf5a9f.0435e4","type":"debug","z":"5db76bc2.b15b94","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":590,"y":500,"wires":[]},{"id":"a69fe205.87415","type":"inject","z":"5db76bc2.b15b94","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":560,"wires":[["d37f18fe.13dc18"]]}]