From e5fe06641e0bc0dd428881400f6ca693bcf21f24 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Thu, 26 Aug 2021 12:22:39 +0200 Subject: [PATCH] Added DB size sensor --- customize.yaml | 2 ++ sensors.yaml | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/customize.yaml b/customize.yaml index 52f9a69..feef757 100644 --- a/customize.yaml +++ b/customize.yaml @@ -1,2 +1,4 @@ media_player.wohnzimmer_main: icon: mdi:audio-video +sensor.home_assistant_datenbankgrosse: + icon: mdi:database diff --git a/sensors.yaml b/sensors.yaml index 738cf1b..04b8076 100644 --- a/sensors.yaml +++ b/sensors.yaml @@ -10,3 +10,11 @@ - platform: dwd_weather_warnings name: "DWD Unwetterwarnungen" 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