Skip to content
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

[Bug]: source AWR_DE defective #2643

Closed
6 of 7 tasks
pehebo opened this issue Sep 9, 2024 · 18 comments
Closed
6 of 7 tasks

[Bug]: source AWR_DE defective #2643

pehebo opened this issue Sep 9, 2024 · 18 comments

Comments

@pehebo
Copy link

pehebo commented Sep 9, 2024

I Have A Problem With:

A specific source

What's Your Problem

Since latest update of HACS source awr_de isnt loaded with error:
^ TypeError: can't compare datetime.datetime to datetime.date

Before everything workes fine.

Source (if relevant)

awr_de

Logs

No response

Relevant Configuration

No response

Checklist Source Error

  • Use the example parameters for your source (often available in the documentation) (don't forget to restart Home Assistant after changing the configuration)
  • Checked that the website of your service provider is still working
  • Tested my attributes on the service provider website (if possible)
  • I have tested with the latest version of the integration (master) (for HACS in the 3 dot menu of the integration click on "Redownload" and choose master as version)

Checklist Sensor Error

  • Checked in the Home Assistant Calendar tab if the event names match the types names (if types argument is used)

Required

  • I have searched past (closed AND opened) issues to see if this bug has already been reported, and it hasn't been.
  • I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.
@9H3SC
Copy link

9H3SC commented Sep 9, 2024

Same here for source: awsh_de

Seems that the start- and end-date is a datetime-format as the icalevents needs date-format..

Logs:
2024-09-09 11:04:11.970 ERROR (SyncWorker_5) [custom_components.waste_collection_schedule.waste_collection_schedule.source_shell] fetch failed for source Abfallwirtschaft Südholstein: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 145, in fetch entries = self._source.fetch() ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/awsh_de.py", line 71, in fetch dates = self._ics.convert(r.text) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/service/ICS.py", line 48, in convert events: List[Any] = icalevents.events( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/icalevents/icalevents.py", line 57, in events found_events += parse_events( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/icalevents/icalparser.py", line 394, in parse_events elif e.end >= f and e.start <= t and is_not_exception(e.start): ^^^^^^^^^^ TypeError: can't compare datetime.datetime to datetime.date

@TheDuffman85
Copy link

TheDuffman85 commented Sep 9, 2024

Same issue here with source Abfall.IO / AbfallPlus

Logs:
2024-09-09 10:02:12.716 ERROR (SyncWorker_2) [custom_components.waste_collection_schedule.waste_collection_schedule.source_shell] fetch failed for source Abfall.IO / AbfallPlus:
Traceback (most recent call last):
File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 145, in fetch
entries = self._source.fetch()
^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfall_io.py", line 177, in fetch
dates = self._ics.convert(ics_file)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/service/ICS.py", line 48, in convert
events: List[Any] = icalevents.events(
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/icalevents/icalevents.py", line 57, in events
found_events += parse_events(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/icalevents/icalparser.py", line 394, in parse_events
elif e.end >= f and e.start <= t and is_not_exception(e.start):
^^^^^^^^^^
TypeError: can't compare datetime.datetime to datetime.date

@RobGri001
Copy link

Same issue here with source "Abfallwirtschaftsbetrieb des Landkreises Pfaffenhofen a.d.Ilm (AWP)"

@Jushav
Copy link

Jushav commented Sep 9, 2024

Same with Abfallwirtschaft Pforzheim

TypeError: can't compare datetime.datetime to datetime.date

@cook2000
Copy link

cook2000 commented Sep 9, 2024

Same here with generic ICS and infeo_at

`Logger: custom_components.waste_collection_schedule.waste_collection_schedule.source_shell
Quelle: custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py:147
Integration: Waste Collection Schedule (Dokumentation)
Erstmals aufgetreten: 12:57:34 (1 Vorkommnisse)
Zuletzt protokolliert: 12:57:34

fetch failed for source infeo: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 145, in fetch entries = self._source.fetch() ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/infeo_at.py", line 129, in fetch dates = self._ics.convert(response.text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/service/ICS.py", line 48, in convert events: List[Any] = icalevents.events( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/icalevents/icalevents.py", line 57, in events found_events += parse_events( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/icalevents/icalparser.py", line 394, in parse_events elif e.end >= f and e.start <= t and is_not_exception(e.start): ^^^^^^^^^^ TypeError: can't compare datetime.datetime to datetime.date`

@M0nk3yOo
Copy link

M0nk3yOo commented Sep 9, 2024

Same for "Regioentsorgung Städteregion Aachen".
So it seems to be a general error.

@dm82m
Copy link
Contributor

dm82m commented Sep 9, 2024

I am pretty sure that it has something todo with a python module within the individual instance. Maybe directly with the DateTime module. Why am I assuming this? @cook2000 has the same HA version, same waste_collection_schedule version, same configuration as I. It works on my instance but not on his instance. We compared DateTime module and on my instance it is 4.9 and on his instance it is 5.5.

@M0nk3yOo
Copy link

M0nk3yOo commented Sep 9, 2024

Sounds good, because even if I downgrade the version, the issue persists

@dm82m
Copy link
Contributor

dm82m commented Sep 9, 2024

I manually upgraded from DateTime 4.9 to DateTime 5.5 (current), also works, upgraded icalendar from 4.0.9 to 5.0.13 (current) and icalevents from 0.1.27 to 0.1.29 (current) - and it also works...

not sure if my above assumption is still valid... :D

@dm82m
Copy link
Contributor

dm82m commented Sep 9, 2024

Ha I was right, more or less!

@cook2000 has icalevents 0.1.28, I downgraded to it and voila the error is there (see below). upgrade to icalevents 0.1.29 and it is back working.

so all people having this issue can do:

sudo docker exec -it homeassistant /bin/bash
pip install --upgrade DateTime icalendar icalevents

then restart home assistant core.

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.waste_collection_schedule.waste_collection_schedule.source_shell
Quelle: custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py:147
Integration: Waste Collection Schedule (Dokumentation)
Erstmals aufgetreten: 17:18:09 (1 Vorkommnisse)
Zuletzt protokolliert: 17:18:09

fetch failed for source infeo: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 145, in fetch entries = self._source.fetch() ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/infeo_at.py", line 242, in fetch dates = self._ics.convert(response.text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/service/ICS.py", line 48, in convert events: List[Any] = icalevents.events( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/icalevents/icalevents.py", line 57, in events found_events += parse_events( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/icalevents/icalparser.py", line 394, in parse_events elif e.end >= f and e.start <= t and is_not_exception(e.start): ^^^^^^^^^^ TypeError: can't compare datetime.datetime to datetime.date

Edit: I have no real solution what that does mean to waste_collection_schedule but I am pretty sure my neighbour (@mampfes) or @5ila5 will find a solution. Edit3: maybe have a solution, raised a PR.

Edit2: icalevents 0.1.28 was released yesterday 08.09. and 0.1.29 was released an hour ago... seems they found the issue earlier and already fixed it... See: https://pypi.org/project/icalevents/#history and jazzband/icalevents#140

dm82m added a commit to dm82m/hacs_waste_collection_schedule that referenced this issue Sep 9, 2024
icalevents 0.1.28 is broken, setting dependency to 0.1.29 to force an upgrade on all affected instances
@cook2000
Copy link

cook2000 commented Sep 9, 2024

Thanks @dm82m !

Upgrading icalevents to 0.1.29 worked for me.

@pehebo
Copy link
Author

pehebo commented Sep 9, 2024 via email

@dm82m
Copy link
Contributor

dm82m commented Sep 9, 2024

I use home assistant os, so no idea what your question is about.

@pehebo
Copy link
Author

pehebo commented Sep 9, 2024 via email

@dm82m
Copy link
Contributor

dm82m commented Sep 9, 2024

You need shell access, can be realized by ssh‘ing onto haos or use a addon. If you Are not familiar with it, just wait till the pr is integrated

@pehebo
Copy link
Author

pehebo commented Sep 9, 2024 via email

@M0nk3yOo
Copy link

M0nk3yOo commented Sep 9, 2024

And what about people using Home Assistant OS?Am 09.09.2024 um 17:24 schrieb Dirk @.>: Ha I was right, more or less! @cook2000 has icalevents 0.1.28, I downgraded to it and voila the error is there (see below). upgrade to icalevents 0.1.29 and it is back working. so all people having this issue can do: sudo docker exec -it homeassistant /bin/bash pip upgrade DateTime icalendar icalevents then restart home assistant core. Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht Logger: custom_components.waste_collection_schedule.waste_collection_schedule.source_shell Quelle: custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py:147 Integration: Waste Collection Schedule (Dokumentation) Erstmals aufgetreten: 17:18:09 (1 Vorkommnisse) Zuletzt protokolliert: 17:18:09 fetch failed for source infeo: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 145, in fetch entries = self._source.fetch() ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/infeo_at.py", line 242, in fetch dates = self._ics.convert(response.text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/service/ICS.py", line 48, in convert events: List[Any] = icalevents.events( ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/icalevents/icalevents.py", line 57, in events found_events += parse_events( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/icalevents/icalparser.py", line 394, in parse_events elif e.end >= f and e.start <= t and is_not_exception(e.start): ^^^^^^^^^^ TypeError: can't compare datetime.datetime to datetime.date —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.>

Thanks, that solved it for me! :-)