Advertisement
Flo_R1der

sensors.yaml

Aug 15th, 2023
1,034
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 6.36 KB | None | 0 0
  1. # list of custom Sensors
  2.  
  3.  
  4.  - platform: time_date
  5.    display_options:
  6.      - 'time'
  7.      - 'date'
  8.      - 'date_time'
  9.  
  10.  
  11.  - platform: fail2ban
  12.    jails:
  13.      - ssh
  14.      - sshd
  15.      - nextcloud
  16.      - tandoor
  17.      - homeassistant
  18.    file_path: /fail2ban/fail2ban.log
  19.  
  20.  
  21.  
  22.  
  23.  # ===== Abfallkalender =====
  24.  
  25.  # Google-Kalender (Abfuhrplan Meckenbeuren)
  26.  # https://calendar.google.com/calendar/ical/***.ics
  27.  
  28.  # Restmüll 2-wöchentlich
  29.  # https://www.bodenseekreis.de/umwelt-landnutzung/abfallentsorgung-privat/termine/abfuhrkalender/export/2023/meckenbeuren/kehlen/1/ics/
  30.  
  31.  # Gelber Sack
  32.  # https://www.bodenseekreis.de/umwelt-landnutzung/abfallentsorgung-privat/termine/abfuhrkalender/export/2023/meckenbeuren/kehlen/4/ics/
  33.  
  34.  # Papier 4-wöchentlich
  35.  # https://www.bodenseekreis.de/umwelt-landnutzung/abfallentsorgung-privat/termine/abfuhrkalender/export/2023/meckenbeuren/kehlen/10/ics/
  36.  
  37.  - platform: ics
  38.    id: 1
  39.    name: "ICS: Restmüll"
  40.    url: https://calendar.google.com/calendar/ical/***.ics
  41.    lookahead: 60
  42.    startswith: "Restmüll"
  43.    force_update: 600
  44.    show_ongoing: true
  45.    group_events: false
  46.    icon: "mdi:trash-can"
  47.  
  48.  - platform: template
  49.    sensors:
  50.      kehlen_restmuell:
  51.        unique_id: sensor.kehlen_restmuell
  52.        friendly_name: "Restmüll"
  53.        # value_template: "{{ state_attr('sensor.ics_1', 'remaining') }}"
  54.        value_template: >-
  55.          {% set remaining = state_attr('sensor.ics_1', 'remaining') %}
  56.          {% if remaining > 1 %} in {{ remaining }} Tagen {% endif %}
  57.          {% if remaining == 1 %} Morgen! {% endif %}
  58.          {% if remaining == 0 %} Heute! {% endif %}
  59.        attribute_templates:
  60.          start: "{{ state_attr('sensor.ics_1', 'start') }}"
  61.          end: "{{ state_attr('sensor.ics_1', 'end') }}"
  62.          remaining: "{{ state_attr('sensor.ics_1', 'remaining') }}"
  63.          text: "{{ states('sensor.ics_1')[:-5]
  64.           |replace('Monday', 'Montag')
  65.           |replace('Tuesday', 'Dienstag')
  66.           |replace('Wednesday', 'Mittwoch')
  67.           |replace('Thursday', 'Donnerstag')
  68.           |replace('Friday', 'Freitag')
  69.           |replace('Saturday', 'Samstag')
  70.           |replace('Sunday', 'Sonntag') }}"
  71.        icon_template: "{{ state_attr('sensor.ics_1', 'icon') }}"
  72.  
  73.  
  74.  - platform: ics
  75.    id: 2
  76.    name: "ICS: Gelber Sack"
  77.    url: https://calendar.google.com/calendar/ical/***.ics
  78.    lookahead: 60
  79.    startswith: "Gelber Sack"
  80.    force_update: 600
  81.    show_ongoing: true
  82.    group_events: false
  83.    icon: "mdi:recycle"
  84.  
  85.  - platform: template
  86.    sensors:
  87.      kehlen_gelber_sack:
  88.        unique_id: sensor.kehlen_gelber_sack
  89.        friendly_name: "Gelber Sack"
  90.        # value_template: "{{ state_attr('sensor.ics_2', 'remaining') }}"
  91.        value_template: >-
  92.          {% set remaining = state_attr('sensor.ics_2', 'remaining') %}
  93.          {% if remaining > 1 %} in {{ remaining }} Tagen {% endif %}
  94.          {% if remaining == 1 %} Morgen! {% endif %}
  95.          {% if remaining == 0 %} Heute! {% endif %}
  96.        attribute_templates:
  97.          start: "{{ state_attr('sensor.ics_2', 'start') }}"
  98.          end: "{{ state_attr('sensor.ics_2', 'end') }}"
  99.          remaining: "{{ state_attr('sensor.ics_2', 'remaining') }}"
  100.          text: "{{ states('sensor.ics_2')[:-5]  
  101.           |replace('Monday', 'Montag')
  102.           |replace('Tuesday', 'Dienstag')
  103.           |replace('Wednesday', 'Mittwoch')
  104.           |replace('Thursday', 'Donnerstag')
  105.           |replace('Friday', 'Freitag')
  106.           |replace('Saturday', 'Samstag')
  107.           |replace('Sunday', 'Sonntag') }}"
  108.        icon_template: "{{ state_attr('sensor.ics_2', 'icon') }}"
  109.  
  110.  
  111.  - platform: ics
  112.    id: 3
  113.    name: "ICS: Papiertonne"
  114.    url: https://calendar.google.com/calendar/ical/***.ics
  115.    lookahead: 60
  116.    startswith: "Papier"
  117.    force_update: 600
  118.    show_ongoing: true
  119.    group_events: false
  120.    icon: "mdi:package-variant"
  121.  
  122.  - platform: template
  123.    sensors:
  124.      kehlen_papiertonne:
  125.        unique_id: sensor.kehlen_papiertonne
  126.        friendly_name: "Papiertonne"
  127.        # value_template: "{{ state_attr('sensor.ics_3', 'remaining') }}"
  128.        value_template: >-
  129.          {% set remaining = state_attr('sensor.ics_3', 'remaining') %}
  130.          {% if remaining > 1 %} in {{ remaining }} Tagen {% endif %}
  131.          {% if remaining == 1 %} Morgen! {% endif %}
  132.          {% if remaining == 0 %} Heute! {% endif %}
  133.        attribute_templates:
  134.          start: "{{ state_attr('sensor.ics_3', 'start') }}"
  135.          end: "{{ state_attr('sensor.ics_3', 'end') }}"
  136.          remaining: "{{ state_attr('sensor.ics_3', 'remaining') }}"
  137.          text: "{{ states('sensor.ics_3')[:-5]
  138.           |replace('Monday', 'Montag')
  139.           |replace('Tuesday', 'Dienstag')
  140.           |replace('Wednesday', 'Mittwoch')
  141.           |replace('Thursday', 'Donnerstag')
  142.           |replace('Friday', 'Freitag')
  143.           |replace('Saturday', 'Samstag')
  144.           |replace('Sunday', 'Sonntag') }}"
  145.        icon_template: "{{ state_attr('sensor.ics_3', 'icon') }}"
  146.  
  147.  
  148.  - platform: ics
  149.    id: 4
  150.    name: "ICS: sonstiger Abfall"
  151.    url: https://calendar.google.com/calendar/ical/***.ics
  152.    lookahead: 356
  153.    regex: "^(?!Restmüll|Gelber Sack|Papier).*$"
  154.    force_update: 600
  155.    show_ongoing: true
  156.    group_events: false
  157.    icon: "mdi:delete-circle-outline"
  158.  
  159.  - platform: template
  160.    sensors:
  161.      kehlen_sonstiger_abfall:
  162.        unique_id: sensor.kehlen_sonstiger_abfall
  163.        # friendly_name: "Sonstiger Abfall"
  164.        friendly_name: "{{ state_attr('sensor.ics_4', 'description') }}"
  165.        # value_template: "{{ state_attr('sensor.ics_4', 'remaining') }}"
  166.        value_template: >-
  167.          {% set remaining = state_attr('sensor.ics_4', 'remaining') %}
  168.          {% if remaining > 1 %} in {{ remaining }} Tagen {% endif %}
  169.          {% if remaining == 1 %} Morgen! {% endif %}
  170.          {% if remaining == 0 %} Heute! {% endif %}
  171.        attribute_templates:
  172.          start: "{{ state_attr('sensor.ics_4', 'start') }}"
  173.          end: "{{ state_attr('sensor.ics_4', 'end') }}"
  174.          remaining: "{{ state_attr('sensor.ics_4', 'remaining') }}"
  175.          text: "{{ states('sensor.ics_4')[:-5] }}"
  176.        icon_template: "{{ state_attr('sensor.ics_4', 'icon') }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement