Ver Fonte

lscp move diag to common

Patryk M. Gutowski há 2 meses atrás
pai
commit
0262a9c54e
4 ficheiros alterados com 35 adições e 136 exclusões
  1. 30 0
      common/diag.yaml
  2. 0 49
      lscp01.yaml
  3. 0 38
      lscp02.yaml
  4. 5 49
      lscp03.yaml

+ 30 - 0
common/diag.yaml

@@ -7,6 +7,28 @@ button:
     entity_category: diagnostic
 
 sensor:
+  - platform: uptime
+    name: Uptime Sensor
+    id: uptime_sensor
+    update_interval: 60s
+    on_raw_value:
+      then:
+        - text_sensor.template.publish:
+            id: uptime_human
+            state: !lambda |-
+              int seconds = round(id(uptime_sensor).raw_state);
+              int days = seconds / (24 * 3600);
+              seconds = seconds % (24 * 3600);
+              int hours = seconds / 3600;
+              seconds = seconds % 3600;
+              int minutes = seconds /  60;
+              seconds = seconds % 60;
+              return (
+                (days ? to_string(days) + "d " : "") +
+                (hours ? to_string(hours) + "h " : "") +
+                (minutes ? to_string(minutes) + "m " : "") +
+                (to_string(seconds) + "s")
+              ).c_str();
   - platform: wifi_signal
     name: "${friendly_devicename} WiFi Signal"
     id: ${low_devicename}_wifi_signal
@@ -30,3 +52,11 @@ binary_sensor:
 text_sensor:
   - platform: version
     name: "${friendly_devicename} Version"
+  - platform: template
+    name: Uptime Human Readable
+    id: uptime_human
+    icon: mdi:clock-start
+  - platform: wifi_info
+    ip_address:
+      name: IP Address
+      entity_category: diagnostic

+ 0 - 49
lscp01.yaml

@@ -14,8 +14,6 @@ esphome:
 
 bk72xx:
   board: generic-bk7231t-qfn32-tuya
-  #framework:
-  #   version: dev
 
 packages:
   # Enable Home Assistant API
@@ -36,32 +34,6 @@ wifi:
 
 
 sensor:
-  - platform: wifi_signal
-    name: "WiFi Signal Sensor"
-    update_interval: 60s
-
-  - platform: uptime
-    name: Uptime Sensor
-    id: uptime_sensor
-    update_interval: 60s
-    on_raw_value:
-      then:
-        - text_sensor.template.publish:
-            id: uptime_human
-            state: !lambda |-
-              int seconds = round(id(uptime_sensor).raw_state);
-              int days = seconds / (24 * 3600);
-              seconds = seconds % (24 * 3600);
-              int hours = seconds / 3600;
-              seconds = seconds % 3600;
-              int minutes = seconds /  60;
-              seconds = seconds % 60;
-              return (
-                (days ? to_string(days) + "d " : "") +
-                (hours ? to_string(hours) + "h " : "") +
-                (minutes ? to_string(minutes) + "m " : "") +
-                (to_string(seconds) + "s")
-              ).c_str();
 #
 # power monitoring
 #
@@ -170,18 +142,6 @@ sensor:
           max_value: 1
     update_interval: never
 
-
-
-text_sensor:
-  - platform: template
-    name: Uptime Human Readable
-    id: uptime_human
-    icon: mdi:clock-start
-  - platform: wifi_info
-    ip_address:
-      name: IP Address
-      entity_category: diagnostic
-
 light:
   - platform: binary
     name: "led"
@@ -189,7 +149,6 @@ light:
     id: led
     output: red_led
 
-
 output:
   - platform: gpio
     id: red_led
@@ -197,17 +156,12 @@ output:
       number: P8
       # inverted: true
 
-
 status_led:
     pin:
       number: P10
       # inverted: true
 
 binary_sensor:
-  # - platform: status
-  #   name: Status
-  #  entity_category: diagnostic
-
   - platform: gpio
     pin:
       number: P7
@@ -222,9 +176,6 @@ binary_sensor:
     on_click:
       - switch.toggle: outlet
 
-  # - platform: status
-  #  name: ${friendly_devicename} status
-
 switch:
   - platform: gpio
     name: ${friendly_devicename} Outlet

+ 0 - 38
lscp02.yaml

@@ -34,32 +34,6 @@ wifi:
 
 
 sensor:
-  - platform: wifi_signal
-    name: "WiFi Signal Sensor"
-    update_interval: 60s
-
-  - platform: uptime
-    name: Uptime Sensor
-    id: uptime_sensor
-    update_interval: 60s
-    on_raw_value:
-      then:
-        - text_sensor.template.publish:
-            id: uptime_human
-            state: !lambda |-
-              int seconds = round(id(uptime_sensor).raw_state);
-              int days = seconds / (24 * 3600);
-              seconds = seconds % (24 * 3600);
-              int hours = seconds / 3600;
-              seconds = seconds % 3600;
-              int minutes = seconds /  60;
-              seconds = seconds % 60;
-              return (
-                (days ? to_string(days) + "d " : "") +
-                (hours ? to_string(hours) + "h " : "") +
-                (minutes ? to_string(minutes) + "m " : "") +
-                (to_string(seconds) + "s")
-              ).c_str();
 #
 # power monitoring
 #
@@ -168,18 +142,6 @@ sensor:
           max_value: 1
     update_interval: never
 
-
-
-text_sensor:
-  - platform: template
-    name: Uptime Human Readable
-    id: uptime_human
-    icon: mdi:clock-start
-  - platform: wifi_info
-    ip_address:
-      name: IP Address
-      entity_category: diagnostic
-
 light:
   - platform: binary
     name: "led"

+ 5 - 49
lscp03.yaml

@@ -8,15 +8,18 @@ substitutions:
 esphome:
   name: $devicename
   friendly_name: $friendly_devicename
+  platformio_options:
+    lib_ignore:
+      - RPAsyncTCP
+
 
 bk72xx:
   board: generic-bk7231t-qfn32-tuya
-  #framework:
-  #   version: dev
 
 packages:
   # Enable Home Assistant API
   esphome: !include common/keys.yaml
+  diag: !include common/diag.yaml
 
 logger:
 
@@ -30,32 +33,6 @@ wifi:
 
 
 sensor:
-  - platform: wifi_signal
-    name: "WiFi Signal Sensor"
-    update_interval: 60s
-
-  - platform: uptime
-    name: Uptime Sensor
-    id: uptime_sensor
-    update_interval: 60s
-    on_raw_value:
-      then:
-        - text_sensor.template.publish:
-            id: uptime_human
-            state: !lambda |-
-              int seconds = round(id(uptime_sensor).raw_state);
-              int days = seconds / (24 * 3600);
-              seconds = seconds % (24 * 3600);
-              int hours = seconds / 3600;
-              seconds = seconds % 3600;
-              int minutes = seconds /  60;
-              seconds = seconds % 60;
-              return (
-                (days ? to_string(days) + "d " : "") +
-                (hours ? to_string(hours) + "h " : "") +
-                (minutes ? to_string(minutes) + "m " : "") +
-                (to_string(seconds) + "s")
-              ).c_str();
 #
 # power monitoring
 #
@@ -164,18 +141,6 @@ sensor:
           max_value: 1
     update_interval: never
 
-
-
-text_sensor:
-  - platform: template
-    name: Uptime Human Readable
-    id: uptime_human
-    icon: mdi:clock-start
-  - platform: wifi_info
-    ip_address:
-      name: IP Address
-      entity_category: diagnostic
-
 light:
   - platform: binary
     name: "led"
@@ -183,7 +148,6 @@ light:
     id: led
     output: red_led
 
-
 output:
   - platform: gpio
     id: red_led
@@ -191,17 +155,12 @@ output:
       number: P8
       # inverted: true
 
-
 status_led:
     pin:
       number: P10
       # inverted: true
 
 binary_sensor:
-  - platform: status
-    name: Status
-    entity_category: diagnostic
-
   - platform: gpio
     pin:
       number: P7
@@ -216,9 +175,6 @@ binary_sensor:
     on_click:
       - switch.toggle: outlet
 
-  - platform: status
-    name: ${friendly_devicename} status
-
 switch:
   - platform: gpio
     name: ${friendly_devicename} Outlet