End time before start time

Hi!
I noticed that NodeRed (at Home Assistant) cannot handle situations where the end time (sunrise) is before the start time (08:00).
I have this action, that turns the light on at 08:00 in the morning (at the weekend) and it should turn off when the sun rises. Except that this time year sunrise is already earlier than 08:00 here in (southern part ) Finland.
The result is that the light turns on at some "random" point (last night it was 00:22) and doesn't turn off.

[
    {
        "id": "c8f0286fdafd5b58",
        "type": "bigtimer",
        "z": "891bddf014e1f6cc",
        "outtopic": "zigbee2mqtt/Kukkavalo/set",
        "outpayload1": "{\"state\":\"ON\"}",
        "outpayload2": "{\"state\":\"OFF\"}",
        "name": "Kukkavalo vkl",
        "comment": "Valo päälle viikonloppuna",
        "lat": "60.0",
        "lon": "25.0",
        "starttime": "1439",
        "endtime": "1320",
        "starttime2": "480",
        "endtime2": "5003",
        "startoff": "0",
        "endoff": "0",
        "startoff2": 0,
        "endoff2": "5",
        "offs": 0,
        "outtext1": "",
        "outtext2": "",
        "timeout": "60",
        "sun": true,
        "mon": false,
        "tue": false,
        "wed": false,
        "thu": false,
        "fri": false,
        "sat": true,
        "jan": true,
        "feb": true,
        "mar": false,
        "apr": false,
        "may": false,
        "jun": false,
        "jul": false,
        "aug": false,
        "sep": false,
        "oct": false,
        "nov": true,
        "dec": true,
        "day1": 0,
        "month1": 0,
        "day2": 0,
        "month2": 0,
        "day3": 0,
        "month3": 0,
        "day4": 0,
        "month4": 0,
        "day5": 0,
        "month5": 0,
        "day6": 0,
        "month6": 0,
        "day7": "",
        "month7": "",
        "day8": "",
        "month8": "",
        "day9": "",
        "month9": "",
        "day10": "",
        "month10": "",
        "day11": "",
        "month11": "",
        "day12": "",
        "month12": "",
        "d1": "",
        "w1": "",
        "d2": 0,
        "w2": 0,
        "d3": 0,
        "w3": 0,
        "d4": 0,
        "w4": 0,
        "d5": 0,
        "w5": 0,
        "d6": 0,
        "w6": 0,
        "xday1": "",
        "xmonth1": "",
        "xday2": 0,
        "xmonth2": 0,
        "xday3": 0,
        "xmonth3": 0,
        "xday4": 0,
        "xmonth4": 0,
        "xday5": 0,
        "xmonth5": 0,
        "xday6": 0,
        "xmonth6": 0,
        "xday7": "",
        "xmonth7": "",
        "xday8": "",
        "xmonth8": "",
        "xday9": "",
        "xmonth9": "",
        "xday10": "",
        "xmonth10": "",
        "xday11": "",
        "xmonth11": "",
        "xday12": "",
        "xmonth12": "",
        "xd1": 0,
        "xw1": 0,
        "xd2": 0,
        "xw2": 0,
        "xd3": 0,
        "xw3": 0,
        "xd4": 0,
        "xw4": 0,
        "xd5": 0,
        "xw5": 0,
        "xd6": 0,
        "xw6": 0,
        "suspend": false,
        "random": false,
        "randon1": false,
        "randoff1": false,
        "randon2": false,
        "randoff2": false,
        "repeat": true,
        "atstart": true,
        "odd": false,
        "even": false,
        "x": 400,
        "y": 1660,
        "wires": [
            [],
            [],
            []
        ]
    }
]

Many of the nodes that offer actions based on solar activity struggle to do the right thing when far north or far south at certain times of the year.

I spent far too much time figuring this out when I developed node-red-contrib-cron-plus. You may want to give that node a try instead. For example, in cron-plus, each message has additional info including the solar state. So, for example, you could use a switch node to check to see the solar phase is "day" and throw away that 8am message.

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