Add Calendar Entity for Delivery Windows#58
Merged
Conversation
- Implement calendar platform with RohlikDeliveryCalendar entity
- Create events from orders in next_order (with delivery slots)
- Keep events for orders that move to delivered_orders
- Remove events only when orders disappear from both lists
- Add parse_orders_for_calendar helper function
- Add translations for calendar entity (en/cs)
- Update documentation in readme.md
- Entity ID format: calendar.{device_name}_orders
- Add RohlikDeliveryCalendar entity showing delivery windows as calendar events - Implement event property for current/next event - Implement async_get_events() for date range queries - Add parse_orders_for_calendar() utility function - Register calendar platform in __init__.py - Track events by order ID for proper lifecycle management
- Add RestoreEntity support to persist delivery slot information across restarts - Store delivery slot info when orders are in next_orders - Recreate events for delivered orders after restart using stored delivery slot info - Add [Delivered] tag to calendar event summary when order moves to delivered_orders - Display price in description even when amount is 0 - Update calendar entity name to 'Orders Calendar' in translations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a calendar entity that displays Rohlik.cz delivery windows as calendar events.
Closes #21
How It Works
Event Lifecycle:
/api/v3/orders/upcomingwith delivery slot info, a calendar event is created with the delivery window (start/end times)./api/v3/orders/delivered, the event is kept and tagged with[Delivered]in the summary.RestoreEntityto store delivery slot information.Technical Details:
RestoreEntityto persist delivery slot information (start/end times) in entity state attributesnext_orders(where delivery slots are available)delivered_ordersdoesn't include delivery slot data)[Delivered]when orders transition from upcoming to deliveredEntity Name: "Orders Calendar" (localized in English and Czech)
The calendar entity integrates with Home Assistant's calendar UI and can be used in automations to trigger during delivery windows.
Please let me know if you'd like any changes or enhancements to this implementation.