ICS custom component to read online stored calendars

Hey guys, I’ve published a little custom-component (available in HACS as well) called ICS.

One can specify an ics file, e.g. from a trash-pick-up provider or the office birthday calendar and it will generate a sensor that displays the date, title and remaining days to the next event.

It also gives you the option to filter for event titles, so you can create multiple sensors with the same ics file and different filter, e.g. for multiple types of trash at one service provider.

Cheers, JKW

1 Like

@JKW: very nice job for the calendar component which is becoming more and more flexible! I already worked on it to first be able to also load local ics files which you now also have provided… One missing addition was the ability to define an icon from the config of the sensors which I locally realized as you can see here:

image

What, if you could add it for the community? :wink:

That’s a neat idea! Do you want to add that? Otherwise I can probably add that tonight …
Kolja

PS: Are you using the config flow? I’ve tested pretty much everything I can thing of, but it’s always good to have more tester.


added in https://github.com/KoljaWindeler/ics/commit/df6963f85d6822e844ae0bf7343298a558b154ca
Greets Kolja

1 Like

Wow! I am impressed how quick you implemented it :wink: ! I locally did it almost the same to your approach as I have checked your changes. But you added for logging which is also excellent which I saw when I was logging my system at DEBUG level - could be a role model for others :wink:
Already checked it and it works as expected! :ok_hand: Thanks a lot!

1 Like

Hi JKW,

I am using your integration last couple days and we like it a lot. I was trying to get google home announce the trash pickup one day before, but I can’t get it to work. I am trying only one of the entities but get no announcement.

This is what I was trying without script example:
EDIT: It was spacing issue, the config check did not give errors, but after playing a lot with spaces I got it working.

This is the code I got working:

- id: 'carton en plastic'
  alias: 'trash pickup msg'
  initial_state: 'on'
  trigger:
    platform: time_pattern
    hours: 22
    minutes: 00
    seconds: 00
  condition:
    condition: or
    conditions:
      - condition: template
        value_template: "{{ state_attr('sensor.ics_2', 'remaining') == 2 }}"
  action:
  - service: tts.google_translate_say
    data:
     entity_id:
       - media_player.woonkamer
       - media_player.keuken
     message: put the karton and plastic trash outside

Thanks for your integration!

1 Like

very great job!!

I would like to trigger an event on this day at 6pm as a reminder to take out the garbage. did anyone realize that?

Thank you in advance.

GERMAN:
ich möchte nun an diesem Tag um 18Uhr ein ereignis auslösen zur errinerung den Müll rauszustellen. hat das jemand realisiert?

vielen dank vorab.

thanks and have a look here


jkw

Thank you.
i have insert at my configurations.

what i have to install that “notify.pb” works?` also notify me in the home assistant iOs app? or only in lovelace?

Notify pb and pb_c are my notification services (in my case Pushbullet) … you have to replace that with whatever service you want to use for notification
Jkw

Hey Hauke, can you tell me how you got the “Nächste Abholung” row in your card?

@JKW Thank you for the great intergration, made a real useful tool in our lovelace :-). Is there an easy way to translate the weekdays in another language?

Hi, not really … as this is done in the backend and that will only provide English output.
I guess the easiest would be to add a template sensor like this …

string|regex_replace(find=‘Monday’, replace=‘Montag’, ignorecase=False)|regex_replace(find=‘Tuesday’, replace=‘Dienstag’, ignorecase=False) …

1 Like

Thank you for. your answer, as I’m really a noob on coding, would you help me?

This template sensor, you’re speaking from should be written like this?

#Wochentage ICS
        ics_wochentage_deutsch:
          friendly_name: "Wochentag"
          value_template: >-
            {{ string|regex_replace(find=‘Monday’, replace=‘Montag’, ignorecase=False)|regex_replace(find=‘Tuesday’, replace=‘Dienstag’, ignorecase=False)}}

Replace the “string” with your sensor state, e.g.:
{{states.sensor.ics_1.state|regex…}}
Jkw

1 Like

hi, is that the only way, for switch the EN Day-Name in GER Day-Name?
Thursday, 07.01. (05) => Donnerstag, 07.01. (05)

here my sensor ics file:

# ICS
- platform: ics
  name: Restmülltonne
  url: https://www.eaw-rheingau-taunus.de/abfallkalender/calendar.ics?streetid=1136
  #startswith: Restmülltonne
  contains: "Restmülltonne"
  id: 1
  timeformat: "%A, %d.%m."
  show_remaining: true
  show_ongoing: true
  description_in_state: false
  icon: "mdi:trash-can-outline"

# Wochentage ICS
- platform: template
  sensors:
    ics_wochentage_deutsch:
      friendly_name: "Wochentag"
      value_template: >-
        {{ states.sensor.ics_1|regex_replace(find='Monday', replace='Montag', ignorecase=False)|regex_replace(find='Tuesday', replace='Dienstag', ignorecase=False)|regex_replace(find='Thursday', replace='Donnerstag', ignorecase=False)}}

how it works fine ? :slight_smile:

@JKW Really a great component. Thanks a lot for that.
As I have read in your documentation there should be a way using config flow instead of manually add the sensors to the configuration.yaml? Or did I understand something wrong? I searched a lot about config flow but could only find out that this is some kind of technical possibility to integrate a component…

Sorry I am not familiar to coding…

Thanks
Markus

Thx, once you installed it you can go to configuration - integrations - add integration - search for ics … Configure … done
Jkw

Thanks - and sorry for the newbi question…works like a charm :smile:
Do you plan to integrate authentication?

Markus

Hi, No, but I’d be happy if you implement it and send a pull request
Jkw

@Schimmelreiter please tell us how to make “nächste abholung” possible :slight_smile:

thx!