Turning on the lights when it gets dark

First of all, yes I searched no haven’t really found a solution.

So I got a device that measures luminance in our house. What I would like to do it that if the luminance is below a certain treshold, lights in the house are activated.

I have a trigger for when the state of the sensor changes, that triggers if luminance is below 10. And then lights are turned on.

However I don’t wanne keep on sending lights on commands tot the lights and I don’t want them to be on all night. So, I have a limiter that only allows 1 message to go though, and at 2 am all the lights are turned off.

But, that rate limiting doesn’t really work as I hoped.
Say day 1 a message is fired at 19hrs.
Day 2 a message can only be fire after 19hrs and if it takes 5 minutes before the state of the device changes the message will be sent at 19.05. µ
Day 3 message can only be sent after 19.05 and if it takes 5 minutes …
So, even though it’s getting darker earlier and earlier, the lights go on later and later …

So instead of resetting every 24hrs is there a way to reset every time at noon or someting (midnight wont work since it’s still dark then and it would fire immediately)

Use a trigger node set to “wait to be reset” and reset it at noon.

image

[{"id":"151144e629f3b4bf","type":"trigger","z":"c89d915bdff0f798","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":624,"y":64,"wires":[["9a84a14875151042"]]},{"id":"c952ccde6d484330","type":"inject","z":"c89d915bdff0f798","name":"luminance below 10","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":422,"y":64,"wires":[["151144e629f3b4bf"]]},{"id":"344b777a6bd0e7d0","type":"inject","z":"c89d915bdff0f798","name":"reset @noon","props":[{"p":"reset","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 12 * * *","once":false,"onceDelay":0.1,"topic":"","x":412,"y":112,"wires":[["151144e629f3b4bf"]]},{"id":"9a84a14875151042","type":"debug","z":"c89d915bdff0f798","name":"turn on lights","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":822,"y":64,"wires":[]}]