# AND Logic not operating

**URL:** <https://discourse.nodered.org/t/and-logic-not-operating/27902>\
**Category:** General\
**Created:** [6 June 2020 16:26 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902 "2020-06-06T16:26:26Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rakmaneng](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Rakmaneng](https://discourse.nodered.org/u/Rakmaneng)\
**Post date:** [6 June 2020 16:26 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/1 "2020-06-06T16:26:26Z")

</div>

Hi all,

I'm after some help with a AND logic function

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/136ee3744e908ef5492e458317b37e9bb98afaab.png)

The gate is not behaving like a AND gate and will pass with only one input active.

Any thoughts?

```auto
[{"id":"ed49abd7.bc8c18","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"bc3da4ff.eb3008","type":"api-call-service","z":"ed49abd7.bc8c18","name":"Rear Flood On","server":"b9e13121.b341a","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.sonoff_rearfloodlight","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1400,"y":480,"wires":[[]],"icon":"node-red-contrib-actionflows/actionflows.png"},{"id":"a8c64dff.556ef","type":"api-call-service","z":"ed49abd7.bc8c18","name":"Rear Flood Off","server":"b9e13121.b341a","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.sonoff_rearfloodlight","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1400,"y":580,"wires":[[]],"icon":"node-red-contrib-actionflows/actionflows.png"},{"id":"8ed31334.c30db","type":"trigger-state","z":"ed49abd7.bc8c18","name":"Intruder Alarm Trigger","server":"b9e13121.b341a","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"switch.sonoff_intruderalarm","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":240,"y":580,"wires":[["bf637c58.48fce"],[]]},{"id":"f1debdaf.a601d","type":"bigtimer","z":"ed49abd7.bc8c18","outtopic":"","outpayload1":"on","outpayload2":"off","name":"Big Timer","comment":"","lat":"53.30","lon":"2.24","starttime":"1215","endtime":"1245","starttime2":"1260","endtime2":"1410","startoff":0,"endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"on","outtext2":"off","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"repeat":false,"atstart":true,"odd":false,"even":false,"x":500,"y":400,"wires":[["bf637c58.48fce"],[],[]]},{"id":"d1ecee5.19a0b1","type":"inject","z":"ed49abd7.bc8c18","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":360,"wires":[["f1debdaf.a601d"]]},{"id":"b2585a9f.58e418","type":"inject","z":"ed49abd7.bc8c18","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":440,"wires":[["f1debdaf.a601d"]]},{"id":"bf637c58.48fce","type":"and-gate","z":"ed49abd7.bc8c18","name":"","rules":[{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload","topic":""},{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload","topic":""}],"outputTopic":"","gateType":"and","emitOnlyIfTrue":false,"x":760,"y":480,"wires":[["5de57ca2.5ed424"]]},{"id":"5de57ca2.5ed424","type":"switch","z":"ed49abd7.bc8c18","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1030,"y":540,"wires":[["bc3da4ff.eb3008"],["a8c64dff.556ef"]]},{"id":"b9e13121.b341a","type":"server","z":"","name":"Home Assistant","addon":true}]

```

[edit]``` added around code[/edit]

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2020 16:42 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/2 "2020-06-06T16:42:32Z")

</div>

Hi and welcone to NR forum.

couple of things here...

1. in order to make code more readable an importable it is important to post it between two sets of three backticks - ``` - see this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

then please edit your code

1. you cannot perform AND logic like that (due to mesages arriving into the "and gate" at different times

See [this article in the cookbook](https://cookbook.nodered.org/basic/join-streams) for an example of how to join messages into one object.

Then you'll be able to perform the AND logic.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [6 June 2020 17:11 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/3 "2020-06-06T17:11:50Z")

</div>

> [@Steve-Mcl](#):
>
> you cannot perform AND logic like that (due to mesages arriving into the "and gate" at different times

That's for the logic gates irrelevant, you can send different message with different time interval, it doesn't matter when the messages arrive. There can be days between them.  
The input message topic combined with payload determines the setting or resetting from the input buffer.

```auto
[{"id":"3a514833.85a2c","type":"and-gate","z":"c07375d6.abd348","name":"","rules":[{"t":"true","propertyType":"msg","property":"payload","topic":"a"},{"t":"true","propertyType":"msg","property":"payload","topic":"b"}],"outputTopic":"OuTopic","gateType":"and","emitOnlyIfTrue":true,"x":440,"y":200,"wires":[["4d07fbed.191c0c"]]},{"id":"4d07fbed.191c0c","type":"debug","z":"c07375d6.abd348","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":200,"wires":[]},{"id":"ded2b00a.54cba8","type":"inject","z":"c07375d6.abd348","name":"","topic":"a","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":140,"wires":[["3a514833.85a2c"]]},{"id":"58cff7ec.28cb","type":"inject","z":"c07375d6.abd348","name":"","topic":"b","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":280,"wires":[["3a514833.85a2c"]]},{"id":"8a41df48.dac46","type":"inject","z":"c07375d6.abd348","name":"","topic":"a","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":180,"wires":[["3a514833.85a2c"]]},{"id":"bb621c20.674148","type":"inject","z":"c07375d6.abd348","name":"","topic":"b","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":320,"wires":[["3a514833.85a2c"]]}]

```

I think TS has to set the check box True restriction, but without importable code we can't check that.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 June 2020 17:19 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/4 "2020-06-06T17:19:25Z")

</div>

I didnt import the flow either (due to not being importable) - but i see the subtle difference now (that node labelled "and gate" ISNT actually a `switch` node - its a shade different but otherwise identical!)

I dont use the logic gates (I pretty much use built in nodes for AND/OR logic)

---

<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:** [6 June 2020 21:20 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/5 "2020-06-06T21:20:32Z")

</div>

did you read the info tab for the node?  
 ![Screen Shot 2020-06-06 at 5.18.41 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/3/d31d04c1f1cd7e2404ff2245460bd17ce2eb84a1.png)

---

<div class="post-metadata">

**Author:** ![Rakmaneng](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Rakmaneng](https://discourse.nodered.org/u/Rakmaneng)\
**Post date:** [6 June 2020 23:38 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/6 "2020-06-06T23:38:45Z")

</div>

Hi Guys

Thanks for the responses, I do apologise if i sound a bit green, I'm a newbie and only been playing with Node red for a few days.

I want the Intruder alarm trigger only to operate the flood light after a set time.

So with my flow, what do I exactly need to do to fix it?

I've attached the code correctly below, I think

```auto
[{"id":"ed49abd7.bc8c18","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"bc3da4ff.eb3008","type":"api-call-service","z":"ed49abd7.bc8c18","name":"Rear Flood On","server":"b9e13121.b341a","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.sonoff_rearfloodlight","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1400,"y":480,"wires":[[]],"icon":"node-red-contrib-actionflows/actionflows.png"},{"id":"a8c64dff.556ef","type":"api-call-service","z":"ed49abd7.bc8c18","name":"Rear Flood Off","server":"b9e13121.b341a","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.sonoff_rearfloodlight","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1400,"y":580,"wires":[[]],"icon":"node-red-contrib-actionflows/actionflows.png"},{"id":"8ed31334.c30db","type":"trigger-state","z":"ed49abd7.bc8c18","name":"Intruder Alarm Trigger","server":"b9e13121.b341a","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"switch.sonoff_intruderalarm","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":240,"y":580,"wires":[["bf637c58.48fce"],[]]},{"id":"f1debdaf.a601d","type":"bigtimer","z":"ed49abd7.bc8c18","outtopic":"","outpayload1":"on","outpayload2":"off","name":"Big Timer","comment":"","lat":"53.30","lon":"2.24","starttime":"1215","endtime":"1245","starttime2":"1260","endtime2":"1410","startoff":0,"endoff":0,"startoff2":0,"endoff2":0,"offs":0,"outtext1":"on","outtext2":"off","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"repeat":false,"atstart":true,"odd":false,"even":false,"x":500,"y":400,"wires":[["bf637c58.48fce"],[],[]]},{"id":"d1ecee5.19a0b1","type":"inject","z":"ed49abd7.bc8c18","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":360,"wires":[["f1debdaf.a601d"]]},{"id":"b2585a9f.58e418","type":"inject","z":"ed49abd7.bc8c18","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":440,"wires":[["f1debdaf.a601d"]]},{"id":"bf637c58.48fce","type":"and-gate","z":"ed49abd7.bc8c18","name":"","rules":[{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload","topic":""},{"t":"eq","v":"on","vt":"str","propertyType":"msg","property":"payload","topic":""}],"outputTopic":"","gateType":"and","emitOnlyIfTrue":false,"x":760,"y":480,"wires":[["5de57ca2.5ed424"]]},{"id":"5de57ca2.5ed424","type":"switch","z":"ed49abd7.bc8c18","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1030,"y":540,"wires":[["bc3da4ff.eb3008"],["a8c64dff.556ef"]]},{"id":"b9e13121.b341a","type":"server","z":"","name":"Home Assistant","addon":true}]

```

Thanks

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 June 2020 07:18 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/7 "2020-06-07T07:18:41Z")

</div>

> [@Rakmaneng](#):
>
> I want the Intruder alarm trigger only to operate the flood light after a set time.

Have you tried the delay node?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 June 2020 08:37 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/8 "2020-06-07T08:37:26Z")

</div>

> [@Rakmaneng](#):
>
> I want the Intruder alarm trigger only to operate the flood light after a set time.

So after looking at your flow & reading your description - is this what you want?

- IF time is in range (20:15 ~ 20:45 OR 21:00 ~ 23:30) ...
  - IF alarm trigger "on"
    - send "on" signal to rear flood light

  - IF alarm trigger "off"
    - send "off" signal to rear flood light

- IF time is outside the range...
  - ignore the alarm signal

Question: Do you want the rear flood light to be sent an "off" when time reaches 20:45 and 23:30? (otherwise the alarm "off" would be ignored and the flood light would remain on all night)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 June 2020 09:24 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/9 "2020-06-07T09:24:16Z")

</div>

OK, so I made some assumptions based on what seems sensible.

This is what I did...

 ![alarmandsched](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/9/099089fad72c4649fba561708b3d7d1aac746a06.gif)

the flow....

```auto
[{"id":"aad42814.760ec8","type":"inject","z":"6578e068.afc95","name":"fake schedule : on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"schedule","payload":"on","payloadType":"str","x":270,"y":400,"wires":[["f6c98c43.77ecd"]]},{"id":"5c22ab78.4c0ed4","type":"switch","z":"6578e068.afc95","name":"alarm: on? off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":740,"y":280,"wires":[["45993978.5c92f8"],["fd812f17.f7756"]],"outputLabels":["on","off"]},{"id":"5f10d768.993f68","type":"cronplus","z":"6578e068.afc95","name":"","outputField":"payload","timeZone":"","commandResponseMsgOutput":"output1","outputs":1,"options":[{"expressionType":"cron","name":"schedule1","topic":"schedule","payload":"on","type":"str","expression":"0 15 20 * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"expressionType":"cron","name":"schedule2","topic":"schedule","payload":"off","type":"str","expression":"0 45 20 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"expressionType":"cron","name":"schedule3","topic":"schedule","payload":"on","type":"str","expression":"0 0 21 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"},{"expressionType":"cron","name":"schedule4","topic":"schedule","payload":"off","type":"str","expression":"0 30 23 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":240,"y":480,"wires":[["f6c98c43.77ecd"]]},{"id":"15b0249f.1d28eb","type":"inject","z":"6578e068.afc95","name":"fake alarm trigger on","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"alarm","payload":"on","payloadType":"str","x":270,"y":280,"wires":[["f8096d35.43a29"]]},{"id":"e50338cf.4ad818","type":"inject","z":"6578e068.afc95","name":"fake alarm trigger off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"alarm","payload":"off","payloadType":"str","x":270,"y":320,"wires":[["f8096d35.43a29"]]},{"id":"cf2c8ad1.f76168","type":"inject","z":"6578e068.afc95","name":"fake schedule : off","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"schedule","payload":"off","payloadType":"str","x":270,"y":440,"wires":[["f6c98c43.77ecd"]]},{"id":"f8096d35.43a29","type":"switch","z":"6578e068.afc95","name":"schedule: on? off?","property":"schedule","propertyType":"flow","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":510,"y":280,"wires":[["5c22ab78.4c0ed4","57554d4e.177e14"],["57554d4e.177e14","fd812f17.f7756"]]},{"id":"57554d4e.177e14","type":"debug","z":"6578e068.afc95","name":"debug","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":550,"y":340,"wires":[]},{"id":"b460270d.afe888","type":"debug","z":"6578e068.afc95","name":"debug","active":false,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":550,"y":500,"wires":[]},{"id":"f6c98c43.77ecd","type":"change","z":"6578e068.afc95","name":"","rules":[{"t":"set","p":"schedule","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":440,"wires":[["b460270d.afe888","978428b2.0a3e68"]]},{"id":"45993978.5c92f8","type":"change","z":"6578e068.afc95","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":895,"y":280,"wires":[["de361641.9ec138"]],"l":false},{"id":"fd812f17.f7756","type":"change","z":"6578e068.afc95","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":895,"y":400,"wires":[["de361641.9ec138"]],"l":false},{"id":"978428b2.0a3e68","type":"switch","z":"6578e068.afc95","name":"off time?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":720,"y":440,"wires":[["fd812f17.f7756"]],"outputLabels":["off"]},{"id":"de361641.9ec138","type":"debug","z":"6578e068.afc95","name":"rear flood off / on","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1030,"y":340,"wires":[]}]

```

NOTES:

- I did originally use a join node but it didn't quite work the way expected in this instance.
- I didn't use the `big timer` (I don't have it & don't need it) - this example uses `node-red-contrib-cron-plus.` This has the advantage of having as many schedules as you need (this example is set for 2 "on" and 2 "off" times as per your original - but you can have pretty much unlimited schedules with almost infinite possibilities)

---

<div class="post-metadata">

**Author:** ![Rakmaneng](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Rakmaneng](https://discourse.nodered.org/u/Rakmaneng)\
**Post date:** [7 June 2020 09:25 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/10 "2020-06-07T09:25:54Z")

</div>

HI Steve-Mci

Sorry for the confusion, i was just playing around with the time settings.  
There should only be one time range in the timer block.

The flood would only come on if the intruder alarm was triggered during the on period (i.e. night time).

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 June 2020 09:26 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/11 "2020-06-07T09:26:43Z")

</div>

thats fine.

The flow I posted works for that scenario - just change the CRON node

---

<div class="post-metadata">

**Author:** ![Rakmaneng](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Rakmaneng](https://discourse.nodered.org/u/Rakmaneng)\
**Post date:** [7 June 2020 09:27 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/12 "2020-06-07T09:27:53Z")

</div>

Thanks, I'll give it a try.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 June 2020 09:30 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/13 "2020-06-07T09:30:08Z")

</div>

![luJ6IAYZsn](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/8/c8fdd13e88d30a91186036759f2c889e6b00c651.gif)

---

<div class="post-metadata">

**Author:** ![Rakmaneng](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Rakmaneng](https://discourse.nodered.org/u/Rakmaneng)\
**Post date:** [7 June 2020 09:47 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/14 "2020-06-07T09:47:56Z")

</div>

Hi Steve-Mci

It's working!!

Much appreciated and thanks for you help.

However is it possible to swap out the CRON + scheduler for the Big Timer?

I only ask as i had a thought that by setting it to activate at sunset then it would track throughout the year instead of having to constantly change the time schedule manually.

---

<div class="post-metadata">

**Author:** ![Rakmaneng](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Rakmaneng](https://discourse.nodered.org/u/Rakmaneng)\
**Post date:** [7 June 2020 09:52 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/15 "2020-06-07T09:52:34Z")

</div>

Just tried it with the big timer and it works.

Thanks again

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 June 2020 09:58 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/16 "2020-06-07T09:58:21Z")

</div>

Yes you can I'm certain but I don't use it or have it.

If you can wait a few days, the CRON node is to be updated to include any solar time you wish

 ![BnG1WcyZax](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/c/ac820c7394c645f71f243be1cce8deb267d94045.gif)

---

<div class="post-metadata">

**Author:** ![Rakmaneng](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@Rakmaneng](https://discourse.nodered.org/u/Rakmaneng)\
**Post date:** [7 June 2020 11:37 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/17 "2020-06-07T11:37:41Z")

</div>

I'm not in a rush, will leave the Big Timer in for now and give the CRON+ a try in a few days.

Thanks

---

<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:** [6 August 2020 11:37 UTC](https://discourse.nodered.org/t/and-logic-not-operating/27902/18 "2020-08-06T11:37:43Z")

</div>

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