bruxy70 / Garbage-Collection

🗑 Custom Home Assistant sensor for scheduling garbage collection (or other regularly re-occurring events - weekly on given days, semi-weekly or monthly)
MIT License
382 stars 90 forks source link

Breaking Change? Recent Update Completely Breaks HA #405

Closed Colorado4Wheeler closed 2 years ago

Colorado4Wheeler commented 2 years ago

Before you submit a new bug report, please check that

Describe the bug

After the latest update I'm unable to get anything to save to HA. New devices won't save, changes to integrations won't save, nothing. As soon as you reboot it all goes away. I saw recurring logs outlying the problem:

Logger: homeassistant.util.json
Source: util/json.py:62 
First occurred: 4:32:44 PM (8 occurrences) 
Last logged: 4:56:42 PM

Failed to serialize to JSON: /config/.storage/core.config_entries. Bad data at $.data.entries[66].data.first_date=2022-01-18(<class 'datetime.date'>, $.data.entries[67].data.first_date=2022-04-12(<class 'datetime.date'>, $.data.entries[69].data.first_date=2022-01-19(<class 'datetime.date'>, $.data.entries[70].data.first_date=2022-04-13(<class 'datetime.date'>

After grepping every file in HA for "first_date" (not having remembered this was a parameter when I set this add-on up ages ago), the garbage collection configuration was not only the only file with any of the dates, it was the file with ALL of the dates.

I'm guessing there was a change to the configuration somewhere down the line that I didn't notice that requires me to change my config so these errors don't come up, hopefully you'll see a blaring problem in my config that points to the issue.

I do see I have a depreciated config when viewing the debug logs, but the add-on seems to be handling that fine and it doesn't seem to have anything to do with the above error (however I'll fix it anyway).

Configuration

---
# Sets calendar entries for scheduled events.
#
# https://github.com/bruxy70/Garbage-Collection

garbage_collection:
  sensors:
    # --------------------------------------
    # TRASH REMINDER DAY
    # Used in automation to remind the
    # evening before
    # --------------------------------------
    - name: "Trash Reminder" # Weekly Thursday trash pickup
      frequency: "weekly"
      collection_days: "tue"
      #expire_after: '12:00'
      move_country_holidays: US
      holiday_in_week_move: true

    - name: "Recycling Reminder" # Bi-weekly recycle pickup
      frequency: "every-n-days"
      period: 14
      first_date: "2022-01-18"
      move_country_holidays: US
      holiday_in_week_move: true

    - name: "Overflow Reminder" # Every 8 week overflow pickup
      frequency: "every-n-days"
      period: 56
      first_date: "2022-04-12"
      move_country_holidays: US
      holiday_in_week_move: true

    # --------------------------------------
    # TRASH DAY
    # Used in automation to remind the
    # day of upon house waking up
    # --------------------------------------
    - name: "Trash" # Weekly Thursday trash pickup
      frequency: "weekly"
      collection_days: "wed"
      expire_after: "12:00"
      move_country_holidays: US
      holiday_in_week_move: true
      #exclude_dates:
      #- '2019-12-25'
      #include_dates:
      #- '2019-12-27'

    - name: "Recycling" # Bi-weekly recycle pickup
      frequency: "every-n-days"
      period: 14
      first_date: "2022-01-19"
      move_country_holidays: US
      holiday_in_week_move: true
      #last_month: "nov"
      #collection_days: "thu"

    - name: "Overflow" # Every 8 week overflow pickup
      frequency: "every-n-days"
      period: 56
      first_date: "2022-04-13"
      move_country_holidays: US
      holiday_in_week_move: true
      #last_month: "nov"
      #collection_days: "thu"

    # --------------------------------------
    # STREET SWEEPING
    # --------------------------------------
    - name: "Street Sweeping" # 4th wednesday of the month
      frequency: "monthly"
      weekday_order_number: 4
      collection_days: "wed"
      move_country_holidays: US
      holiday_in_week_move: true

### Debug logs

/Volumes/config/home-assistant.log:345: 2022-06-13 17:38:20 DEBUG (MainThread) [custom_components.garbage_collection] Importing Trash Reminder(weekly) from YAML configuration /Volumes/config/home-assistant.log:346: 2022-06-13 17:38:20 DEBUG (MainThread) [custom_components.garbage_collection] Importing Recycling Reminder(every-n-days) from YAML configuration /Volumes/config/home-assistant.log:347: 2022-06-13 17:38:20 DEBUG (MainThread) [custom_components.garbage_collection] Importing Overflow Reminder(every-n-days) from YAML configuration /Volumes/config/home-assistant.log:348: 2022-06-13 17:38:20 DEBUG (MainThread) [custom_components.garbage_collection] Importing Trash(weekly) from YAML configuration /Volumes/config/home-assistant.log:349: 2022-06-13 17:38:20 DEBUG (MainThread) [custom_components.garbage_collection] Importing Recycling(every-n-days) from YAML configuration /Volumes/config/home-assistant.log:350: 2022-06-13 17:38:20 DEBUG (MainThread) [custom_components.garbage_collection] Importing Overflow(every-n-days) from YAML configuration /Volumes/config/home-assistant.log:351: 2022-06-13 17:38:20 DEBUG (MainThread) [custom_components.garbage_collection] Importing Street Sweeping(monthly) from YAML configuration /Volumes/config/home-assistant.log:395: 2022-06-13 17:38:21 INFO (MainThread) [custom_components.garbage_collection.config_flow] Importing config for OrderedDict([('name', 'Trash Reminder'), ('frequency', 'weekly'), ('collection_days', ['tue']), ('move_country_holidays', 'US'), ('holiday_in_week_move', True)]) /Volumes/config/home-assistant.log:396: 2022-06-13 17:38:21 ERROR (MainThread) [custom_components.garbage_collection.config_flow] Removed obsolete config values: {'move_country_holidays': 'US', 'holiday_in_week_move': True}. Please check the documentation how to configure the functionality. /Volumes/config/home-assistant.log:397: 2022-06-13 17:38:21 INFO (MainThread) [custom_components.garbage_collection.config_flow] Importing config for OrderedDict([('name', 'Recycling Reminder'), ('frequency', 'every-n-days'), ('period', 14), ('first_date', datetime.date(2022, 1, 18)), ('move_country_holidays', 'US'), ('holiday_in_week_move', True)]) /Volumes/config/home-assistant.log:398: 2022-06-13 17:38:21 ERROR (MainThread) [custom_components.garbage_collection.config_flow] Removed obsolete config values: {'move_country_holidays': 'US', 'holiday_in_week_move': True}. Please check the documentation how to configure the functionality. /Volumes/config/home-assistant.log:399: 2022-06-13 17:38:21 INFO (MainThread) [custom_components.garbage_collection.config_flow] Importing config for OrderedDict([('name', 'Overflow Reminder'), ('frequency', 'every-n-days'), ('period', 56), ('first_date', datetime.date(2022, 4, 12)), ('move_country_holidays', 'US'), ('holiday_in_week_move', True)]) /Volumes/config/home-assistant.log:400: 2022-06-13 17:38:21 ERROR (MainThread) [custom_components.garbage_collection.config_flow] Removed obsolete config values: {'move_country_holidays': 'US', 'holiday_in_week_move': True}. Please check the documentation how to configure the functionality. /Volumes/config/home-assistant.log:401: 2022-06-13 17:38:21 INFO (MainThread) [custom_components.garbage_collection.config_flow] Importing config for OrderedDict([('name', 'Trash'), ('frequency', 'weekly'), ('collection_days', ['wed']), ('expire_after', '12:00'), ('move_country_holidays', 'US'), ('holiday_in_week_move', True)]) /Volumes/config/home-assistant.log:402: 2022-06-13 17:38:21 ERROR (MainThread) [custom_components.garbage_collection.config_flow] Removed obsolete config values: {'move_country_holidays': 'US', 'holiday_in_week_move': True}. Please check the documentation how to configure the functionality. /Volumes/config/home-assistant.log:403: 2022-06-13 17:38:21 INFO (MainThread) [custom_components.garbage_collection.config_flow] Importing config for OrderedDict([('name', 'Recycling'), ('frequency', 'every-n-days'), ('period', 14), ('first_date', datetime.date(2022, 1, 19)), ('move_country_holidays', 'US'), ('holiday_in_week_move', True)]) /Volumes/config/home-assistant.log:404: 2022-06-13 17:38:21 ERROR (MainThread) [custom_components.garbage_collection.config_flow] Removed obsolete config values: {'move_country_holidays': 'US', 'holiday_in_week_move': True}. Please check the documentation how to configure the functionality. /Volumes/config/home-assistant.log:405: 2022-06-13 17:38:21 INFO (MainThread) [custom_components.garbage_collection.config_flow] Importing config for OrderedDict([('name', 'Overflow'), ('frequency', 'every-n-days'), ('period', 56), ('first_date', datetime.date(2022, 4, 13)), ('move_country_holidays', 'US'), ('holiday_in_week_move', True)]) /Volumes/config/home-assistant.log:406: 2022-06-13 17:38:21 ERROR (MainThread) [custom_components.garbage_collection.config_flow] Removed obsolete config values: {'move_country_holidays': 'US', 'holiday_in_week_move': True}. Please check the documentation how to configure the functionality. /Volumes/config/home-assistant.log:407: 2022-06-13 17:38:21 INFO (MainThread) [custom_components.garbage_collection.config_flow] Importing config for OrderedDict([('name', 'Street Sweeping'), ('frequency', 'monthly'), ('weekday_order_number', [4]), ('collection_days', ['wed']), ('move_country_holidays', 'US'), ('holiday_in_week_move', True)]) /Volumes/config/home-assistant.log:408: 2022-06-13 17:38:21 ERROR (MainThread) [custom_components.garbage_collection.config_flow] Removed obsolete config values: {'move_country_holidays': 'US', 'holiday_in_week_move': True}. Please check the documentation how to configure the functionality. /Volumes/config/home-assistant.log:451: 2022-06-13 17:38:25 DEBUG (MainThread) [custom_components.garbage_collection] Setting Trash Reminder (weekly) from ConfigFlow /Volumes/config/home-assistant.log:452: 2022-06-13 17:38:25 DEBUG (MainThread) [custom_components.garbage_collection] Setting Recycling Reminder (every-n-days) from ConfigFlow /Volumes/config/home-assistant.log:453: 2022-06-13 17:38:25 DEBUG (MainThread) [custom_components.garbage_collection] Setting Overflow Reminder (every-n-days) from ConfigFlow /Volumes/config/home-assistant.log:454: 2022-06-13 17:38:25 DEBUG (MainThread) [custom_components.garbage_collection] Setting Trash (weekly) from ConfigFlow /Volumes/config/home-assistant.log:455: 2022-06-13 17:38:25 DEBUG (MainThread) [custom_components.garbage_collection] Setting Recycling (every-n-days) from ConfigFlow /Volumes/config/home-assistant.log:456: 2022-06-13 17:38:25 DEBUG (MainThread) [custom_components.garbage_collection] Setting Overflow (every-n-days) from ConfigFlow /Volumes/config/home-assistant.log:457: 2022-06-13 17:38:25 DEBUG (MainThread) [custom_components.garbage_collection] Setting Street Sweeping (monthly) from ConfigFlow /Volumes/config/home-assistant.log:570: 2022-06-13 17:38:29 DEBUG (MainThread) [custom_components.garbage_collection.sensor] Creating garbage_collection calendar /Volumes/config/home-assistant.log:1629: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash Reminder) Calling update /Volumes/config/home-assistant.log:1630: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash Reminder) Dates loaded, firing a garbage_collection_loaded event /Volumes/config/home-assistant.log:1631: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash Reminder) Looking for next collection /Volumes/config/home-assistant.log:1632: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash Reminder) next_date (2022-06-14), today (2022-06-13) /Volumes/config/home-assistant.log:1633: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash Reminder) Found next collection date: 14-Jun-2022, that is in 1 days /Volumes/config/home-assistant.log:1634: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling Reminder) Calling update /Volumes/config/home-assistant.log:1635: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling Reminder) Dates loaded, firing a garbage_collection_loaded event /Volumes/config/home-assistant.log:1636: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling Reminder) Looking for next collection /Volumes/config/home-assistant.log:1637: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling Reminder) next_date (2022-06-21), today (2022-06-13) /Volumes/config/home-assistant.log:1638: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling Reminder) Found next collection date: 21-Jun-2022, that is in 8 days /Volumes/config/home-assistant.log:1639: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow Reminder) Calling update /Volumes/config/home-assistant.log:1640: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow Reminder) Dates loaded, firing a garbage_collection_loaded event /Volumes/config/home-assistant.log:1641: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow Reminder) Looking for next collection /Volumes/config/home-assistant.log:1642: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow Reminder) next_date (2022-08-02), today (2022-06-13) /Volumes/config/home-assistant.log:1643: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow Reminder) Found next collection date: 02-Aug-2022, that is in 50 days /Volumes/config/home-assistant.log:1644: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash) Calling update /Volumes/config/home-assistant.log:1645: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash) Dates loaded, firing a garbage_collection_loaded event /Volumes/config/home-assistant.log:1646: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash) Looking for next collection /Volumes/config/home-assistant.log:1647: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash) next_date (2022-06-15), today (2022-06-13) /Volumes/config/home-assistant.log:1648: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Trash) Found next collection date: 15-Jun-2022, that is in 2 days /Volumes/config/home-assistant.log:1649: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling) Calling update /Volumes/config/home-assistant.log:1650: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling) Dates loaded, firing a garbage_collection_loaded event /Volumes/config/home-assistant.log:1651: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling) Looking for next collection /Volumes/config/home-assistant.log:1652: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling) next_date (2022-06-22), today (2022-06-13) /Volumes/config/home-assistant.log:1653: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Recycling) Found next collection date: 22-Jun-2022, that is in 9 days /Volumes/config/home-assistant.log:1654: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow) Calling update /Volumes/config/home-assistant.log:1655: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow) Dates loaded, firing a garbage_collection_loaded event /Volumes/config/home-assistant.log:1656: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow) Looking for next collection /Volumes/config/home-assistant.log:1657: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow) next_date (2022-08-03), today (2022-06-13) /Volumes/config/home-assistant.log:1658: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Overflow) Found next collection date: 03-Aug-2022, that is in 51 days /Volumes/config/home-assistant.log:1659: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Street Sweeping) Calling update /Volumes/config/home-assistant.log:1660: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Street Sweeping) Dates loaded, firing a garbage_collection_loaded event /Volumes/config/home-assistant.log:1661: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Street Sweeping) Looking for next collection /Volumes/config/home-assistant.log:1662: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Street Sweeping) next_date (2022-06-22), today (2022-06-13) /Volumes/config/home-assistant.log:1663: 2022-06-13 17:39:01 DEBUG (MainThread) [custom_components.garbage_collection.sensor] (Street Sweeping) Found next collection date: 22-Jun-2022, that is in 9 days

Colorado4Wheeler commented 2 years ago

I wiped out all of Garbage Collection and reinstalled it and configured it outside of YAML and that seems to have resolved the problem. Fortunately the naming convention did not change so all my automation came back up.