-
Notifications
You must be signed in to change notification settings - Fork 49
/
system_sensors.yaml
183 lines (161 loc) · 6.75 KB
/
system_sensors.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
system_sensors:
recorder:
db_url: !secret db_link
# db_url: sqlite:////config/home-assistant_v2.db
purge_keep_days: 7
auto_purge: true
commit_interval: 60
include:
entities:
# - binary_sensor.rpi_power_status
- sensor.processor_use
- sensor.disk_use_percent
- sensor.memory_use_percent
- sensor.disk_free
- sensor.processor_temperature
- sensor.home_assistant_v2_db_size
- sensor.maria_db
- sensor.file_editor_cpu_percent
- sensor.home_assistant_google_drive_backup_cpu_percent
- sensor.mariadb_cpu_percent
- sensor.mosquitto_broker_cpu_percent
- sensor.samba_share_cpu_percent
- sensor.zigbee2mqtt_cpu_percent
- sensor.zigbee2mqtt_cpu_percent_2
# exclude:
# event_types:
# - call_service
# - service_removed
# - service_executed
# - platform_discovered
# - homeassistant_start
# - feedreader
# - service_registered
# - component_loaded
# - logbook_entry
# - system_log_event
homeassistant:
customize:
sensor.processor_use:
friendly_name: Загрузка процессора
sensor.disk_use_percent:
friendly_name: Использование диска
sensor.disk_free:
friendly_name: Свободно на диске
sensor.processor_temperature:
friendly_name: Температура процессора
sensor.memory_use_percent:
friendly_name: Использование ОЗУ
sensor.home_assistant_v2_db_size:
friendly_name: Объем базы HA
sensor.maria_db:
friendly_name: Объем базы Maria DB
sensor.online_custom:
friendly_name: Home Assistant в онлайне -
sensor.last_boot_custom:
friendly_name: Сервер в онлайне -
sensor.custom_time:
friendly_name: Текущее время -
command_line:
- sensor:
name: supervisor_updates
command: 'curl http://supervisor/supervisor/info -H "Authorization: Bearer $(printenv SUPERVISOR_TOKEN)" | jq ''{"newest_version":.data.version_latest,"current_version":.data.version,"update_available":.data.update_available,"addons":[.data.addons[] | select(.update_available)]}'''
value_template: "{{ value_json.addons | length }}"
unit_of_measurement: доступно обновлений
json_attributes:
- update_available
- newest_version
- current_version
- addons
sensor:
- platform: systemmonitor
resources:
- type: processor_use
- type: disk_use_percent
arg: /
- type: memory_use_percent
- type: last_boot
- type: disk_free
arg: /
- type: processor_temperature
# Платформа перенесена в UI
# - platform: filesize
# file_paths:
# - /config/home-assistant_v2.db
# - platform: sql
# db_url: !secret db_link
# queries:
# - name: maria_db
# query: 'SELECT table_schema "database", Round(Sum(data_length + index_length) / 1048576, 2) "value" FROM information_schema.tables WHERE table_schema="homeassistant" GROUP BY table_schema;'
# column: 'value'
# unit_of_measurement: MB
# Платформа перенесена в UI
# - platform: uptime
# name: online
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'time_date'
# Платформа перенесена в UI
# binary_sensor:
# - platform: workday
# country: UA
template:
- trigger:
- platform: time_pattern
seconds: "/30"
sensor:
- name: time_1_sec
state: '{{ as_timestamp(now()) | round(default=0)}}'
- sensor:
- name: custom_time
state: >
{{states("sensor.time_1_sec") | int | timestamp_custom("%H:%M:%S") }}
- name: current_month
unique_id: current_month
state: >
{% set month_num = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"] %}
{% set month_of_year = month_num[now().month-1] %}
{{ month_of_year }}
- name: last_month
unique_id: last_month
state: >
{% set month_num = ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"] %}
{% set month_of_year = month_num[now().month-2] %}
{{ month_of_year }}
# Время с последней перезагрузки Home Assistant
- name: online_custom
state: >
{% set s = (states("sensor.time_1_sec") | int - as_timestamp(states('sensor.online')) | int) %}
{{ '{:d} дн. {:02d}:{:02d}:{:02d}'.format (s // 86400, s % 86400 // 3600, s % 3600 // 60, s % 60) }}
# {% set uptime = as_timestamp (now()) -as_timestamp(states('sensor.online')) | int %}
# {% set minutes = (( uptime % 3600) / 60) | int %}
# {% set hours = ((uptime % 86400) / 3600) | int %}
# {% set days = (uptime / 86400) | int %}
# {% if uptime < 60 %}
# Меньше минуты
# {% else %}
# {% if days > 0 %}
# {{ days }} д.
# {% endif %}
# {% if hours > 0 %}
# {% if days > 0 %}
# {{ ' ' }}
# {% endif %}
# {{ hours }} ч.
# {% endif %}
# {% if minutes > 0 %}
# {% if days > 0 or hours > 0 %}
# {{ ' ' }}
# {% endif %}
# {{ minutes }} мин.
# {% endif %}
# {% endif %}
# icon: mdi:clock
# Время с последней перезагрузки сервера
- name: last_boot_custom
state: >
{% set s = (states("sensor.time_1_sec") | int - as_timestamp(states('sensor.last_boot')) | int) %}
{{ '{:d} дн. {:02d}:{:02d}:{:02d}'.format (s // 86400, s % 86400 // 3600, s % 3600 // 60, s % 60) }}