Trigger switch for two seconds

Hello all,

I am trying to simulate physically pressing a button two times with an input boolean switch
Example ON for 1sec, OFF for 500 ms, ON for 1 sec and OFF even if boolean toggle is left ON.
I am trying with trigger nodes, but sometimes output stays off or on. I require precisely to be OFF after second time.

I am trying to simulate car preheating via pressing car foob. Two quick presses starts the vehicle, if more than two times it will shut off.
Using spare care foob, soldered few jumper wires to trigger physical button. But need to get the logic right before start playing with car. Now, it’s just an led output.
I am sure it can be done with a function node.

Thanks,

Using a series of call service and delay nodes would work.

[{"id":"9db222cd8b67d87a","type":"api-call-service","z":"f80b6c338afd5483","name":"turn on","server":"6b1110b5.183a4","version":3,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":720,"y":2540,"wires":[["e49bfe3e1521dce6"]]},{"id":"e49bfe3e1521dce6","type":"delay","z":"f80b6c338afd5483","name":"set delay","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":860,"y":2540,"wires":[["133f4dcccd595eb5"]]},{"id":"133f4dcccd595eb5","type":"api-call-service","z":"f80b6c338afd5483","name":"turn off","server":"6b1110b5.183a4","version":3,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":990,"y":2540,"wires":[["76de17980e755ad2"]]},{"id":"76de17980e755ad2","type":"delay","z":"f80b6c338afd5483","name":"set delay","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1120,"y":2540,"wires":[["6a2f968e344413e2"]]},{"id":"6a2f968e344413e2","type":"api-call-service","z":"f80b6c338afd5483","name":"turn on","server":"6b1110b5.183a4","version":3,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1260,"y":2540,"wires":[["0fa6a169343c329f"]]},{"id":"0fa6a169343c329f","type":"delay","z":"f80b6c338afd5483","name":"set delay","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1400,"y":2540,"wires":[["91d4749325fc845e"]]},{"id":"91d4749325fc845e","type":"api-call-service","z":"f80b6c338afd5483","name":"turn off","server":"6b1110b5.183a4","version":3,"debugenabled":false,"service_domain":"","service":"","entityId":"","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1530,"y":2540,"wires":[["a55d9e6639f09290"]]},{"id":"a55d9e6639f09290","type":"delay","z":"f80b6c338afd5483","name":"set delay","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":1660,"y":2540,"wires":[[]]},{"id":"aba0f729dce48b21","type":"inject","z":"f80b6c338afd5483","name":"some trigger","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":570,"y":2540,"wires":[["9db222cd8b67d87a"]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"30"}]
1 Like

Thank you. Will give it a try

@zerkx01, did you get this to work? What did you use for the physical button press?