This is a common need and can be achieved in a change node or a function node or multiple nodes switch and change node combination.
here is a change node example using JSONata expression.
And using a switch node.
[{"id":"12cf7965.5ab35f","type":"inject","z":"c74669a0.6a34f8","name":"","props":[{"p":"payload.MotionDetected","v":"0","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110.33332824707031,"y":4766.33349609375,"wires":[["6264d36.70275ac"]]},{"id":"6264d36.70275ac","type":"switch","z":"c74669a0.6a34f8","name":"","property":"payload.MotionDetected","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"false","repair":false,"outputs":2,"x":260,"y":4740,"wires":[["70c210d.dba867"],["6294e50b.cd001c"]]},{"id":"70c210d.dba867","type":"change","z":"c74669a0.6a34f8","name":"","rules":[{"t":"set","p":"payload.On","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":4720,"wires":[["df2cf978.75a28"]]},{"id":"6294e50b.cd001c","type":"change","z":"c74669a0.6a34f8","name":"","rules":[{"t":"set","p":"payload.On","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":4760,"wires":[["df2cf978.75a28"]]},{"id":"df2cf978.75a28","type":"debug","z":"c74669a0.6a34f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":580,"y":4840,"wires":[]},{"id":"dc48ccf2.11107","type":"change","z":"c74669a0.6a34f8","name":"","rules":[{"t":"set","p":"payload.On","pt":"msg","to":"payload.MotionDetected = 0 ? true : false","tot":"jsonata"},{"t":"delete","p":"payload.MotionDetected","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":4840,"wires":[["df2cf978.75a28"]]},{"id":"73b548ec.6ff45","type":"inject","z":"c74669a0.6a34f8","name":"","props":[{"p":"payload.MotionDetected","v":"0","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":4840,"wires":[["dc48ccf2.11107"]]}]
similar can be done in a function node