Skip to content

Pull Request: Enhanced Schedule Viewing and Calendar Card Documentation#19

Open
nowjon wants to merge 5 commits into
corporategoth:mainfrom
nowjon:main
Open

Pull Request: Enhanced Schedule Viewing and Calendar Card Documentation#19
nowjon wants to merge 5 commits into
corporategoth:mainfrom
nowjon:main

Conversation

@nowjon

@nowjon nowjon commented Nov 22, 2025

Copy link
Copy Markdown

WARNING

This was vibe-coded with Claude. I am no developer but wanted to add being able to view the schedule from Home Assistant :)

Summary

This PR enhances the Power Pet Door integration with improved schedule viewing capabilities, a new service for programmatic schedule updates, and comprehensive documentation including a visual calendar card.

Changes

1. Enhanced Schedule Viewing

  • Added human-readable schedule_entries attribute showing formatted schedule times (e.g., "Mon, Wed, Fri: 06:00-20:00")
  • Added schedule_count attribute displaying the number of active schedule entries
  • Enhanced extra_state_attributes to provide a clear summary of active schedules
  • Added comprehensive logging for schedule operations

2. New Service for Schedule Updates

  • Added powerpetdoor.update_schedule service for programmatic schedule updates
  • Service accepts Home Assistant schedule format and syncs changes to the device
  • Includes validation and error handling
  • Full documentation with examples for service usage

3. Schedule Export and Backup

  • Automatic schedule export to JSON files with timestamps
  • Automatic cleanup keeping only the 5 most recent export files
  • Export location: {HA_CONFIG_DIR}/powerpetdoor/exports/

4. Bug Fixes

  • Fixed bug in async_update_config where self.coordinator.data.items() was incorrectly used on a list
  • Added proper filtering for disabled schedule entries
  • Enhanced error handling throughout schedule operations

5. Documentation Enhancements

  • Added comprehensive "Viewing and Editing Schedules" section with 4 viewing methods
  • Added service documentation with examples
  • Added Schedule Calendar View Card documentation with:
    • Installation instructions for HTML Jinja2 Template card
    • Complete card configuration with color-coded weekly calendar view
    • Visual screenshot showing the calendar layout
    • Customization options

Files Changed

  • custom_components/powerpetdoor/schedule.py - Enhanced schedule entity with attributes, service handler, and export functionality
  • custom_components/powerpetdoor/const.py - Added service-related constants
  • custom_components/powerpetdoor/__init__.py - Integrated service setup
  • README.md - Added comprehensive schedule viewing/editing documentation and calendar card example
  • images/PedDoorSchedule.png - Added screenshot of the schedule calendar card

Testing

  • Schedule entities display correctly with human-readable attributes
  • Service updates schedules and syncs to device
  • Schedule exports are created and cleaned up properly
  • Calendar card displays both inside and outside schedules correctly

Breaking Changes

None - all changes are backward compatible.

Related Issues

This PR addresses the need for better schedule visibility and management within Home Assistant.

…ling

- Enable schedule entities by default (changed disabled: True to False)
- Fix critical bug: change .items() to direct iteration on coordinator.data
- Add validation helper function for schedule entries
- Add schedule export to file functionality with automatic cleanup (keeps 5 most recent)
- Add filtering for disabled schedule entries
- Add comprehensive logging throughout schedule operations
- Add error handling for individual schedule fetches and sync operations
- Improve data processing with validation and error recovery
- Add human-readable schedule attributes (schedule_entries, schedule_count)
- Add powerpetdoor.update_schedule service for programmatic schedule updates
- Enhance extra_state_attributes with formatted schedule information
- Add comprehensive documentation for viewing and editing schedules
- Update README with viewing methods, editing examples, and service documentation
- Add comprehensive documentation for schedule calendar card
- Include installation instructions for HTML Jinja2 Template card
- Provide full card configuration with color-coded weekly calendar view
- Document features, customization options, and prerequisites
@corporategoth

Copy link
Copy Markdown
Owner

Thanks for submitting this! I will review it when I have time, so I can understand what it's doing.

@corporategoth

Copy link
Copy Markdown
Owner

@nowjon I am going to close this PR, as I took it and ran with it to update it even further with more changes.
I will, of course, give you credit for those changes. But did you want to try out the changes on the main branch? This gave me the impetus I needed to actually get AI to help me fix the scheduling issue. For a long time I wanted to use the native scheduling capabilities in HA.
Instead I have essentially mimic'd them (they provide things like the ability to have multiple on/off times in a day). And created a lovelace card that will be installed with the integration to do scheduling, so the user doesn't have to do anything more than use a lovelace card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants