Sunset Node Red -- New to node red

Hello All,

I have been trying, searching and watching videos and have finally come here hoping for a solution. This is my first node red automation, so I am sure I am doing something wrong…

The flow works when the Garage (MyQ) is “opening” it then checks if the light is on. If it is OFF it goes to check if it is sunset. Here lies the problem regardless if it is sunrise or sunset the light still turns on. I have tried big timer and EZ_timer but was drawn to sun-position by its simplicity. Both big timer and EZ timer were way too sophisticated for me and I tried but had the same issue. If the light is off and it is sunset only then do I want the light to come on – please help

[
    {
        "id": "10e23d0b.3b9e13",
        "type": "tab",
        "label": "FLW_Garage_Door_Open",
        "disabled": false,
        "info": ""
    },
    {
        "id": "525e1408.8c040c",
        "type": "api-call-service",
        "z": "10e23d0b.3b9e13",
        "name": "Garage_Light_on",
        "server": "a87b4492.0f94a8",
        "version": 3,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_on",
        "entityId": "switch.garage_light_switch",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 790,
        "y": 300,
        "wires": [
            [
                "499be192.b29fa"
            ]
        ]
    },
    {
        "id": "8a23256f.c04d48",
        "type": "server-state-changed",
        "z": "10e23d0b.3b9e13",
        "name": "Garage_Door",
        "server": "a87b4492.0f94a8",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "cover.garage_door_opener",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "opening",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": 0,
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 130,
        "y": 220,
        "wires": [
            [
                "aa1a5a4c.5a5128"
            ],
            []
        ]
    },
    {
        "id": "499be192.b29fa",
        "type": "delay",
        "z": "10e23d0b.3b9e13",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "minutes",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 960,
        "y": 260,
        "wires": [
            [
                "18afce5c.22d3d2"
            ]
        ]
    },
    {
        "id": "18afce5c.22d3d2",
        "type": "api-call-service",
        "z": "10e23d0b.3b9e13",
        "name": "Garage_Light_off",
        "server": "a87b4492.0f94a8",
        "version": 3,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_off",
        "entityId": "switch.garage_light_switch",
        "data": "",
        "dataType": "jsonata",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1150,
        "y": 260,
        "wires": [
            []
        ]
    },
    {
        "id": "aa1a5a4c.5a5128",
        "type": "api-current-state",
        "z": "10e23d0b.3b9e13",
        "name": "Garage_Light_State",
        "server": "a87b4492.0f94a8",
        "version": 2,
        "outputs": 2,
        "halt_if": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "switch.garage_light_switch",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 360,
        "y": 300,
        "wires": [
            [
                "f5dc56f.408d1a8"
            ],
            []
        ]
    },
    {
        "id": "f5dc56f.408d1a8",
        "type": "sun-position",
        "z": "10e23d0b.3b9e13",
        "name": "Sunset",
        "positionConfig": "1d7ab614.ed95ca",
        "rules": [],
        "onlyOnChange": "true",
        "topic": "",
        "outputs": 1,
        "start": "rise",
        "startType": "pdmTime",
        "startOffset": 0,
        "startOffsetType": "num",
        "startOffsetMultiplier": 60000,
        "end": "astronomicalDawn",
        "endType": "pdsTime",
        "endOffset": "1",
        "endOffsetType": "num",
        "endOffsetMultiplier": 60000,
        "x": 560,
        "y": 300,
        "wires": [
            [
                "525e1408.8c040c",
                "2d382e1c.e73d02"
            ]
        ]
    },
    {
        "id": "3418adfa.51e742",
        "type": "inject",
        "z": "10e23d0b.3b9e13",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "opening",
        "payloadType": "str",
        "x": 150,
        "y": 340,
        "wires": [
            [
                "aa1a5a4c.5a5128"
            ]
        ]
    },
    {
        "id": "2d382e1c.e73d02",
        "type": "debug",
        "z": "10e23d0b.3b9e13",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 770,
        "y": 240,
        "wires": []
    },
    {
        "id": "a87b4492.0f94a8",
        "type": "server",
        "name": "Home Assistant",
        "version": 1,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true
    },
    {
        "id": "1d7ab614.ed95ca",
        "type": "position-config",
        "name": "Sett",
        "isValide": "true",
        "longitude": "0",
        "latitude": "0",
        "angleType": "deg",
        "timeZoneOffset": "99",
        "timeZoneDST": "0",
        "stateTimeFormat": "3",
        "stateDateFormat": "12"
    }
]

I use one of 2 options either sun.sun in a HA current state node

or time range, under the function heading in the node list.

I’m sure there a others but these are the ones I use.

Thank you Mike I used the time-range node. So many options it can be overwhelming but also introduce choice. Using debug and inject it seems to be working.

Appreciate the help

Hello.

This is beacouse the call service node react on any massage on input, you need to use switch node and redirect the day/night to seperate otputs.
Regards.

Thanks I did try a switch node with bigtimer but never did with this node.