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
}
]