Added DB size sensor

This commit is contained in:
Marcus Scholz 2021-08-26 12:22:39 +02:00
parent 4678a7c7de
commit e5fe06641e
2 changed files with 10 additions and 0 deletions

View File

@ -1,2 +1,4 @@
media_player.wohnzimmer_main: media_player.wohnzimmer_main:
icon: mdi:audio-video icon: mdi:audio-video
sensor.home_assistant_datenbankgrosse:
icon: mdi:database

View File

@ -10,3 +10,11 @@
- platform: dwd_weather_warnings - platform: dwd_weather_warnings
name: "DWD Unwetterwarnungen" name: "DWD Unwetterwarnungen"
region_name: "Münster-Süd" region_name: "Münster-Süd"
# Database size sensor
- platform: sql
db_url: !secret ha_recorder_dburl
queries:
- name: "Home Assistant Datenbankgröße"
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