ICS custom component to read online stored calendars

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!

For “contains” and “startswith”, is there an option to search for multiple terms?

Sorry but no

Sorry for not noticing that - too busy at work and thus for this Mega-Delay:

I just made a sensor… not very beautiful, but it does the job:

- platform: template
  sensors:
    gcoll_next_date:
      icon_template: mdi:truck  
      friendly_name_template: >
            {% set r1 = state_attr('sensor.ics_1', 'remaining') %}
            {% set n1 = state_attr('sensor.ics_1', 'friendly_name') %}
            {% set r2 = state_attr('sensor.ics_2', 'remaining') %}
            {% set n2 = state_attr('sensor.ics_2', 'friendly_name') %}
            {% set r3 = state_attr('sensor.ics_3', 'remaining') %}
            {% set n3 = state_attr('sensor.ics_3', 'friendly_name') %}
            {% set r4 = state_attr('sensor.ics_4', 'remaining') %}
            {% set n4 = state_attr('sensor.ics_4', 'friendly_name') %}
            {% set min = (r1, r2, r3, r4) | min %}
            {% set remainings = (r1, r2, r3, r4) %}
            {% set types = (n1, n2, n3, n4) %}

            {%- for r in remainings -%}
              {%- if (r == min) -%}
                {{ types[loop.index0]}}
                {%- if not loop.last %}/ {% endif -%}
              {% endif -%}
            {% endfor %}
      value_template: >-
          {% set r1 = state_attr('sensor.ics_1', 'remaining') %}
          {% set n1 = state_attr('sensor.ics_1', 'friendly_name') %}
          {% set r2 = state_attr('sensor.ics_2', 'remaining') %}
          {% set n2 = state_attr('sensor.ics_2', 'friendly_name') %}
          {% set r3 = state_attr('sensor.ics_3', 'remaining') %}
          {% set n3 = state_attr('sensor.ics_3', 'friendly_name') %}
          {% set r4 = state_attr('sensor.ics_4', 'remaining') %}
          {% set n4 = state_attr('sensor.ics_4', 'friendly_name') %}
          {% set min = (r1, r2, r3, r4) | min %}

          {% if min == 0 %} Heute {% endif %}
          {% if min == 1 %} Morgen {% endif %}
          {%- if min > 1 %} in {{min}} Tagen {% endif -%}
          

      attribute_templates:
        type: >-
          {% set r1 = state_attr('sensor.ics_1', 'remaining') %}
          {% set n1 = state_attr('sensor.ics_1', 'friendly_name') %}
          {% set r2 = state_attr('sensor.ics_2', 'remaining') %}
          {% set n2 = state_attr('sensor.ics_2', 'friendly_name') %}
          {% set r3 = state_attr('sensor.ics_3', 'remaining') %}
          {% set n3 = state_attr('sensor.ics_3', 'friendly_name') %}
          {% set r4 = state_attr('sensor.ics_4', 'remaining') %}
          {% set n4 = state_attr('sensor.ics_4', 'friendly_name') %}
          {% set min = (r1, r2, r3, r4) | min %}
          {% set remainings = (r1, r2, r3, r4) %}
          {% set types = (n1, n2, n3, n4) %}

          {% for r in remainings %}
            {% if (r == min) %}
              {{ types[loop.index0]}}
              {%- if not loop.last %}/ {% endif -%}
            {% endif -%}
          {% endfor %}
        days: >-
          {% set r1 = state_attr('sensor.ics_1', 'remaining') %}
          {% set r2 = state_attr('sensor.ics_2', 'remaining') %}
          {% set r3 = state_attr('sensor.ics_3', 'remaining') %}
          {% set r4 = state_attr('sensor.ics_4', 'remaining') %}
          {% set min = (r1, r2, r3, r4) | min %}

          {{min}}

Hope it helps…

3 Likes

Hi There
could anybode let me know how to integrate a local stored calender into ICS. It’s stored on my SDD (use HA on a PI4), so how to address the local folder? I have tried several options as described, but no success. Even not with the external link stored/showed in the description. Thank you for any help.
On an external link I get: “The downloaded file can not be parsed, not a valid ICS file.”
Any help??

JJ

Thank you for the Template. I modified a little the friendly_name_template and replaced the for loop (to be able to remove the last slash):

{%- set types_joined -%}
  {%- set pipe = joiner(' / ') -%}
  {%- for r in remainings if (r == min) -%}
    {{ pipe() }}{{ types[loop.index0] }}
  {%- endfor -%}
{%- endset -%}
{{ types_joined }}

(inspired by home-assistant/core#Missing jinja extension: Expression statement)

will be this integration updated or can i remove it in future core updates?

Hopefully it’s gonna be fixed, I use it every day!

No worries

1 Like