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
387 stars 90 forks source link

Error since updating to 2022.2.x #354

Closed Kanga-Who closed 2 years ago

Kanga-Who commented 2 years ago

Before you submit a new bug report, please check that

Describe the bug

Restart Home Assistant: Error executing script. Error for call_service at pos 1: The system cannot restart because the configuration is not valid: Invalid config for [garbage_collection]: Not a list for dictionary value @ data['garbage_collection']['sensors'][0]['collection_days']. Got 'mon'. (See /config/configuration.yaml, line 115). 

Configuration

garbage_collection:
  sensors:
    - name: General Waste
      frequency: "weekly"
      collection_days: mon
    - name: Recycling
      frequency: "odd-weeks"
      collection_days: mon
    - name: Green Waste
      frequency: "even-weeks"
      collection_days: mon

### Debug logs

```shell
Unable to get debug logs as I can not restart HA with the integration enabled.
bruxy70 commented 2 years ago

Can you please help me testing the fix? Can you take the __init__.py file from here put it in the custom_components/garbage collection, restart and see if it helps. The collection days is supposed to be a list, not text, but it was a valid option before, so I am trying to support that in the migration script. Thanks!

jgronowski commented 2 years ago

@bruxy70 i took this file and put in to the mentioned custom_components, but the error is the same.

Logger: homeassistant.setup
Source: setup.py:154
First occurred: 13:06:15 (1 occurrences)
Last logged: 13:06:15

Setup failed for garbage_collection: Invalid config.
Invalid config for [garbage_collection]: Not a list for dictionary value @ data['garbage_collection']['sensors'][0]['collection_days']. Got 'mon'. (See /config/configuration.yaml, line 32).
tiptap85 commented 2 years ago

Can you please help me testing the fix? Can you take the __init__.py file from here put it in the custom_components/garbage collection, restart and see if it helps. The collection days is supposed to be a list, not text, but it was a valid option before, so I am trying to support that in the migration script. Thanks!

Same error for me, after changing the init.py file and restarting Home Assistant I got this error: "Component error: garbage_collection - Exception importing custom_components.garbage_collection"

bruxy70 commented 2 years ago

Ok, can you try again pls? I apreciate your help, it will help others with importing the legacy config. Thanks!

tiptap85 commented 2 years ago

Ok, can you try again pls? I apreciate your help, it will help others with importing the legacy config. Thanks!

Thank you for your quick help. I have tried, but i got the same error...

bruxy70 commented 2 years ago

Do not know. I have cleared all my config and configured yours, and it imported fine: image I just made a release with the modified init file, so please upgrade and restart if it helps. Did you check in the Integrations page if the devices are still missing?

jgronowski commented 2 years ago

@bruxy70 problem solved. The latest commit fix the issue.

Kanga-Who commented 2 years ago

I'm still getting the same problem on 4.4.5, can not restart HA. Is my config incorrect?

Restart Home Assistant: Error executing script. Error for call_service at pos 1: The system cannot restart because the configuration is not valid: Invalid config for [garbage_collection]: Not a list for dictionary value @ data['garbage_collection']['sensors'][0]['collection_days']. Got 'mon'. (See /config/configuration.yaml, line 115). 

EDIT: Uninstalled and re-installed the add-on, now working. Weird.

Thanks for the updates 👍

bruxy70 commented 2 years ago

@Kanga-Who , I do not know what is your config, I do not know what do you mean by weird, and I do not know what add-on you re-installed.

Kanga-Who commented 2 years ago

@Kanga-Who , I do not know what is your config, I do not know what do you mean by weird, and I do not know what add-on you re-installed.

My config was in the OP.

It was weird that I was still getting an error after updating, but uninstalling this add-on and reinstalling it fixed the issue - as stated in my last post.

bruxy70 commented 2 years ago

Ok, sorry, I thought that one was already resolved, did not notice it was someone else :)