Blinking Light when one of two entities is sending "on" as message payload

Hi,

I want to let a Light blinking when one of two entities is sending "on" as message payload.

Both entities are sending every 30 seconds either on or off.

If one entity is sending on, a light should blink (on/off) until both entities are sending again off.

What is the best way to achieve this?

Best Regards,
Johannes

There are quite a few. Here is one way using just core nodes (a no-code solution)

chrome_AFTSQcjJqV

Demo flow

use CTRL+I to import it

[{"id":"e84b862476822156","type":"inject","z":"b80ad2c292e3e84c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"sensor1","payload":"on","payloadType":"str","x":1100,"y":140,"wires":[["b019eb8ca2b936e6"]]},{"id":"e9388212763bcc04","type":"inject","z":"b80ad2c292e3e84c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"sensor2","payload":"on","payloadType":"str","x":1100,"y":180,"wires":[["b019eb8ca2b936e6"]]},{"id":"45e50b0b5ca3a6e4","type":"inject","z":"b80ad2c292e3e84c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"sensor1","payload":"off","payloadType":"str","x":1100,"y":240,"wires":[["9f87af3f400966bc"]]},{"id":"cf1e566bebd0eb6f","type":"inject","z":"b80ad2c292e3e84c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"sensor2","payload":"off","payloadType":"str","x":1100,"y":280,"wires":[["9f87af3f400966bc"]]},{"id":"a9de26fd8c0591ec","type":"change","z":"b80ad2c292e3e84c","name":"","rules":[{"t":"set","p":"blink","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1350,"y":160,"wires":[[]]},{"id":"232caff9a3ea827a","type":"inject","z":"b80ad2c292e3e84c","name":"every 1s","props":[{"p":"payload"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1100,"y":380,"wires":[["f2a6f5b98f27c277"]]},{"id":"b2d786238526a076","type":"trigger","z":"b80ad2c292e3e84c","name":"","op1":"on","op2":"off","op1type":"str","op2type":"str","duration":"500","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":1660,"y":360,"wires":[["2830eb45d3f847ad"]]},{"id":"2830eb45d3f847ad","type":"debug","z":"b80ad2c292e3e84c","name":"output","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1810,"y":360,"wires":[]},{"id":"b8f6e0801d865493","type":"switch","z":"b80ad2c292e3e84c","name":"sensor1 == off?","property":"payload.sensor1","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1420,"y":280,"wires":[["70d106f50ce64b0a"]]},{"id":"b2e241d940565e12","type":"change","z":"b80ad2c292e3e84c","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1490,"y":400,"wires":[["b2d786238526a076"]]},{"id":"70d106f50ce64b0a","type":"switch","z":"b80ad2c292e3e84c","name":"sensor2 == off?","property":"payload.sensor2","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1600,"y":280,"wires":[["7c63a196b43b9511"]]},{"id":"7c63a196b43b9511","type":"change","z":"b80ad2c292e3e84c","name":"reset flow.blink","rules":[{"t":"set","p":"blink","pt":"flow","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1780,"y":280,"wires":[[]]},{"id":"f2a6f5b98f27c277","type":"switch","z":"b80ad2c292e3e84c","name":"blink == true?","property":"blink","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1280,"y":380,"wires":[["b2d786238526a076"],["b2e241d940565e12"]]},{"id":"eb1a0ddcf8e84cae","type":"join","z":"b80ad2c292e3e84c","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1330,"y":220,"wires":[["b8f6e0801d865493"]]},{"id":"b019eb8ca2b936e6","type":"junction","z":"b80ad2c292e3e84c","x":1220,"y":160,"wires":[["a9de26fd8c0591ec","eb1a0ddcf8e84cae"]]},{"id":"9f87af3f400966bc","type":"junction","z":"b80ad2c292e3e84c","x":1220,"y":260,"wires":[["eb1a0ddcf8e84cae"]]}]
2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.