Added in new Counters #784

This commit is contained in:
ccostan
2020-06-24 13:13:32 -04:00
parent 81eb88b842
commit 50d6d0949e
4 changed files with 117 additions and 0 deletions

View File

@@ -82,6 +82,44 @@ sensor:
end: '{{ now() }}'
duration:
days: 7
- 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 -%}
{%- if hours > 0 -%}
{%- if hours == 1 -%}
1 hour
{%- else -%}
{{ hours }} hours
{%- endif -%}
{{ ', ' }}
{%- endif -%}
{%- if minutes > 0 -%}
{%- if minutes == 1 -%}
1 minute
{%- else -%}
{{ minutes }} minutes
{%- endif -%}
{%- endif -%}
### Building some interesting stats for tweeting. ###
- platform: template
@@ -140,9 +178,25 @@ sensor:
value_template: >
{{ states.camera | list | count }}
counter:
automation_triggered:
name: Automations Triggered daily
icon: mdi:counter
initial: 1 # Counter resets at Sunrise [sunrise_turn_off.yaml].
step: 1
#############################################################
automation:
- alias: 'Count triggered Automations'
trigger:
platform: event
event_type: automation_triggered
action:
- service: counter.increment
data:
entity_id: counter.automation_triggered
- alias: 'New Twitter follower!'
trigger:
platform: event