Переглянути джерело

Add support fo oLight Spheres (#4149)

* Add support fo oLight Spheres

This device file adds support for oLight Sphere (https://www.olight.com/store/sphere-ambient-light-with-app-control).
It's BLE Mesh device that needs a BLE gateway and doesn't support Tuya Cloud method for obtaining the private keys (see this: https://community.home-assistant.io/t/integrating-olight-spheres-in-ha/907929/2).

* Fixed timer and sleep

* Removed blank lines

* Battery needs force: true

* Removed extra blank lines.

* Rmoved hidden from sleep and added optional to battery

* feat (olight_sphere_light): changes from review

- rename file to include device type, per convention
- top level name should be generic
- translate scenes values to English
- Remove available attributes - per comments the device always has these features, just isn't reporting them.

PR #4149

---------

Co-authored-by: Jason Rumney <make-all@users.noreply.github.com>
Marco Lusini 2 місяців тому
батько
коміт
63bceff0e1

+ 164 - 0
custom_components/tuya_local/devices/olight_sphere_light.yaml

@@ -0,0 +1,164 @@
+name: Ambient light
+products:
+  - id: d0dpga0h
+    manufacturer: oLight
+    model: Sphere C
+entities:
+  - entity: light
+    dps:
+      - id: 1
+        type: boolean
+        name: switch
+      - id: 2
+        name: color_mode
+        type: string
+        optional: true
+        mapping:
+          - dps_val: white
+            value: color_temp
+          - dps_val: colour
+            value: hs
+          - dps_val: scene
+            value: scene
+          - dps_val: music
+            value: music
+          - dps_val: null
+            value: color_temp
+            hidden: true
+      - id: 3
+        name: brightness
+        type: integer
+        optional: true
+        range:
+          min: 10
+          max: 1000
+      - id: 4
+        name: color_temp
+        optional: true
+        type: integer
+        range:
+          min: 0
+          max: 1000
+        mapping:
+          - target_range:
+              min: 2700
+              max: 6500
+      - id: 5
+        name: rgbhsv
+        type: hex
+        optional: true
+        format:
+          - name: h
+            bytes: 2
+            range:
+              min: 0
+              max: 360
+          - name: s
+            bytes: 2
+            range:
+              min: 0
+              max: 1000
+          - name: v
+            bytes: 2
+            range:
+              min: 0
+              max: 1000
+  - entity: select
+    translation_key: scene
+    category: config
+    dps:
+      - id: 102
+        type: string
+        name: option
+        optional: true
+        mapping:
+          - dps_val: colour_1
+            value: Colorful
+          - dps_val: colour_2
+            value: Aurora
+          - dps_val: colour_3
+            value: Fireworks
+          - dps_val: colour_4
+            value: Fountain
+          - dps_val: colour_5
+            value: colour_5
+          - dps_val: colour_6
+            value: Spiral
+          - dps_val: colour_7
+            value: colour_7
+          - dps_val: colour_8
+            value: Red lightning
+          - dps_val: colour_9
+            value: Confetti
+          - dps_val: colour_10
+            value: Butterflies
+          - dps_val: colour_11
+            value: Flow
+          - dps_val: colour_12
+            value: Gradient
+          - dps_val: colour_13
+            value: Carousel
+          - dps_val: colour_14
+            value: colour_14
+          - dps_val: colour_15
+            value: Magic ball
+          - dps_val: colour_16
+            value: Lilac
+          - dps_val: colour_17
+            value: Sunset
+          - dps_val: colour_18
+            value: Vibrant
+          - dps_val: colour_19
+            value: colour_19
+          - dps_val: colour_20
+            value: Red light
+          - dps_val: colour_21
+            value: Blue sky
+          - dps_val: colour_22
+            value: colour_22
+          - dps_val: colour_23
+            value: colour_23
+          - dps_val: colour_24
+            value: Harvest
+          - dps_val: colour_25
+            value: Ghost fire
+          - dps_val: colour_26
+            value: Zombie
+          - dps_val: colour_27
+            value: colour_27
+          - dps_val: colour_28
+            value: Purple ghost
+          - dps_val: colour_29
+            value: Christmas
+          - dps_val: colour_30
+            value: Candy cane
+          - dps_val: colour_31
+            value: Snow
+  - entity: time
+    translation_key: timer
+    category: config
+    dps:
+      - id: 7
+        type: integer
+        optional: true
+        name: second
+        range:
+          min: 0
+          max: 86400
+  - entity: sensor
+    class: battery
+    dps:
+      - id: 103
+        type: integer
+        optional: true
+        name: sensor
+        unit: "%"
+        force: true
+  - entity: switch
+    translation_key: sleep
+    category: config
+    dps:
+      - id: 104
+        type: boolean
+        optional: true
+        name: switch