-
Notifications
You must be signed in to change notification settings - Fork 3.4k
calendar card/panel - add automatic 5 minute refresh #27565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
calendar card/panel - add automatic 5 minute refresh #27565
Conversation
|
I was wrong, I didn't realize there was no subscription for calendar events 😕 |
|
@karwosts I've been running HA on an ipad mounted to my fridge as a "kiosk". It is always on. As such, the calendar card never refreshes. I have to either manually interact with it, or switch views and return to the view w/ the card to get it to update. It doesn't appear to have dynamic updates that I was able to find. |
|
Looks like the calendar is not event based (ironically) and just fetches everything on start. It would be better if core would send an event to frontend when the calendar data is updated but I haven't looked into that |
|
Looks like there is no "calendar updated" event but core does fire "state_changed" on the calendar entities when they change so we can check that the entity state changed in |
I don't think that's always correct. The state_changed will fire if the state or any of the attributes change, such as if you add an event that is the next event. But if you add a new event that does not cause any of the attributes to change (e.g. one that is not the next event), I don't see any events on the bus. I guess we need to add a subscription like the |
Implements real-time event updates for calendar entities via websocket subscription, following the pattern established by Todo and Weather entities. This eliminates the need for polling in the frontend by providing a calendar/event/subscribe websocket command that pushes event updates whenever calendar state changes. Changes: - Add async_subscribe_events() to CalendarEntity for websocket subscriptions - Add async_update_event_listeners() to notify subscribers on state changes - Override _async_write_ha_state() to trigger automatic listener updates - Implement calendar/event/subscribe websocket command with start/end date range - Add comprehensive tests for subscription functionality Benefits: - Real-time updates when events are added/modified/deleted - Efficient resource usage (no polling required) - Consistent with existing Todo/Weather subscription patterns - Works automatically for all calendar integrations Addresses the root cause of the polling workaround in home-assistant/frontend#27565
Replace polling-based calendar event fetching with real-time websocket subscriptions. This leverages the new subscription API added in core to provide automatic updates when calendar events change, eliminating the need for periodic polling. The subscription pattern follows the same approach used for todo items, with proper lifecycle management and cleanup. Related: home-assistant/core#156340 Related: #27565 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Closing this in favor of #27906 |
Proposed change
Adds a hard-coded 5 minute refresh to the calendar card & panel. This is useful when running HA on an ipad as a kiosk (e.g. long running, minimal user interaction).
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: