Cronplus Sunset

BTW: With the offset correction, cronplus just output at the correct sunset time; so the offset works as a temporary fix.

I also got the suncalc output.

I do have another Windows 10 PC with Node-Red installed. I loaded the flow and got the same results; cronplus requires the offset to give the correct sunset/sunrise times.

Do you have any comment regarding the UTM anomaly I've discovered?

I've been following this thread and being on the US east coast I thought I'd play a bit to see what I got. Note, in @xytsrm flows I removed all but sunrise or sunset.
macOS: v13.6
node-red: v3.1.0
node.js: v18.12.1
node-red-contrib-cron-plus: v2.1.0

The one thing I noticed is that having a timezone with no location gives an odd result.

Here is the flow:

[{"id":"628065ccb8707425","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"6899ca4fa12d4416","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"America/Scoresbysund","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule3","topic":"topic3","payloadType":"str","payload":"cronplus Sunrise/Sunset","expressionType":"solar","expression":"0 * * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"sunrise"}],"x":100,"y":120,"wires":[[]]},{"id":"832f8b5683776813","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"","storeName":"file","commandResponseMsgOutput":"output2","defaultLocation":"40.39 -74.115","defaultLocationType":"fixed","outputs":2,"options":[{"name":"sunup","topic":"topic1","payloadType":"default","payload":"","expressionType":"solar","expression":"0 0 6 * * 1-5 *","location":"","offset":"0","solarType":"selected","solarEvents":"sunrise"}],"x":640,"y":120,"wires":[[],[]]},{"id":"d982f721a5acc6e4","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"","storeName":"file","commandResponseMsgOutput":"output2","defaultLocation":"40.39 -74.115","defaultLocationType":"fixed","outputs":2,"options":[{"name":"sunup","topic":"topic1","payloadType":"default","payload":"","expressionType":"solar","expression":"0 0 6 * * 1-5 *","location":"","offset":"0","solarType":"selected","solarEvents":"sunset"}],"x":640,"y":180,"wires":[[],[]]},{"id":"e2f2dbfad6dd2b71","type":"comment","z":"628065ccb8707425","name":"@xtytsrm flow - time zone: America/Scoresbysund, no location","info":"","x":260,"y":80,"wires":[]},{"id":"dc07d4ef777f7229","type":"comment","z":"628065ccb8707425","name":"@Steve_mcu flow - time zone: none, location: 2 decimal places","info":"","x":810,"y":80,"wires":[]},{"id":"2c6373423ec88a28","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"America/New_York","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"40.39052369411864 -74.11582946777342","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule3","topic":"topic3","payloadType":"str","payload":"cronplus Sunrise/Sunset","expressionType":"solar","expression":"0 * * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"sunrise"}],"x":100,"y":280,"wires":[[]]},{"id":"b28413486ace95f7","type":"comment","z":"628065ccb8707425","name":"@xtytsrm flow - time zone: America/New_York, location: 14 decimal places","info":"","x":300,"y":240,"wires":[]},{"id":"865d7ce0af60d092","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"40.39052369411864 -74.11582946777342","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule3","topic":"topic3","payloadType":"str","payload":"cronplus Sunrise/Sunset","expressionType":"solar","expression":"0 * * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"sunrise"}],"x":100,"y":440,"wires":[[]]},{"id":"063970f9f47db02b","type":"comment","z":"628065ccb8707425","name":"@xtytsrm flow -time zone: none, location: 14 decimal places","info":"","x":260,"y":400,"wires":[]},{"id":"ddb3a8658f425373","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"America/New_York","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"40.39052369411864 -74.11582946777342","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule3","topic":"topic3","payloadType":"str","payload":"cronplus Sunrise/Sunset","expressionType":"solar","expression":"0 * * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"sunset"}],"x":100,"y":340,"wires":[[]]},{"id":"314d30a56043fe95","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"America/Scoresbysund","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule3","topic":"topic3","payloadType":"str","payload":"cronplus Sunrise/Sunset","expressionType":"solar","expression":"0 * * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"sunset"}],"x":100,"y":180,"wires":[[]]},{"id":"9cabd9ab875a0e69","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"40.39052369411864 -74.11582946777342","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule3","topic":"topic3","payloadType":"str","payload":"cronplus Sunrise/Sunset","expressionType":"solar","expression":"0 * * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"sunset"}],"x":100,"y":500,"wires":[[]]},{"id":"de7c3db068bba591","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"America/New_York","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule3","topic":"topic3","payloadType":"str","payload":"cronplus Sunrise/Sunset","expressionType":"solar","expression":"0 * * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"sunrise"}],"x":580,"y":440,"wires":[[]]},{"id":"bc644485ac707652","type":"comment","z":"628065ccb8707425","name":"@xtytsrm flow - time zone: America/New_York, location: none","info":"","x":740,"y":400,"wires":[]},{"id":"7e173d9152d0046f","type":"cronplus","z":"628065ccb8707425","name":"","outputField":"payload","timeZone":"America/New_York","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"fixed","outputs":1,"options":[{"name":"schedule3","topic":"topic3","payloadType":"str","payload":"cronplus Sunrise/Sunset","expressionType":"solar","expression":"0 * * * * * *","location":"","offset":"0","solarType":"selected","solarEvents":"sunset"}],"x":580,"y":500,"wires":[[]]}]
1 Like

Hi zenofmud,

I copied your flows into a new flow and I'm getting the correct times; with the exception of the flow you noted. That is where I first discovered an issue. Curiously, your cronplus nodes and mine agree, even though mine have -1438 sec offsets; this is about 24hours. I made duplicates of my node, removing other schedules and creating separate nodes for sunset & sunrise. I even made a copy of those nodes into the flow where you nodes are located and removed the offsets. (In other words the offset doesn't seem to make a difference). At this time all the nodes agree; what I'm looking for is what happens as we approach sunset. When I initially created the original node (with sunset, sunrise and 2 fixed schedules at 8:30PM & 10:30PM); even though it was before sunset, the status showed the 8:30PM as next, and scheduled the sunset for the next day. The sunset should have been in the status, not the 8:30PM schedule.

Well, we will both be able to watch that (GRIN) Being a bit east of you I added a copy of your cronplus but added my location so sunset shows 1:34:55 EST which is 14 minutes before you.

There have been times when I've seen a node not work properly but adding a new version of it works correctly. I think this happens after a node-red update or maybe an updating the node. Something in the original configuration is wrong but a fresh copy clears it up.

That's a little scary. I've seen that happen in a very old software X10 Activehome Pro; deleting a module, then re-inserting gets it to works properly. Not sure whether it's the module, just re-downloading the Activehome flow is what really fixes the issue.

I have lost track of the thread. Is it all working correctly now?

Hi Colin,

First, note zenofmud anomaly; that's was the first issue I experienced and it's still the case.
The issue remaining is when I created schedules, prior to sunset, that included a fixed schedule at 8:30PM and a sunset schedule. When the cronplus node was deployed in it's status was the fixed schedule as next, not the sunset; the sunset was to be scheduled the next day.

I just re-created a cronplus node with a fixed & sunset schedule and this time it scheduled the sunset first as it should; go figure. However, the anomaly still exists.

UPDATE: Just made a change that failed; I put in the time-zone and removed the location, and got the wrong time for sunset; confirming that the anomaly still exists, same as zenofmud found. It seems despite what it says the location can't be optional. There does seem to be a problem; the time-zone should be sufficient, if not as precise.

BTW: I don't know why the schedule ordering issue has seemed to be resolved; it did exist. Maybe, as zenofmud suggested the node somehow got corrupted.

What anomaly? It isn't clear to me.

The location is required for solar events. That should be clearer in the config dialog.

Did you look at zenofmud's post?

This is the anomally: when you create a solar event schedule (sunrise/sunset) and only specify the time-zone, no location (optional). the status reports the wrong time for (in this case) sunrise; sunrise is not a 41 minutes after midnight.

cronplus sunrise

[
    {
        "id": "21827fec8ea78b8f",
        "type": "cronplus",
        "z": "5c6c548399542bca",
        "name": "",
        "outputField": "payload",
        "timeZone": "America/New_York",
        "storeName": "",
        "commandResponseMsgOutput": "output1",
        "defaultLocation": "",
        "defaultLocationType": "fixed",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "solar",
                "expression": "0 * * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "selected",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 140,
        "y": 2500,
        "wires": [
            []
        ]
    }
]

As I said,

You could submit an issue against the node suggesting the dialog and help text are improved. Even better, submit a pull request to fix it.

I believe the intent of the cronplus creator was that the time-zone would be sufficient for most solar events; hence location "optional". However, if more precision is required, specifying location will override the time-zone.

I've never submitted a "pull request"; how does one do it?

Don't worry about a pull request right now because I hit an issue, which I communicated to @Steve-Mcl and he is looking at it.

Ok, thanks for the feedback

In post #9 the author (steve-mcl) pointed out the location is necessary:

According to timeanddate.com:
Winnipeg (Canada) and Mexico City share a timezone (CST).
Sunrise today in Winnipeg was at 07:27 and in Mexico City at 06:40

The possible reason they may have found that location is required, is because of the flaw in the node where the time-zone alone is not using the proper UTM.

In any case it's being investigated:

It can't be the case.
The earth not being flat (I guess all -almost- agree on that), in the same timezone you can have VERY different sunrise.
Typically, at the moment, Svalbard (north of Norway) next sunrise is in a few weeks. Where in Gabon, it is around 6am tomorrow morning.
The sunrise will be roughly the same in these two places on the 21st of September and 21st of March, the two equinox days.

As the comment said

Use the location:

That's why a fixed location is optional:
Location Optional

In any case using only the time-zone should not give a 6 hour error.

I am not saying you are wrong. I am just stating the fact that the earth being a globe and not flat, time zone cannot be sufficient to get the correct sunrise/sunset...
The issue is with the "optional" in the Location field.
It is "optional" if you don't intend to use solar events in the schedule.
Otherwise, it is a MUST.