-
-
Notifications
You must be signed in to change notification settings - Fork 731
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
fix: Setup of integration with generic ICS fails since HA 2025.1 #3421
Conversation
Why not delete the |
Yes, you can do this, but it is not really necessary as it is not integrated anywhere and therefore the code is not used. |
It is a backwards incompatible fix, is there anyway to set version=1? |
As far as I can read the code, version == 2 is hardcoded. |
I can confirm that this pr has fixed the issue #3271 which I have reported. Thanks :) |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@@ -141,7 +140,6 @@ def __init__( | |||
regex: str | None = None, | |||
title_template: str = "{{date.summary}}", | |||
split_at: str | None = None, | |||
version: int = 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks existing installations. Just keep the argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At what point? "version" is no longer used within the class. This is exactly how it works for me (with an ICS file an some test URL).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attention: I don't know much about python and even less about this code base. But to me it looks like version: int = 2
just declares the default value as version 2. For my limited understanding, the ics
datasource configuration can configure version: 1
. Shown in the "test comments" above for example.
Line 37 in b44e14e
"version": 1, |
By that, my assumption is that there might be installations out there, that require this code for backwards (version) compatibility. In this class the parameter might not be used any more, but the configuration of these instances seems pretty dynamic.
So, this might be a hack/fix to make it work locally. But probably not a general fix for the problem. But again, not knowing much about this particular code here, just having the same problem with my installation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version can only be selected if WCS is configured via YAML. When using the UI, which is the preferred and default way, it is always version 2. The version only determines which parser is used.
version
(integer) (optional, default: 2)
Selects the underlying ICS file parser:
version: 1 uses recurring_ical_events
version: 2 uses icalevents
For more see configuration via YAML: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc%2Fsource%2Fics.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this argument breaks every existing configuration using the ics source as the integration tries to set up the source with an argument not accepted by the __init__
The version arguemnt is registered in every ics source configuration. Additionally it can be set in the GUI it just defaults to 2 but you CAN change it:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, at the bottom 😉. But it's just the choice of which parser to use and not a compatibility story. If someone uses version 1, it won't work anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would still be a problem when removing it from the __init__
as it would throw TypeError: Source.__init__() got an unexpected keyword argument 'version'
when setting starting with an existing configuration having the version attribute to anything.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Here you can see how the implementation was carried out three years ago. ICS_v1.py is the swap of a previous version that has not been used since then. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Just to clarify: Version is NOT hard coded, it is just a default value. I opened a PR (#3468) doing what I said above and writing a migration to remove the version argument from the GUI configurations. YAML configuration still using the version argument will see a warning in their logs. I will merge #3468 if no one finds an issue with that |
This fix fixed it for me: |
I see it. Thank you! |
So can we close this PR here? |
In my opinion, removes unused and legacy code that prevents the integration from being set up since HA 2025.1 when using a generic ICS file or URL.
See #3259, #3271, #3390, #3397, #3409