Added in new Counters #784
This commit is contained in:
parent
81eb88b842
commit
50d6d0949e
|
@ -60,3 +60,7 @@
|
||||||
- input_boolean.medicine
|
- input_boolean.medicine
|
||||||
- input_boolean.daylight_override
|
- input_boolean.daylight_override
|
||||||
- input_boolean.guest_mode
|
- input_boolean.guest_mode
|
||||||
|
|
||||||
|
- service: counter.reset
|
||||||
|
data:
|
||||||
|
entity_id: counter.automation_triggered
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
#-------------------------------------------
|
||||||
|
# Fire Tablet Alarm Panel -
|
||||||
|
# https://www.vcloudinfo.com/2017/07/visualizing-smart-home-using-home.html
|
||||||
|
#-------------------------------------------
|
||||||
|
#
|
||||||
|
# homeassistant:
|
||||||
|
# customize_glob:
|
||||||
|
# "sensor.*_alarm_panel*":
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# "binary_sensor.*_alarm_panel*":
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: template
|
||||||
|
sensors:
|
||||||
|
low_battery:
|
||||||
|
friendly_name: 'Low Battery'
|
||||||
|
entity_id: []
|
||||||
|
value_template: >
|
||||||
|
{%- set threshold = 15 -%}
|
||||||
|
{%- set domains = ['light', 'switch', 'sensor', 'zwave', 'lock', 'binary_sensor'] -%}
|
||||||
|
{%- for domain in domains -%}
|
||||||
|
{%- for item in states[domain] if ((item.attributes.battery_level is defined and item.attributes['battery_level'] | int < threshold) or ("battery" in item.name | lower and ((item.state | int < threshold and item.state|int != 0) or item.state | lower == "low" or item.state | lower == "unknown"))) -%}
|
||||||
|
{{ item.attributes.friendly_name }} (
|
||||||
|
{%- if item.attributes.battery_level is defined -%}
|
||||||
|
{{ item.attributes.battery_level}}
|
||||||
|
{%- else -%}
|
||||||
|
{{item.state}}
|
||||||
|
{%- endif -%}%)
|
||||||
|
{%- if not loop.last -%}
|
||||||
|
{{', '}}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
|
||||||
|
automation:
|
||||||
|
- alias: 'Battery Alert'
|
||||||
|
initial_state: 'on'
|
||||||
|
trigger:
|
||||||
|
- platform: time
|
||||||
|
at: '10:00:00'
|
||||||
|
- platform: time
|
||||||
|
at: '18:00:00'
|
||||||
|
condition:
|
||||||
|
condition: template
|
||||||
|
value_template: "{% if states('sensor.low_battery') %}true{% endif %}"
|
||||||
|
action:
|
||||||
|
- service: persistent_notification.create
|
||||||
|
data_template:
|
||||||
|
title: Low Battery
|
||||||
|
message: "{{ states('sensor.low_battery') }}"
|
||||||
|
notification_id: low-battery-alert
|
||||||
|
- service: script.notify_engine
|
||||||
|
data_template:
|
||||||
|
value1: "Low battery levels: {{ states('sensor.low_battery') }}"
|
||||||
|
who: 'carlo'
|
||||||
|
apns_id: 'information'
|
|
@ -82,6 +82,44 @@ sensor:
|
||||||
end: '{{ now() }}'
|
end: '{{ now() }}'
|
||||||
duration:
|
duration:
|
||||||
days: 7
|
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. ###
|
### Building some interesting stats for tweeting. ###
|
||||||
- platform: template
|
- platform: template
|
||||||
|
@ -140,9 +178,25 @@ sensor:
|
||||||
value_template: >
|
value_template: >
|
||||||
{{ states.camera | list | count }}
|
{{ 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:
|
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!'
|
- alias: 'New Twitter follower!'
|
||||||
trigger:
|
trigger:
|
||||||
platform: event
|
platform: event
|
||||||
|
|
Loading…
Reference in New Issue