# Auto light with unlock

**URL:** <https://discourse.nodered.org/t/auto-light-with-unlock/39471>\
**Category:** General\
**Created:** [21 January 2021 01:17 UTC](https://discourse.nodered.org/t/auto-light-with-unlock/39471 "2021-01-21T01:17:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![killahbee](https://avatars.discourse-cdn.com/v4/letter/k/b5ac83/32.png) [@killahbee](https://discourse.nodered.org/u/killahbee)\
**Post date:** [21 January 2021 01:17 UTC](https://discourse.nodered.org/t/auto-light-with-unlock/39471/1 "2021-01-21T01:17:38Z")

</div>

Hi All,  
I am trying to automate a light coming on when there is motion at the front door followed by the door unlocking.  
This is my current flow, the problem is that if I unlock the door then leave it still goes off so trying to have it as changes to unlocked instead of just being unlocked which is what I have now.

[{"id":"a33c49c7.2fa5b8","type":"tab","label":"Home Lights On","disabled":false,"info":""},{"id":"db888235.5bb6c","type":"trigger-state","z":"a33c49c7.2fa5b8","name":"Front Door Unlocked","server":"aafa0692.311388","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"lock.front\_door\_lock\_locked","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this\_entity","targetValue":"","propertyType":"current\_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"unlocked","propertyValue":"new\_state.state"},{"targetType":"this\_entity","targetValue":"","propertyType":"current\_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"locked","propertyValue":"new\_state.state"}],"outputs":2,"customoutputs":,"outputinitially":false,"state\_type":"str","x":460,"y":300,"wires":[["c096476.aab35b8"],]},{"id":"ae3b09fe.6ccf28","type":"trigger-state","z":"a33c49c7.2fa5b8","name":"Front Door Motion","server":"aafa0692.311388","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary\_sensor.front\_door\_motion","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this\_entity","targetValue":"","propertyType":"current\_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"detected","propertyValue":"new\_state.state"},{"targetType":"this\_entity","targetValue":"","propertyType":"current\_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"undetected","propertyValue":"new\_state.state"}],"outputs":2,"customoutputs":,"outputinitially":false,"state\_type":"str","x":150,"y":360,"wires":[["db888235.5bb6c"],]},{"id":"2bf354b2.5c1a4c","type":"api-call-service","z":"a33c49c7.2fa5b8","name":"Front Hall Light On","server":"aafa0692.311388","version":1,"debugenabled":false,"service\_domain":"switch","service":"turn\_on","entityId":"switch.front\_hall\_light","data":"","dataType":"json","mergecontext":"","output\_location":"","output\_location\_type":"none","mustacheAltTags":false,"x":980,"y":220,"wires":[]},{"id":"c096476.aab35b8","type":"trigger-state","z":"a33c49c7.2fa5b8","name":"Night time","server":"aafa0692.311388","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.time","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this\_entity","targetValue":"","propertyType":"current\_state","comparatorType":"\>","comparatorValueDatatype":"str","comparatorValue":"19:00","propertyValue":"new\_state.state"},{"targetType":"this\_entity","targetValue":"","propertyType":"current\_state","comparatorType":"\<","comparatorValueDatatype":"str","comparatorValue":"19:00","propertyValue":"new\_state.state"}],"outputs":2,"customoutputs":,"outputinitially":false,"state\_type":"str","x":730,"y":240,"wires":[["2bf354b2.5c1a4c"],]},{"id":"aafa0692.311388","type":"server","name":"Home Assistant","addon":true}]

---

<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:** [22 March 2021 01:17 UTC](https://discourse.nodered.org/t/auto-light-with-unlock/39471/2 "2021-03-22T01:17:40Z")

</div>

Closed on 22 March 2021 01:17 UTC

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