-
-
Notifications
You must be signed in to change notification settings - Fork 115
Description
Describe the bug
Problem:
The ha-events-calendar
node (ID: d7bb0e52b9d7c47a) in Node-RED, configured for calendar.work_sync
(Google Calendar sync), is intermittently missing events. Previously, it fired duplicate events for the same UID within a second (e.g., 12:22:00 PM CDT on 3/26/2025), but now some events don’t trigger at all.
I was able to repaste the flow that is shown below and it seems to be working again. But this is up and down, I am not sure if this is temporary or if this is going to work from here. I think there are bugs in here for it to detect the calendar event.
Home Assistant Version:
Core
2025.3.4
Supervisor
2025.03.3
Operating System
15.0
Frontend
20250306.0
Node-RED Version: [Your version, e.g., 4.0.9
Node Version: ha-events-calendar
beta (exact version unknown, assumed latest as of 3/27/2025)
Installation Type: Home Assistant Add-on
Actual Behavior:
Events don’t appear in the debug output (e.g., only "Test Event 1" triggers, "Test Event 2" and "3" are missed). Previously, duplicates occurred (e.g., two messages at 12:22:00 PM on 3/26/2025 for UID "XYZ@google.com").
To Reproduce
- Set up
ha-events-calendar
with:- Entity ID:
calendar.work_sync
(Google Calendar sync) - Event Type:
start
- Offset: 4 minutes
- Entity ID:
- Create multiple events in
calendar.work_sync
:- "Test Event 1": 3/27/2025, 12:00 PM CDT
- "Test Event 2": 3/27/2025, 12:05 PM CDT
- "Test Event 3": 3/27/2025, 12:10 PM CDT
- Add a debug node after the trigger.
- Wait for triggers at ~11:56 AM CDT.
Expected behavior
One message per event at the 4-minute offset (e.g., 11:56, 12:01, 12:06 PM CDT).
Screenshots
No response
Example Flow
[
{
"id": "8c62e4ebbed8cc82",
"type": "tab",
"label": "WORKING WORK NOTIFICATIONS Segment",
"disabled": false,
"info": "",
"env": []
},
{
"id": "4fcc6ba75dba3263",
"type": "ha-events-calendar",
"z": "8c62e4ebbed8cc82",
"name": "Event Notification Trigger",
"version": 0,
"server": "9e7df434.82fe88",
"exposeAsEntityConfig": "",
"entityId": "calendar.work_sync",
"filter": "",
"filterType": "str",
"eventType": "start",
"offset": "4",
"offsetType": "num",
"offsetUnits": "minutes",
"outputProperties": [
{
"property": "payload",
"propertyType": "msg",
"value": "",
"valueType": "calendarItem"
}
],
"x": 210,
"y": 160,
"wires": [
[
"be0a47cd6d474a16"
]
]
},
{
"id": "be0a47cd6d474a16",
"type": "change",
"z": "8c62e4ebbed8cc82",
"name": "Set Event UID",
"rules": [
{
"t": "set",
"p": "active_events",
"pt": "flow",
"to": "$append($flowContext('active_events', []), payload.uid)",
"tot": "jsonata"
},
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "payload.uid",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 500,
"y": 160,
"wires": [
[
"6ada5e5cd6019de3"
]
]
},
{
"id": "6ada5e5cd6019de3",
"type": "change",
"z": "8c62e4ebbed8cc82",
"name": "Store Events",
"rules": [
{
"t": "set",
"p": "events",
"pt": "flow",
"to": "$merge([$flowContext('events', {}), {payload.uid: payload}])",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 690,
"y": 160,
"wires": [
[
"00641f973ce9c097"
]
]
},
{
"id": "00641f973ce9c097",
"type": "function",
"z": "8c62e4ebbed8cc82",
"name": "Debounce 6 Hours",
"func": "const uid = msg.topic || msg.payload.uid;\nconst now = Date.now();\nconst lastSent = context.get('lastSent') || {};\nconst debouncePeriod = 6 * 60 * 60 * 1000; // 6 hours in milliseconds\n\nif (!uid) {\n node.warn('No UID found in message');\n return null;\n}\n\nif (!lastSent[uid] || (now - lastSent[uid] >= debouncePeriod)) {\n lastSent[uid] = now;\n context.set('lastSent', lastSent);\n return msg;\n} else {\n node.warn(`Message for UID ${uid} blocked - within 6-hour debounce`);\n return null;\n}",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 890,
"y": 160,
"wires": [
[
"972dbb8fdea234b5"
]
]
},
{
"id": "972dbb8fdea234b5",
"type": "api-call-service",
"z": "8c62e4ebbed8cc82",
"name": "Notify",
"server": "9e7df434.82fe88",
"version": 7,
"debugenabled": false,
"action": "notify.mobile_app_pixel_9",
"floorId": [],
"areaId": [],
"deviceId": [],
"entityId": [],
"labelId": [],
"data": "{\"title\":\"Upcoming Event\",\"message\":\"{{payload.summary}} is happening now\",\"data\":{\"summary\":\"{{payload.summary}}\",\"uid\":\"{{payload.uid}}\",\"actions\":[{\"action\":\"SNOOZE_15\",\"title\":\"Snooze 15 Min\"},{\"action\":\"SNOOZE_60\",\"title\":\"Snooze 1 Hour\"},{\"action\":\"DISMISS\",\"title\":\"Dismiss\"}]}}",
"dataType": "json",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"blockInputOverrides": false,
"domain": "notify",
"service": "mobile_app_pixel_9",
"x": 1060,
"y": 160,
"wires": [
[
"94fa065fba4dc2e0"
]
]
},
{
"id": "94fa065fba4dc2e0",
"type": "debug",
"z": "8c62e4ebbed8cc82",
"name": "Debug Active Events",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 1260,
"y": 160,
"wires": []
},
{
"id": "9e7df434.82fe88",
"type": "server",
"name": "Home Assistant",
"version": 5,
"addon": true,
"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
}
]
Environment Information
Running inside Home Assistant
Additional context
- Flow includes a 6-hour debounce downstream, but issue persists at the trigger level.
- Beta version note: "Config should be stable and hopefully not too many bugs."