2022-05-11 16:41:13 +10:00
|
|
|
sensor:
|
2022-07-19 18:53:10 +10:00
|
|
|
# - platform: sql
|
|
|
|
# db_url: !secret recorder_db
|
|
|
|
# queries:
|
|
|
|
# - name: Recorder age
|
|
|
|
# column: "last_state_age"
|
|
|
|
# unit_of_measurement: seconds
|
|
|
|
# ## For SQLite
|
|
|
|
# #query: >
|
|
|
|
# # SELECT strftime("%s", "now") - strftime("%s", last_updated)
|
|
|
|
# # AS last_state_age
|
|
|
|
# # , last_updated
|
|
|
|
# # FROM "states"
|
|
|
|
# # ORDER BY last_updated DESC
|
|
|
|
# # LIMIT 1
|
2022-05-11 16:41:13 +10:00
|
|
|
|
2022-07-19 18:53:10 +10:00
|
|
|
# # For Postgres
|
|
|
|
# query: >
|
|
|
|
# SELECT extract(epoch from now() - last_updated)
|
|
|
|
# AS last_state_age
|
|
|
|
# , last_updated
|
|
|
|
# FROM "states"
|
|
|
|
# ORDER BY last_updated DESC
|
|
|
|
# LIMIT 1
|
2022-05-11 16:41:13 +10:00
|
|
|
- platform: systemmonitor
|
|
|
|
resources:
|
|
|
|
- type: disk_use_percent
|
|
|
|
arg: /config
|
|
|
|
- type: memory_use_percent
|
|
|
|
- type: load_1m
|
|
|
|
- type: load_5m
|
|
|
|
- type: load_15m
|
|
|
|
- type: processor_use
|