CRON+ Question: Turn lamp on at fixed time unless sunrise has happened

Hi all, quick question for the brains in the forum :grin:

I have a lamp that I want to turn on at a fixed time in the morning but ONLY if sunrise has not already happened. The lamp is turned off based on sunrise so obviously, if sunrise is before the the on time, the lamp would come on and not be turned off.

While I can think of a couple of ways to achieve this, they all seem a bit complex so the question is - what is the simplest method?

Thanks all.

One way...

[{"id":"87f2e728.b0f2b8","type":"cronplus","z":"50866d2.d5b4b94","name":"at 6am","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"morning","payloadType":"json","payload":"{\"command\":\"describe\",\"expressionType\":\"solar\",\"location\":\"54.9992500,-1.4170300\",\"solarType\":\"selected\",\"solarEvents\":\"sunrise\",\"timeZone\":\"Europe/London\"}","expressionType":"cron","expression":"0 0 6 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":490,"y":340,"wires":[["1ed3b3b6.124ecc"]]},{"id":"1ed3b3b6.124ecc","type":"cronplus","z":"50866d2.d5b4b94","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[],"x":740,"y":340,"wires":[["5e4e408f.71d81"]]},{"id":"e6e3dc17.ed21e","type":"debug","z":"50866d2.d5b4b94","name":"it is 6am and sunrise has passed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1160,"y":320,"wires":[]},{"id":"5e4e408f.71d81","type":"switch","z":"50866d2.d5b4b94","name":"is day?","property":"payload.result.solarState.day","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":900,"y":340,"wires":[["e6e3dc17.ed21e"],["a6e4017a.2bf3a"]]},{"id":"a6e4017a.2bf3a","type":"debug","z":"50866d2.d5b4b94","name":"it is 6am and sunrise is yet to happen","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1170,"y":360,"wires":[]}]

the interesting part happens in the payload of the first cron node

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