KoljaWindeler / ics

Integration that displays the next event of an ics link (support reoccuring events)
51 stars 12 forks source link

Contains Filter #15

Closed vbtrek closed 3 years ago

vbtrek commented 3 years ago

Hi, could you add a new filter to do a Contains search, behaves just like the startswith but does a contains search. I have a holiday calendar and I only want to pull in the entries that have Holiday in the appointment title.

Thanks

KoljaWindeler commented 3 years ago

I'll have a look and get back to you. Kolja

KoljaWindeler commented 3 years ago

Hi, have a look at https://github.com/KoljaWindeler/ics/commit/a7c2824290b0c6149eb192de6293f839349a9b2d that should add your filter. After updating (and a restart of HA?) you have to create a new sensor to use the contains filter.
Let me know if it works for you Kolja

vbtrek commented 3 years ago

Excellent, so fast. I'll get it installed when it appears in HACS and let you know how it goes. Thanks

vbtrek commented 3 years ago

Will this update get published into HACS? I've not seen an update appear yet

KoljaWindeler commented 3 years ago

hmm honestly .. I don't understand why HACS shows version 0.4 .. I don't see where I've set the version .. I'll keep looking edit: found .. should be available soon

vbtrek commented 3 years ago

Got the update and given it a test but getting the following error logged: 2020-10-05 13:51:36 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for ics doing I/O at custom_components/ics/const.py, line 237: return requests.get(url, headers={'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'}, allow_redirects=True).content

The calendar is published by kayak.co.uk trips feed, so the issue may be with their ics file.

KoljaWindeler commented 3 years ago

No no that warning is supposed to show up. No worries. That only happens once during setup. It depends on the way how I grab the file. That's synchronous during setup and asynchronous later one.

Does the contains filter work as expected? Kolja

vbtrek commented 3 years ago

Yep, the contains is working a treat. Thanks

KoljaWindeler commented 3 years ago

Great