Forum Francophone Home Assistant

Partage de fichier sensor.yaml

voici mon fichier sensor.yaml

#############################
#### vacances et férié ######
#############################
- platform: template
  sensors:
    template_fd:
      friendly_name: ferié demain
      value_template: >-
        {% if (((as_timestamp(states.calendar.jours_feries_en_france.attributes.start_time) ) - (as_timestamp( now())| int)- (86400)) < 0) or (((as_timestamp(states.calendar.jours_feries_en_france.attributes.end_time) ) - (as_timestamp( now())| int)- (86400)) < 0) %} oui {% else %} non {% endif %}

- platform: template
  sensors:
    template_vd:
      friendly_name: vacances demain
      value_template: >-
        {% if (((as_timestamp(states.calendar.calendrier_scolaire_zone_b.attributes.start_time) ) - (as_timestamp( now())| int)- (86400)) < 0) or (((as_timestamp(states.calendar.calendrier_scolaire_zone_b.attributes.end_time) ) - (as_timestamp( now())| int)- (86400)) < 0) %} oui {% else %} non {% endif %}
        
- platform: template
  sensors:
    template_fca:
      friendly_name: ferier ou congé aujourd'hui
      value_template: >-
        {{ (states('calendar.jours_feries_en_france') == 'on') or (states('calendar.calendrier_scolaire_zone_b') == 'on') }}

- platform: template
  sensors:
    template_fcd:
      friendly_name: ferier ou congé demain
      value_template: >-
        {{ (states('sensor.template_fd') == 'oui') or (states('sensor.template_vd') == 'oui') }}
        
#############################
#####   date/time       #####
#############################
- platform: time_date
  display_options:
  - 'time'
  - 'date'
  - 'date_time'
  - 'date_time_utc'
  - 'date_time_iso'
  - 'time_date'
  - 'time_utc'
  - 'beat'   
#############################
########     RPI    #########
#############################
# System Monitor raspberry Pi
- platform: systemmonitor
  resources:
    - type: disk_free
      arg: /
    - type: disk_use_percent
      arg: /
    - type: memory_free
    - type: memory_use_percent
    - type: swap_use_percent
    - type: processor_use
    - type: last_boot

# Temperature CPU  
- platform: command_line
  name: "RPi CPU Temperature"
  command: "cat /sys/class/thermal/thermal_zone0/temp"
  value_template: '{{ value | multiply(0.001) | round(2) }}°'  
#############################
########   soleil  ##########
############################# 
- platform: template
  sensors:
      nextsunrise:
       # entity_id: sun.sun
        friendly_name: 'Next Sunrise'
        value_template: >
          {{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom('%H %M')}}
        icon_template: mdi:weather-sunset-up

- platform: template
  sensors:
      nextsunset:
        #entity_id: sun.sun
        friendly_name: 'Next Sunset'
        value_template: >
          {{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom(' %H %M')}}
        icon_template: mdi:weather-sunset-down
#############################
########  tranches ##########
#############################
- platform: template
  sensors:
    tranche_1:
      friendly_name: tranche 1
      value_template: >-
        {{ (states('sensor.time') >= states('input_datetime.sejour_start_1')) and  (states('sensor.time') <= states('input_datetime.sejour_stop_1'))}}
      icon_template: >-
        {% if is_state('sensor.tranche_1', 'True') %}
           mdi:lightning-bolt: mdi:radiator
        {% else %}
            mdi:sleep
          {% endif %}
- platform: template
  sensors:
    tranche_2:
      friendly_name: tranche 2
      value_template: >-
        {{ (states('sensor.time') >= states('input_datetime.sejour_start_2')) and  (states('sensor.time') <= states('input_datetime.sejour_stop_2'))}}
      icon_template: >-
        {% if is_state('sensor.tranche_2', 'True') %}
           mdi:lightning-bolt: mdi:radiator
        {% else %}
            mdi:sleep
          {% endif %}
- platform: template
  sensors:
    tranche_3:
      friendly_name: tranche 3
      value_template: >-
        {{ (states('sensor.time') >= states('input_datetime.sejour_start_3')) and  (states('sensor.time') <= states('input_datetime.sejour_stop_3'))}}
      icon_template: >-
        {% if is_state('sensor.tranche_3', 'True') %}
           mdi:lightning-bolt: mdi:radiator
        {% else %}
            mdi:sleep
          {% endif %}
#############################
########  ventil   ##########
#############################

- platform: template
  sensors:
    vitesse_ventil:
      friendly_name: ventil vitesse
      value_template: >-
       {{ states.light.ventilateur.attributes.brightness }}
#############################
########  cerboot  ##########
#############################
- platform: cert_expiry
  host: XXXXXXX.freeboxos.fr
  
- platform: template
  sensors:
    jours_avant_expiration:
      friendly_name: jours avant expiration
      value_template: >-
       {{((as_timestamp(states('sensor.cert_expiry_timestamp_XXXXX_freeboxos_fr')) - as_timestamp(states.sensor.date.last_updated)) / 86400) | int }}