Events: state with for condition does not trigger at startup

I use an events: state node with a "for X minutes" condition to detect if the the value of a binary sensor has not flipped for at least X minutes.
Works normally fine except that if I restart nodered, there is no state change in my binary sensor and therefore events:state never triggers.
What could I do to workaround this? One idea is to flip back and forth my binary sensor at startup but that feels hacky.


[
    {
        "id": "5ca2060992b85578",
        "type": "server-state-changed",
        "z": "fd346cefa9967d42",
        "name": "A room is abandoned if unoccupied for 30 minutes",
        "server": "5911c68b.bbc568",
        "version": 4,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "${PRESENCE_SENSOR}",
        "entityidfiltertype": "exact",
        "outputinitially": true,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "30",
        "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": 270,
        "y": 160,
        "wires": [
            [
                "d91c1fcebfab197d",
                "c30677e4d1ed6c19"
            ],
            []
        ]
    },
    {
        "id": "5911c68b.bbc568",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": false,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": "at: ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "h23",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": true
    }
]

Seeing that that is a Home Assistant node, you might be better off asking on Home Assistant's forum

1 Like

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