Hi there,
I have a pretty complex Alarm automation, that I recently moved to Node-Red. Unfortunately still one thing isn’t working properly. I have a snooze Timer that starts automatically for 5 minutes after my alarm went off. When it hits zero, it checks, if I’m still in bed. If yes, then the alarm will go off again and set another snooze timer for 2 minutes.
So far so good, one part of my node-red config does this and when I trigger it from an inject node, it always returns the correct state of my bed sensor (on/off) and triggers the correct flow from there.
But when It is triggered by the snooze-timer beeing finished, it returns “idle” and goes into the wrong subflow, even tho the bed-sensor is turned on.
Here is my config (only the three relevant nodes)
Node Red nodes
[ { "id": "77f3608737bc010d", "type": "ha-wait-until", "z": "b36d85d6f3e2e685", "g": "3527342b0efe0bb0", "name": "", "server": "537b95bd.f4511c", "version": 2, "outputs": 1, "entityId": "binary_sensor.bed_sensor", "entityIdFilterType": "exact", "property": "state", "comparator": "is", "value": "off", "valueType": "str", "timeout": "0", "timeoutType": "num", "timeoutUnits": "seconds", "checkCurrentState": true, "blockInputOverrides": true, "outputProperties": [], "entityLocation": "data", "entityLocationType": "none", "x": 820, "y": 1900, "wires": [ [ "2b01bfc0ed8abe95" ] ] }, { "id": "0fae20e05999aacc", "type": "api-current-state", "z": "b36d85d6f3e2e685", "g": "209581c4fc0614bb", "name": "Noch im Bett?", "server": "537b95bd.f4511c", "version": 3, "outputs": 2, "halt_if": "on", "halt_if_type": "str", "halt_if_compare": "is", "entity_id": "binary_sensor.bed_sensor", "state_type": "str", "blockInputOverrides": false, "outputProperties": [ { "property": "status", "propertyType": "msg", "value": "", "valueType": "entityState" }, { "property": "data", "propertyType": "msg", "value": "", "valueType": "entity" } ], "for": "0", "forType": "num", "forUnits": "minutes", "override_topic": false, "state_location": "payload", "override_payload": "msg", "entity_location": "data", "override_data": "msg", "x": 560, "y": 1900, "wires": [ [ "1ee0fb96ba7fc0c2", "aa544be0acf9c111" ], [ "77f3608737bc010d" ] ] }, { "id": "ecbd731365cd3483", "type": "inject", "z": "b36d85d6f3e2e685", "g": "209581c4fc0614bb", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 340, "y": 1860, "wires": [ [ "0fae20e05999aacc" ] ] }, { "id": "67fdd7e8d7be5e08", "type": "switch", "z": "b36d85d6f3e2e685", "g": "209581c4fc0614bb", "name": "Snooze Timer?", "property": "payload.entity_id", "propertyType": "msg", "rules": [ { "t": "eq", "v": "timer.snoozetimer", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 320, "y": 1900, "wires": [ [ "0fae20e05999aacc", "a1a912386a6211ed" ] ] }, { "id": "270f5078f7a09509", "type": "server-events", "z": "b36d85d6f3e2e685", "g": "209581c4fc0614bb", "name": "Timer Ende", "server": "537b95bd.f4511c", "version": 3, "exposeAsEntityConfig": "", "eventType": "timer.finished", "eventData": "", "waitForRunning": true, "outputProperties": [ { "property": "payload", "propertyType": "msg", "value": "", "valueType": "eventData" }, { "property": "topic", "propertyType": "msg", "value": "$outputData(\"eventData\").event_type", "valueType": "jsonata" } ], "x": 110, "y": 1800, "wires": [ [ "ced8c1c2e14a2158", "67fdd7e8d7be5e08" ] ] }, { "id": "537b95bd.f4511c", "type": "server", "name": "Home Assistant", "addon": true, "rejectUnauthorizedCerts": true, "ha_boolean": "", "connectionDelay": false, "cacheJson": false, "heartbeat": false, "heartbeatInterval": "", "statusSeparator": "", "enableGlobalContextStore": false } ]
Here’s the debug. First one, when it is triggered by the timer, second, when triggered by an inject node.
How can the state node return “on” or “off” when it is triggered by the timer? Thanks a lot!