Nodes keep being reactivated although not within time range

As a new user of node red I am experiencing a strange problem.

I use the readout of a sunlux meter to trigger my hue lights to be switched on between 1700 and 2345 hours, when the lux meter has a readout when it's below 3500 lux.

The strange things is that in the morning the lights are on again., Presumably when my computer restarts at 0700 in the morning restarting node red. To switch of the lights I need to go into the hue app and switch off the lights a number of times (as it comes back on again).

It looks as if node red caches the number of execution events and retriggers them although it is not within the specified time range. Please note that I inject the test every 5 minutes to validate a. The readout should be below 3500 lux and b. Time between 1700 and 2345.

Has somebody experienced the same issue. I am not at my pc so I cannot upload the node created.

Thanks for the advice

Hi and welcome...

This sounds quite bespoke so I doubt anyone has the exact same issue.

It's more likely your logic has a flaw or events are queued up due to misuse of a delay node for example.

Post a screenshot of your flow and an export of it into a reply below and I'm sure someone will cast an eye over it for you.

Ps, When you post your flow, in order to make code more readable and actually 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

Hi Steve!

Will do when I have access to the pc again!

First add debug nodes at appropriate points in the flow, give them all names so they are easy to identify from the debug output. Set them up to output to the console.

If you restart node-red do you see the problem? If yes then restart node red in a terminal and you should see the debug outpu in the terminal and work out where the flow is going wrong. If it doesn't do it on a restart then you will have to wait till it does show itself and then look in the node red log to see at what point in the flow it went wrong. On a linux system that is usually in /var/log/syslog. I don't know where it is on other systems.

[{"id":"29fa1e78.fbb392","type":"tab","label":"Hue Lights","disabled":false,"info":""},{"id":"b6568d46.197ff","type":"inject","z":"29fa1e78.fbb392","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"*/5 17-23 * * *","once":true,"onceDelay":0.1,"x":130,"y":580,"wires":[["c25b4709.c0f488"]]},{"id":"6d803d7d.e6e014","type":"change","z":"29fa1e78.fbb392","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.state","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":520,"wires":[["7f4c354b.7a45cc"]]},{"id":"566d1698.f59e18","type":"switch","z":"29fa1e78.fbb392","name":"Zonnecel buiten","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"3500","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1520,"y":520,"wires":[["439ecb03.7fbc84"],[]]},{"id":"5f61de9d.75847","type":"hue-group","z":"29fa1e78.fbb392","name":"Woonkamer","bridge":"4548f284.55d2dc","groupid":"1","colornamer":true,"skipevents":false,"x":1590,"y":780,"wires":[["a32d2645.b16f08"]]},{"id":"439ecb03.7fbc84","type":"function","z":"29fa1e78.fbb392","name":"","func":"msg.payload = {}\nmsg.payload.status = {}\nreturn msg;","outputs":1,"noerr":0,"x":1710,"y":520,"wires":[["5f61de9d.75847","1aac8db2.203a02"]]},{"id":"1aac8db2.203a02","type":"hue-group","z":"29fa1e78.fbb392","name":"white lights","bridge":"4548f284.55d2dc","groupid":"5","colornamer":true,"skipevents":false,"x":1590,"y":240,"wires":[["7ed4de63.9add2"]]},{"id":"7ed4de63.9add2","type":"change","z":"29fa1e78.fbb392","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.on","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1780,"y":240,"wires":[["dba44254.06a8d"]]},{"id":"a32d2645.b16f08","type":"change","z":"29fa1e78.fbb392","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.on","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1800,"y":780,"wires":[["169b9400.afecfc"]]},{"id":"dba44254.06a8d","type":"function","z":"29fa1e78.fbb392","name":"","func":"msg.payload = {}\nmsg.payload.on = \"True\"\nmsg.payload.brightness = 50\nreturn msg;","outputs":1,"noerr":0,"x":1950,"y":240,"wires":[["8b5e1c22.adf72"]]},{"id":"8b5e1c22.adf72","type":"hue-group","z":"29fa1e78.fbb392","name":"white lights","bridge":"4548f284.55d2dc","groupid":"5","colornamer":true,"skipevents":false,"x":2110,"y":240,"wires":[["a18db20f.6d77b"]]},{"id":"6aca9b46.7d75d4","type":"time-range-switch","z":"29fa1e78.fbb392","name":"","lat":"","lon":"","startTime":"17:00","endTime":"23:00","startOffset":0,"endOffset":0,"x":1190,"y":380,"wires":[["2752b97f.4d4036"],[]]},{"id":"169b9400.afecfc","type":"function","z":"29fa1e78.fbb392","name":"","func":"msg.payload = {}\nmsg.payload.on = \"True\"\nmsg.payload.brightness = 50\nreturn msg;","outputs":1,"noerr":0,"x":1990,"y":780,"wires":[["d0464558.5ea148"]]},{"id":"d0464558.5ea148","type":"hue-group","z":"29fa1e78.fbb392","name":"Woonkamer","bridge":"4548f284.55d2dc","groupid":"1","colornamer":true,"skipevents":false,"x":2170,"y":780,"wires":[["48eb2271.f4461c"]]},{"id":"48eb2271.f4461c","type":"time-range-switch","z":"29fa1e78.fbb392","name":"","lat":"","lon":"","startTime":"23:45","endTime":"00:00","startOffset":0,"endOffset":0,"x":2350,"y":780,"wires":[["f9fdce78.dfb3d"],[]]},{"id":"a18db20f.6d77b","type":"time-range-switch","z":"29fa1e78.fbb392","name":"","lat":"","lon":"","startTime":"23:45","endTime":"00:00","startOffset":0,"endOffset":0,"x":2290,"y":240,"wires":[["61c84f93.1f8ca"],[]]},{"id":"61c84f93.1f8ca","type":"function","z":"29fa1e78.fbb392","name":"","func":"msg.payload = {}\nmsg.payload.on = \"false\"\nmsg.payload.brightness = 0\nreturn msg;","outputs":1,"noerr":0,"x":2470,"y":160,"wires":[["ad2eb7a3.3064d8"]]},{"id":"f9fdce78.dfb3d","type":"function","z":"29fa1e78.fbb392","name":"","func":"msg.payload = {}\nmsg.payload.on = \"false\"\nmsg.payload.brightness = 0\nreturn msg;","outputs":1,"noerr":0,"x":2510,"y":700,"wires":[["e06f3969.7ed1f8"]]},{"id":"ad2eb7a3.3064d8","type":"hue-group","z":"29fa1e78.fbb392","name":"white lights","bridge":"4548f284.55d2dc","groupid":"5","colornamer":true,"skipevents":false,"x":2670,"y":160,"wires":[[]]},{"id":"e06f3969.7ed1f8","type":"hue-group","z":"29fa1e78.fbb392","name":"Woonkamer","bridge":"4548f284.55d2dc","groupid":"1","colornamer":true,"skipevents":false,"x":2710,"y":700,"wires":[[]]},{"id":"4b5f9a37.3e0774","type":"comment","z":"29fa1e78.fbb392","name":"Retrieve status suncell outside","info":"","x":320,"y":360,"wires":[]},{"id":"2752b97f.4d4036","type":"openhab2-get","z":"29fa1e78.fbb392","name":"","controller":"c1291da7.c2b5a","itemname":"somfytahoma_lightsensor_fb2869dc_b8b4c0bd_0a9f_4d7e_a19e_fadd63931648_luminance","x":940,"y":440,"wires":[["6d803d7d.e6e014"]]},{"id":"7f4c354b.7a45cc","type":"convert","z":"29fa1e78.fbb392","name":"","convertTo":"number","x":1310,"y":520,"wires":[["566d1698.f59e18"]]},{"id":"6dff1b3.8db3ee4","type":"hue-bridge-node","z":"29fa1e78.fbb392","name":"","bridge":"4548f284.55d2dc","autoupdates":true,"skipglobalevents":false,"x":260,"y":260,"wires":[[]]},{"id":"d23dac1d.2e6cf","type":"switch","z":"29fa1e78.fbb392","name":"","property":"payload.on","propertyType":"msg","rules":[{"t":"eq","v":"truetrue","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1030,"y":380,"wires":[[],["6aca9b46.7d75d4"]]},{"id":"501477de.22e9f8","type":"hue-group","z":"29fa1e78.fbb392","name":"white lights","bridge":"4548f284.55d2dc","groupid":"5","colornamer":true,"skipevents":false,"x":450,"y":480,"wires":[["8553cc37.9bf3"]]},{"id":"8b79e804.fb7278","type":"hue-group","z":"29fa1e78.fbb392","name":"Woonkamer","bridge":"4548f284.55d2dc","groupid":"1","colornamer":true,"skipevents":false,"x":450,"y":440,"wires":[["87abb1e4.bb917"]]},{"id":"d8ccfb39.f7db48","type":"join","z":"29fa1e78.fbb392","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":890,"y":380,"wires":[["d23dac1d.2e6cf"]]},{"id":"c25b4709.c0f488","type":"function","z":"29fa1e78.fbb392","name":"","func":"msg.payload = {}\nmsg.payload.status = {}\nreturn msg;","outputs":1,"noerr":0,"x":210,"y":440,"wires":[["8b79e804.fb7278","501477de.22e9f8"]]},{"id":"87abb1e4.bb917","type":"change","z":"29fa1e78.fbb392","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.on","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":617.6666870117188,"y":312.6666564941406,"wires":[["d8ccfb39.f7db48"]]},{"id":"8553cc37.9bf3","type":"change","z":"29fa1e78.fbb392","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.on","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":360,"wires":[["d8ccfb39.f7db48"]]},{"id":"4548f284.55d2dc","type":"hue-bridge","z":"","name":"Philips hue","bridge":"192.168.2.17","key":"wX1wOUeo3s1NE-V-PAE7OnVu9qqgm6SLJlSyaPLS","interval":"3000","disableupdates":false},{"id":"c1291da7.c2b5a","type":"openhab2-controller","z":"","name":"Openhab","protocol":"http","host":"192.168.2.27","port":"8080","path":"","username":"","password":""}]

The flow you posted is not really helpful to anyone who doesn't have all those nodes installed.

It is just frustrating.

Just after the Zonnecel buiten node, you have a function node. I am not quite getting why you have it doing what it is doing.

You also seem to be using a lot of change nodes. Don't those other nodes accept anything other than msg.payload?

You have a hue-group node that outputs a message and you change its output before sending it into a function node which could easily handle the original msg format.
Then you send it into another hue-group node.

I have redesigned the nodes and used functions instead of the change nodes to perform the tests i need.
Testing tonight to see whether it actually works

Thanks for the comments. I'll post the new flow if the tests works

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