Просмотр исходного кода

Tongou QCB2: expose online_state as a switch rather than sensor

From observing the Tuya app's activity, it was seen that despite the
name, this is not just an indication of the connectivity, but is used
to trigger frequent updates of power/current/voltage data when these
are being observed rather than every 10 minutes as the default update
rate on these devices seems to be.

Making this available as a switch allows an automation to regularly
trigger real time updates to keep the data flowing from the device.

Discussion #1483
Jason Rumney 2 лет назад
Родитель
Сommit
a5ca25fa17

+ 7 - 4
custom_components/tuya_local/devices/tongou_qcb2_circuitbreaker.yaml

@@ -231,18 +231,21 @@ secondary_entities:
           - dps_val: Trip
             value: Trip
             icon: "mdi:electric-switch"
-  - entity: binary_sensor
-    class: connectivity
-    category: diagnostic
+  - entity: switch
+    category: config
+    name: Live updates
+    icon: "mdi:chart-bar"
     dps:
       - id: 109
         type: string
-        name: sensor
+        name: switch
         mapping:
           - dps_val: online
             value: true
           - dps_val: offline
             value: false
+          - value: false
+            hidden: true
   - entity: event
     dps:
       - id: 110

+ 7 - 4
custom_components/tuya_local/devices/tongou_qcb2_singlephasebreaker.yaml

@@ -147,18 +147,21 @@ secondary_entities:
           - dps_val: Trip
             value: Trip
             icon: "mdi:electric-switch"
-  - entity: binary_sensor
-    class: connectivity
-    category: diagnostic
+  - entity: switch
+    category: config
+    name: Live updates
+    icon: "mdi:chart-bar"
     dps:
       - id: 109
         type: string
-        name: sensor
+        name: switch
         mapping:
           - dps_val: online
             value: true
           - dps_val: offline
             value: false
+          - value: false
+            hidden: true
   - entity: event
     dps:
       - id: 110