Hi.
I'm new with node red, but having some success with the most of my projects
I'm facing issues with one of them where I want to turn the light on when I open my smart lock and the time is between 6pm and 4am. Immediately after I deploy my code and test, it seems working properly but it seems turn on the light with no smart locker action as well. I included the time verification in the middle of the node and I've thought it would be executed only with the smart lock action but it seems it is executed independent of the lock is opened or not. Could anyone help me with this issue, please?
Thanks.
[{"id":"12f28c2354857f16","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"29efafe90a107056","type":"mqtt in","z":"12f28c2354857f16","name":"YDF 40A - Living","topic":"zigbee2mqtt/Sala Fechadura","qos":"2","datatype":"auto-detect","broker":"a5b05a5352bc5bae","nl":false,"rap":true,"rh":0,"inputs":0,"x":100,"y":140,"wires":[["b0e7bd1f5ac79d0d"]]},{"id":"35c1d12bd75dd19b","type":"function","z":"12f28c2354857f16","name":"Source","func":"const acao = msg.payload.action_source;\nvar acao_txt = '';\nswitch (acao) {\n case 0:\n acao_txt = 'Open - pass';\n break;\n case 1:\n acao_txt = 'Open - HA';\n break;\n case 4:\n acao_txt = 'Open - fingerprint';\n break;\n default:\n acao_txt = null;\n}\nmsg.payload.acao_txt = acao_txt;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":160,"wires":[["914288d5d8a361f5"]]},{"id":"914288d5d8a361f5","type":"function","z":"12f28c2354857f16","name":"User","func":"var comp_txt = '';\nvar usuario = msg.payload.action_user;\nswitch (usuario) {\n case 1:\n comp_txt = 'User A';\n break;\n case 2:\n comp_txt = 'User B';\n break;\n case 3:\n comp_txt = 'User C';\n break;\n case 4:\n comp_txt = 'User D';\n break;\n default:\n comp_txt = '';\n}\nif (comp_txt != '')\n comp_txt = ' - ' + comp_txt;\nmsg.payload.mensagem = msg.payload.acao_txt + comp_txt;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":690,"y":160,"wires":[["6bbba2b80216eadd"]]},{"id":"d4caad3e112576bc","type":"api-call-service","z":"12f28c2354857f16","name":"PushNot","server":"fad61953.26ffa8","version":5,"debugenabled":false,"domain":"notify","service":"notify","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"{{payload.mensagem}}\",\"title\":\"Locker - Living\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":140,"wires":[[]]},{"id":"6bbba2b80216eadd","type":"switch","z":"12f28c2354857f16","name":"Validation (cont)","property":"payload.acao_txt","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"false","repair":false,"outputs":1,"x":900,"y":160,"wires":[["d4caad3e112576bc"]]},{"id":"b0e7bd1f5ac79d0d","type":"switch","z":"12f28c2354857f16","name":"User or Manual_Auto","property":"payload.action_source","propertyType":"msg","rules":[{"t":"eq","v":"2","vt":"str"},{"t":"neq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":340,"y":140,"wires":[["3b1d309a38013302"],["35c1d12bd75dd19b","9cd65854d399e592"]]},{"id":"3b1d309a38013302","type":"function","z":"12f28c2354857f16","name":"Manual_Auto","func":"var comp_txt = '';\nvar forma = msg.payload.action;\nswitch (forma) {\n case 'auto_lock':\n comp_txt = 'Close - Automatic';\n break;\n case 'manual':\n comp_txt = 'Close - Manual';\n break;\n case 'unlock':\n comp_txt = 'Open - Manual';\n break;\n case 'lock':\n comp_txt = 'Close - Manual';\n break;\n}\nmsg.payload.mensagem = comp_txt;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":120,"wires":[["0baeb75e7391ef45"]]},{"id":"0baeb75e7391ef45","type":"switch","z":"12f28c2354857f16","name":"Validation (msg)","property":"payload.mensagem","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"false","repair":false,"outputs":1,"x":900,"y":120,"wires":[["d4caad3e112576bc"]]},{"id":"9cd65854d399e592","type":"time-range-switch","z":"12f28c2354857f16","name":"Turn On Light","lat":"","lon":"","startTime":"18:00","endTime":"04:00","startOffset":0,"endOffset":0,"x":580,"y":220,"wires":[["6dfd10db01f10f9c"],[]]},{"id":"6dfd10db01f10f9c","type":"api-call-service","z":"12f28c2354857f16","name":"Light - Living","server":"fad61953.26ffa8","version":5,"debugenabled":false,"domain":"switch","service":"turn_on","areaId":[],"deviceId":[],"entityId":["switch.sala_interru_center"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":850,"y":220,"wires":[[]]},{"id":"a5b05a5352bc5bae","type":"mqtt-broker","name":"MQTT HA","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"fad61953.26ffa8","type":"server","name":"Home Assistant","addon":true}]