From f901fcf84028689e98ea4ff13fb27423d05d86a4 Mon Sep 17 00:00:00 2001
From: Jan Grewe <jan@faked.org>
Date: Fri, 26 Aug 2022 23:13:21 +0200
Subject: [PATCH] move prometheus config to devices because of relabeling

---
 base.yaml          | 23 ++---------------------
 propbox-fan.yaml   |  3 +++
 propbox-light.yaml |  3 +++
 propbox.yaml       | 28 ++++++++++++++++++++++++++++
 4 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/base.yaml b/base.yaml
index 30d6685..23171ee 100644
--- a/base.yaml
+++ b/base.yaml
@@ -43,33 +43,14 @@ web_server:
   local: true
   # include_internal: true
 
-prometheus:
-  include_internal: true
-  filters:
-    map:
-      - Wifi Signal -> RSSI
-      - wifi_signal -> rssi
-      - Device Uptime -> Uptime
-      - device_uptime -> uptime
-      - "Status: Light -> Light"
-      - status_light -> light
-      - "Status: Fan -> Fan"
-      - status_fan -> fan
-      - "Sensor: Temperature -> Temperature"
-      - sensor_temperature -> temperature
-      - "Sensor: Humidity -> Humidity"
-      - sensor_humidity -> humidity
-      - "Sensor: Pressure -> Pressure"
-      - sensor_pressure -> pressure
-      - "Sensor: Water Temperature -> Temperature Water"
-      - sensor_water_temperature -> temperature_water
-
 sensor:
   - platform: wifi_signal
+    id: rssi
     name: "Wifi Signal"
     update_interval: 60s
 
   - platform: uptime
+    id: device_uptime
     name: "Device Uptime"
     update_interval: 60s
 
diff --git a/propbox-fan.yaml b/propbox-fan.yaml
index 067d457..65c1d7a 100644
--- a/propbox-fan.yaml
+++ b/propbox-fan.yaml
@@ -8,4 +8,7 @@ substitutions:
 packages:
   device_base: !include base.yaml
 
+prometheus:
+  include_internal: true
+
 <<: !include include/nous_a1t.yaml
diff --git a/propbox-light.yaml b/propbox-light.yaml
index 7d7f344..121a904 100644
--- a/propbox-light.yaml
+++ b/propbox-light.yaml
@@ -8,4 +8,7 @@ substitutions:
 packages:
   device_base: !include base.yaml
 
+prometheus:
+  include_internal: true
+
 <<: !include include/nous_a1t.yaml
diff --git a/propbox.yaml b/propbox.yaml
index 58edc5e..a90679a 100644
--- a/propbox.yaml
+++ b/propbox.yaml
@@ -35,6 +35,34 @@ http_request:
   useragent: esphome/${devicename}
   timeout: 10s
 
+prometheus:
+  include_internal: true
+  relabel:
+    rssi:
+      id: rssi
+      name: RSSI
+    device_uptime:
+      id: uptime
+      name: Uptime
+    propbox_light:
+      id: light
+      name: Light
+    propbox_fan:
+      id: fan
+      name: Fan
+    temperature:
+      id: temperature
+      name: Temperature
+    humidity:
+      id: humidity
+      name: Humidity
+    pressure:
+      id: pressure
+      name: Pressure
+    temperature_water:
+      id: temperature_water
+      name: "Temperature Water"
+
 sensor:
   - platform: bme280
     address: 0x76
-- 
GitLab