Replace "==" with "===". FWIW, here's a function that works for me:
if (msg.payload.currentValue === "active") {
msg.payload = "stop"
} else {
msg.payload = "false"
}
var newmsg = { topic:msg.topic, payload:msg.payload }
return newmsg;
AFAICT, that's the only difference between our functions ..... (I also don't use two outputs, but that's not relevant).
Edit:
Here's a sequence with a function indicating how a single output can be used ...
Test Sequence
[{"id":"8bf2f6aa.42c95","type":"hubitat device","z":"6a24e889.3323f8","name":"Virtual Motion Sensor","server":"a22e0ea9.276dc8","deviceId":"1314","attribute":"","sendEvent":true,"x":230,"y":440,"wires":[["75d025fd.65af9c"]]},{"id":"75d025fd.65af9c","type":"function","z":"6a24e889.3323f8","name":"Test Function","func":"if (msg.payload.currentValue === \"active\") {\n msg.payload = \"stop\"\n} else {\n msg.payload = \"false\"\n}\nvar newmsg = { topic:msg.topic, payload:msg.payload }\nreturn newmsg;","outputs":1,"noerr":0,"x":500,"y":440,"wires":[["5c34cac2.94824c","3a09c14d.3df246"]]},{"id":"5c34cac2.94824c","type":"debug","z":"6a24e889.3323f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":750,"y":280,"wires":[]},{"id":"3a09c14d.3df246","type":"stoptimer","z":"6a24e889.3323f8","duration":"45","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":770,"y":440,"wires":[[],[]]},{"id":"a22e0ea9.276dc8","type":"hubitat config","z":"","name":"HubitatM","usetls":false,"host":"192.168.1.46","port":"80","token":"496f7f11-256d-44c9-99c6-4ed460d3efb0","appId":"1522","nodeRedServer":"http://192.168.1.4:1880","webhookPath":"/hubitat/webhook"}]