Is there a node red way something like a one shote rise in a PLC?

I have the input node checking the database every second for a change, but it is a lot going back and forth to MQTT. Is there a way to only send one message until the output from the sql database changes in the switch node? From ON to OFF and vise versa

[{"id":"69610940.e72308","type":"function","z":"d4c8cc0f.e4bd8","name":"Light function","func":"msg.topic = \"SELECT `Light` FROM `kitchen`\";\nreturn msg;\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":400,"wires":[["7f112a92.583094"]]},{"id":"7f112a92.583094","type":"mysql","z":"d4c8cc0f.e4bd8","mydb":"","name":"","x":410,"y":400,"wires":[["1e814a1bdb6d3f3c"]]},{"id":"d1bcd12aceb0951e","type":"mqtt out","z":"d4c8cc0f.e4bd8","name":"","topic":"Dining/output1/set","qos":"0","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"d2ac6b34530e76d9","x":1250,"y":400,"wires":[]},{"id":"b78008e067ec55d1","type":"inject","z":"d4c8cc0f.e4bd8","name":"","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"flow","x":100,"y":400,"wires":[["69610940.e72308"]]},{"id":"1e814a1bdb6d3f3c","type":"switch","z":"d4c8cc0f.e4bd8","name":"","property":"payload[0].Light","propertyType":"msg","rules":[{"t":"cont","v":"ON","vt":"str"},{"t":"cont","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":650,"y":400,"wires":[["d5261a9e.f27a18"],["d8fc67518f3a6821"]]},{"id":"d5261a9e.f27a18","type":"change","z":"d4c8cc0f.e4bd8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":380,"wires":[["d1bcd12aceb0951e"]]},{"id":"d8fc67518f3a6821","type":"change","z":"d4c8cc0f.e4bd8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":420,"wires":[["d1bcd12aceb0951e"]]},{"id":"d2ac6b34530e76d9","type":"mqtt-broker","name":"","broker":"10.10.170.2","port":"1883","tls":"","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"5","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

You can use a Filter node which blocks all messages unless the payload (or other property) changes.