Use cron-plus to get tomorrow's sunrise and sunset?

I'm feeding cron-plus this:

msg.payload = {
    "command": "describe",
    "expressionType": "solar",
    "location": "51.5100087,-2.5644624",
    "time": "2022-09-27 12:00",
    "solarType": "selected",
    "solarEvents": "sunrise,sunset",
    "timeZone": "Europe/London"
}

I was expecting to get tomorrow's (the hard-coded time) sunrise and sunset, but I am still getting the next sunset (today's) and sunrise (tomorrow's).

What am I doing wrong please?

(An alternative would be to get today's sunrise and sunset as they'll be near enough for my purposes but unless I call cron-plus before sunrise I still get the same output.)

That is unexpected (assuming the time you used was after the sunset time returned)

Can you use a debug set to show the complete message coming out? Use the copy value button to grab the result & show us.

Also, try setting the time later than the last event (e.g. "time": "2022-09-27 23:59") if it was not already

I am not at a computer for a couple of days so cannot help more than ask you to try things..

1 Like

Here's the output (without changing the time):

{"command":{"command":"describe","expressionType":"solar","location":"51.5100087,-2.5644624","time":"2022-09-27 12:00","solarType":"selected","solarEvents":"sunrise,sunset","timeZone":"Europe/London","name":"schedule1","topic":"schedule1","payloadType":"default"},"result":{"solarState":{"direction":"rise","state":"Day","day":true,"night":false,"astrologicalTwilight":false,"nauticalTwilight":false,"civilTwilight":false,"goldenHour":false,"twilight":false,"morningTwilight":false,"eveningTwilight":false,"dawn":false,"dusk":false,"morningGoldenHour":false,"eveningGoldenHour":false},"nextEvent":"sunset","nextEventTime":"2022-09-27T17:59:58.580Z","nextEventTimeOffset":"2022-09-27T17:59:58.580Z","eventTimes":[{"event":"sunset","time":"2022-09-27T17:59:58.580Z","timeOffset":"2022-09-27T17:59:58.580Z"},{"event":"sunrise","time":"2022-09-28T06:06:49.960Z","timeOffset":"2022-09-28T06:06:49.960Z"}],"offset":0,"now":"2022-09-27T11:00:00.000Z","nowOffset":"2022-09-27T11:00:00.000Z","description":"Solar Events: 'sunrise, sunset'","nextDate":"2022-09-27T17:59:58.580Z","prettyNext":"sunset in 6 hours 59 minutes 58 seconds"}}

Setting time to 23:59 does give the expected result, so I can work with that:

{"command":{"command":"describe","expressionType":"solar","location":"51.5100087,-2.5644624","time":"2022-09-27 23:59","solarType":"selected","solarEvents":"sunrise,sunset","timeZone":"Europe/London","name":"schedule1","topic":"schedule1","payloadType":"default"},"result":{"solarState":{"direction":"fall","state":"Night","day":false,"night":true,"astrologicalTwilight":false,"nauticalTwilight":false,"civilTwilight":false,"goldenHour":false,"twilight":false,"morningTwilight":false,"eveningTwilight":false,"dawn":false,"dusk":false,"morningGoldenHour":false,"eveningGoldenHour":false},"nextEvent":"sunrise","nextEventTime":"2022-09-28T06:06:49.960Z","nextEventTimeOffset":"2022-09-28T06:06:49.960Z","eventTimes":[{"event":"sunrise","time":"2022-09-28T06:06:49.960Z","timeOffset":"2022-09-28T06:06:49.960Z"},{"event":"sunset","time":"2022-09-28T17:57:39.954Z","timeOffset":"2022-09-28T17:57:39.954Z"}],"offset":0,"now":"2022-09-27T22:59:00.000Z","nowOffset":"2022-09-27T22:59:00.000Z","description":"Solar Events: 'sunrise, sunset'","nextDate":"2022-09-28T06:06:49.960Z","prettyNext":"sunrise in 7 hours 7 minutes 49 seconds"}}

Thank you!

1 Like

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