Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ########################################################################
- ### Giorno della settimana
- ########################################################################
- - platform: template
- sensors:
- day_of_week:
- friendly_name: 'Giorno della settimana'
- value_template: '{% if now().weekday() in (0,) %} Lun {% elif now().weekday() in (1,) %} Mar {% elif now().weekday() in (2,) %} Mer {% elif now().weekday() in (3,) %} Gio {% elif now().weekday() in (4,) %} Ven {% elif now().weekday() in (5,) %} Sab {% elif now().weekday() in (6,) %} Dom{% endif %}'
- ########################################################################
- ### Data e ora
- ########################################################################
- - platform: time_date
- display_options:
- - 'time'
- - 'date'
- - 'date_time'
- - 'time_date'
- - 'time_utc'
- - 'beat'
- ########################################################################
- ### Definizione Orario Alba e Tramonto
- ########################################################################
- - platform: template
- sensors:
- sunset_time:
- value_template: '{% set timestamp = as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom("%H:%M") %} {{ timestamp.lstrip("0") }}'
- friendly_name: "Tramonto"
- - platform: template
- sensors:
- sunrise_time:
- value_template: '{% set timestamp = as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom("%H:%M") %} {{ timestamp.lstrip("0") }}'
- friendly_name: "Alba"
- - platform: template
- sensors:
- tapparella:
- friendly_name: "Sensore Tapparella"
- # value_template: {{ states.cover.tapparella_matrimoniale.state }}
- value_template: >-
- {% if is_state('cover.tapparella_matrimoniale', 'closed') %}
- off
- {% elif is_state('cover.tapparella_matrimoniale', 'stop') %}
- stop
- {% elif is_state('cover.tapparella_matrimoniale', 'open') %}
- on
- {% else %}
- failed
- {% endif %}
- ########################################################################
- ### Monitor di Sistema
- ########################################################################
- - platform: systemmonitor
- resources:
- - type: disk_free
- arg: /
- - type: memory_free
- - type: processor_use
- - type: last_boot
- - type: since_last_boot
- - platform: template
- sensors:
- uptime:
- friendly_name: Uptime
- value_template: "{{ states.sensor.since_last_boot.state.split('.')[0] }}"
- since_last_boot_templated:
- friendly_name: Since last boot
- value_template: >-
- {%- set slb = states.sensor.since_last_boot.state.split(' ') -%}
- {%- set count = slb | length -%}
- {%- set hms = slb[count - 1] -%}
- {%- set hms_trimmed = hms.split('.')[0] -%}
- {%- set hms_split = hms_trimmed.split(':') -%}
- {%- set hours = hms_split[0] | int -%}
- {%- set minutes = hms_split[1] | int -%}
- {%- set seconds = hms_split[2] | int -%}
- {%- if count == 3 -%}
- {{ slb[0] ~ ' ' ~ slb[1] ~ ' ' }}
- {%- endif -%}
- {%- if hours > 0 -%}
- {%- if hours == 1 -%}
- 1 hour
- {%- else -%}
- {{ hours }} hours
- {%- endif -%}
- {%- endif -%}
- {%- if minutes > 0 -%}
- {%- if hours > 0 -%}
- {{ ', ' }}
- {%- endif -%}
- {%- if minutes == 1 -%}
- 1 minute
- {%- else -%}
- {{ minutes }} minutes
- {%- endif -%}
- {%- endif -%}
- {%- if seconds > 0 -%}
- {%- if hours > 0 or minutes > 0 -%}
- {{ ', ' }}
- {%- endif -%}
- {%- if seconds == 1 -%}
- 1 second
- {%- else -%}
- {{ seconds }} seconds
- {%- endif -%}
- {%- endif -%}
- - platform: command_line
- name: CPU Temp
- command: "cat /sys/class/thermal/thermal_zone0/temp"
- unit_of_measurement: "°C"
- value_template: '{{ value | multiply(0.001) | round(1) }}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement