28 lines
859 B
YAML
28 lines
859 B
YAML
|
###################################################
|
||
|
## * Special HASS related sensors - Thanks @torn8o
|
||
|
###################################################
|
||
|
|
||
|
- platform: version
|
||
|
name: HA Installed Version
|
||
|
scan_interval: 86400
|
||
|
|
||
|
- platform: command_line
|
||
|
name: "HA Uptime"
|
||
|
command: echo "$(($(date +%s) - $(date -d "$(head -n1 /config/home-assistant.log | cut -d' ' -f-2)" +%s)))"
|
||
|
scan_interval: 720
|
||
|
value_template: >-
|
||
|
{% set uptime = value | int %}
|
||
|
{% set seconds = uptime % 60 %}
|
||
|
{% set minutes = ((uptime % 3600) / 60) | int %}
|
||
|
{% set hours = ((uptime % 86400) / 3600) | int %}
|
||
|
{% set days = (uptime / 86400) | int %}
|
||
|
{%- if days > 0 -%}
|
||
|
{%- if days == 1 -%}
|
||
|
1 day
|
||
|
{%- else -%}
|
||
|
{{ days }} days
|
||
|
{%- endif -%}
|
||
|
{{ ', ' }}
|
||
|
{%- endif -%}
|
||
|
{{ '%02d' % hours }}:{{ '%02d' % minutes }}
|