-
Notifications
You must be signed in to change notification settings - Fork 1
/
hass.yaml
128 lines (118 loc) · 3.95 KB
/
hass.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
sensor:
- platform: command_line
command: /srv/hass/bin/python3 -c "import requests; print(requests.get('https://pypi.python.org/pypi/homeassistant/json').json()['info']['version'])"
name: PyPI Version
scan_interval: 3600
- platform: command_line
name: HA Version
command: "/srv/hass/bin/hass --version"
scan_interval: 360000
- platform: template
sensors:
ha_last_restart:
value_template: '{% if states.automation.startup_notification and states.automation.startup_notification.attributes.last_triggered %}
{{ as_timestamp(states.automation.startup_notification.attributes.last_triggered) | timestamp_custom("%b %d %X") }}
{% else %}
Never
{% endif %}'
friendly_name: HA Last Restart
# ha_restart_count:
# value_template: '{{ states.input_slider.ha_restart_count.state | int }}'
# friendly_name: HA Restarts this version
- platform: command_line
name: SSL Expiry
unit_of_measurement: days
scan_interval: 86400
command: "ssl-cert-check -c /etc/letsencrypt/live/hide_name/cert.pem | tail -c 36"
automation:
- alias: 'Update Available Notification'
hide_entity: true
trigger:
platform: state
entity_id: updater.updater
action:
service: notify.pushbullet
data:
title: "HomeAssistant Update"
message: "HomeAssistant {{ states('updater.updater') }} is now available."
- alias: "Startup Notification"
hide_entity: true
trigger:
platform: homeassistant
event: start
action:
- service: notify.pushbullet
data:
title: "HomeAssistant Startup"
message: "Home Assistant restarted."
# - service: input_number.set_value
# data_template:
# entity_id: input_number.ha_restart_count
# value: '{{ states.input_number.ha_restart_count.state | int + 1 }}'
- condition: state
entity_id: binary_sensor.new_version_check
state: 'on'
- service: persistent_notification.create
data:
title: 'HA Version'
message: 'This is a first run on a new HomeAssistant version.'
- service: shell_command.version_check_create_file
# - service: input_number.set_value
# data:
# entity_id: input_number.ha_restart_count
# value: '0'
# - alias: "Restart Count Reset"
# hide_entity: true
# trigger:
# platform: time
# after: '0:00:00'
# condition:
# - condition: template
# value_template: '{{ as_timestamp(now())|timestamp_custom("%w", true) | int == 0 }}'
# action:
# - service: input_slider.select_value
# data:
# entity_id: input_slider.ha_restart_count
# value: '0'
# - alias: "New Version Detected"
# hide_entity: true
# trigger:
# platform: state
# entity_id: binary_sensor.new_version_check
# to: 'on'
# action:
# - service: notify.pushbullet
# data:
# title: "HomeAssistant Version"
# message: "New Homeassistant version"
# - service: persistent_notification.create
# data:
# title: 'HA Version'
# message: 'This is a first run on a new HomeAssistant version.'
# - service: shell_command.version_check_create_file
group:
hass:
name: HomeAssistant
entities:
- sensor.ha_version
- sensor.pypi_version
- sensor.ha_last_restart
# - sensor.ha_restart_count
- sensor.ssl_expiry
- binary_sensor.mysensors_status
#input_number:
# ha_restart_count:
# min: 0
# max: 99
# step: 1
shell_command:
version_check_create_file: 'touch /srv/hasscfg/deps/version_file'
binary_sensor:
- platform: command_line
name: New Version Check
command: ' [ -e /srv/hasscfg/deps/version_file ] && echo "OFF" || echo "ON" '
scan_interval: 21600
#homeassistant:
# customize:
# input_number.ha_restart_count:
# hidden: true