# Help with trigger combination

**URL:** <https://discourse.nodered.org/t/help-with-trigger-combination/20914>\
**Category:** General\
**Created:** [27 January 2020 16:21 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914 "2020-01-27T16:21:00Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![fernmac](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@fernmac](https://discourse.nodered.org/u/fernmac)\
**Post date:** [27 January 2020 16:21 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/1 "2020-01-27T16:21:00Z")

</div>

Hello, I am very new at node red. I have been using HA for a while now and since I am not a coder, it seems like a good alternative to yaml.  
Anyway, I already lost a few hours trying to do something, I guess, quite simple:

- I have 2 switches, room lamp and kitchen lamp (shelly´s)
- I'd like to: switch on room lamp then if I switch off the same room lamp within 2 seconds, kitchen lamp toggles.  
Thanks for any help

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 January 2020 16:56 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/2 "2020-01-27T16:56:15Z")

</div>

Welcome to the forum!

What version of NR are you running?  
What version of node.js (both of these can be found on the startup log)  
What platform and OS are you using?  
When you say you have two switches, do you ean in the flow or are they physical switched?  
and last but not least, what have you tried so far?

---

<div class="post-metadata">

**Author:** ![fernmac](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@fernmac](https://discourse.nodered.org/u/fernmac)\
**Post date:** [27 January 2020 17:07 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/3 "2020-01-27T17:07:56Z")

</div>

Ok, I am using ver. 6.03 within home assistant with [hass.io](http://hass.io).  
I have 2 physical switches.  
I tried with timers but I do not understand enough of the logic.  
Thanks

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 January 2020 17:14 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/4 "2020-01-27T17:14:06Z")

</div>

> Ok, I am using ver. 6.03

version 6.03 of what?  
What version of Node-RED are you using?  
Can you provide your flow?

---

<div class="post-metadata">

**Author:** ![fernmac](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@fernmac](https://discourse.nodered.org/u/fernmac)\
**Post date:** [27 January 2020 17:33 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/5 "2020-01-27T17:33:25Z")

</div>

I installed node red as a component in HA:

## [Hass.io](http://Hass.io) Add-on: Node-RED Flow-based programming for the Internet of Things

Add-on version: 6.0.3  
You are running the latest version of this add-on.  
System: HassOS 1.12 (armv7 / raspberrypi3)  
Home Assistant version: 0.104.3  
Supervisor version: 195

So far I use a yaml automation to do what I need with a timer and this automation:

> Blockquote

- alias: 'toggler light on'  
trigger:  
platform: state  
entity\_id: light.primary  
from: 'off'  
to: 'on'  
action:  
service: timer.start  
entity\_id: timer.toggler

- alias: 'toggler light off'  
trigger:  
platform: state  
entity\_id: light.primary  
from: 'on'  
to: 'off'  
condition:  
condition: template  
value\_template: "{{ states('timer.toggler') == 'active' }}"  
action:  
service: light.toggle  
entity\_id: light.secondary

> Blockquote

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 January 2020 17:42 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/6 "2020-01-27T17:42:48Z")

</div>

This sounds like a question you should ask on the Hassio forum

---

<div class="post-metadata">

**Author:** ![fernmac](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@fernmac](https://discourse.nodered.org/u/fernmac)\
**Post date:** [27 January 2020 18:09 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/7 "2020-01-27T18:09:10Z")

</div>

wao, thanks! This is a node red question, not hassio related.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [27 January 2020 18:13 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/8 "2020-01-27T18:13:50Z")

</div>

Well what have you tried in Node-RED? What does your flow look like? If you open NR and pull down the hamburger menu on the top right, you'll see the NR version at the bottom. What is it?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 January 2020 18:14 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/9 "2020-01-27T18:14:36Z")

</div>

Can you share the flow you have so far ? I would guess something like the room lamp feed a 2 sec trigger - sending 1 then 0 - and that feeding a change node to set a flow variable. Then the same switch also feeding a function that checks if the switch is a 0 (ie turned off) and the flow variable is a 1 - then toggle the kitchen lamp.

```auto
[{"id":"a86e21ff.e32a5","type":"inject","z":"c4f68fc3.2dd88","name":"on","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":1160,"wires":[["ea2f6bdb.f8dcb8","bfa0b72d.6745e8"]]},{"id":"ea2f6bdb.f8dcb8","type":"switch","z":"c4f68fc3.2dd88","name":"","property":"room","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":290,"y":1200,"wires":[["c31cbb0d.435ee8"]]},{"id":"bfa0b72d.6745e8","type":"trigger","z":"c4f68fc3.2dd88","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"2","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":300,"y":1160,"wires":[["afb0cff6.64905"]]},{"id":"c31cbb0d.435ee8","type":"debug","z":"c4f68fc3.2dd88","name":"use to trigger kitchen","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":500,"y":1200,"wires":[]},{"id":"4fecaa61.b42764","type":"inject","z":"c4f68fc3.2dd88","name":"off","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":1200,"wires":[["bfa0b72d.6745e8","ea2f6bdb.f8dcb8"]]},{"id":"afb0cff6.64905","type":"change","z":"c4f68fc3.2dd88","name":"","rules":[{"t":"set","p":"room","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":1160,"wires":[[]]}]

```

---

<div class="post-metadata">

**Author:** ![fernmac](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@fernmac](https://discourse.nodered.org/u/fernmac)\
**Post date:** [28 January 2020 10:15 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/10 "2020-01-28T10:15:54Z")

</div>

ver 1.0.3

---

<div class="post-metadata">

**Author:** ![fernmac](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@fernmac](https://discourse.nodered.org/u/fernmac)\
**Post date:** [28 January 2020 10:19 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/11 "2020-01-28T10:19:51Z")

</div>

Thank you so much. This is exactly what I wanted. I uploaded a picture of my flow in case someone needs something like that. Thanks again!

 ![Screenshot 2020-01-28 at 10.18.31](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/42eadc2ec7f4f82b14d446d518672c84c6660598.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 March 2020 10:19 UTC](https://discourse.nodered.org/t/help-with-trigger-combination/20914/12 "2020-03-28T10:19:51Z")

</div>

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