34 lines
894 B
YAML
34 lines
894 B
YAML
sensor:
|
|
- 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
|
|
|
|
# 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
|
|
- 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
|