Преглед изворни кода

Add support for Neo Siren Alarm 2

Issue #3137

update siren docs to match current implementation
Jason Rumney пре 9 месеци
родитељ
комит
6265ebb8d0

+ 1 - 0
ACKNOWLEDGEMENTS.md

@@ -929,3 +929,4 @@ Further device support has been made with the assistance of users. Please consid
 - [maksim-petukhov](https://github.com/maksim-petukhov) for assisting with support for Fral Super Cool FSC14.2 DH portable air conditioner.
 - [MchlLyn](https://github.com/MchlLyn) for assisting with support for dé Wall Charger (3-phase 22Kw).
 - [diegoschefer](https://github.com/diegoschefer) for assisting with support for Zemismart ZM85EL-1x roller blind motor.
+- [sangphan12](https://github.com/sangphan12) for assisting with support for Neo Siren Alarm 2.

+ 1 - 1
DEVICES.md

@@ -1040,6 +1040,7 @@ entity types as sub devices.
 - Nedis ZBRC10WT 4 button remote control
 - Nedis ZBSD10WT door/window sensor
 - Nedis ZBSC10WT temperature and humidity sensor
+- Neo Siren Alarm 2
 - PY321-Z-TY energy meter
 - Smart air box BR V2
 - Temperature and humidity sensor with alarm feature
@@ -1048,7 +1049,6 @@ entity types as sub devices.
 - Zemismart SPM01 energy meter
 - Zemismart ZM85EL-1x roller blind motor
 - ZPmeter 214C-Z water meter (with and without valve control)
-
 - ZTH08ZTU temperature and humidity sensor
 
 NOTE: this project does not intend to expand the scope to support non-Tuya

+ 3 - 3
custom_components/tuya_local/devices/README.md

@@ -739,9 +739,9 @@ no information will be available about which specific credential was used to unl
     This may be useful for devices that switch between C and F, otherwise a fixed unit attribute on the **sensor** dp can be used.
 
 ### `siren`
-- **tone** (required, mapping of strings): a dp to report and control the siren tone. As this is used to turn on and off the siren, it is required. If this does not fit your siren, the underlying implementation will need to be modified.
-The value "off" will be used for turning off the siren, and will be filtered from the list of available tones. One value must be marked as `default: true` so that the `turn_on` service with no commands works.
-- **volume** (optional, float in range 0.0-1.0): a dp to control the volume of the siren (probably needs a scale and step applied, since Tuya devices will probably use an integer, or strings with fixed values).
+- **switch** (optional, boolean): a dp to switch the siren on and off (depending on the siren, this may trigger it, or arm it for auto triggering). If this is not used, then the **tone** must be present, and containing an "off" option.
+- **tone** (optional, mapping of strings): a dp to report and control the siren tone. This dp is required is there is no **switch**, in which case the value "off" will be used for turning off the siren, and will be filtered from the list of available tones. When the **switch** dp is not used, one value must be marked as `default: true` so that the `turn_on` service with no commands works.
+- **volume_level** (optional, float in range 0.0-1.0): a dp to control the volume of the siren (probably needs a scale and step applied, since Tuya devices will probably use an integer, or strings with fixed values).
 - **duration** (optional, integer): a dp to control how long the siren will sound for.
 
 ### `switch`

+ 79 - 0
custom_components/tuya_local/devices/neo_zigbee_siren.yaml

@@ -0,0 +1,79 @@
+name: Siren alarm
+products:
+  - id: t1blo2bj
+    manufacturer: Neo
+    model: Siren Alarm 2
+entities:
+  - entity: siren
+    dps:
+      - id: 5
+        type: string
+        optional: true
+        name: volume_level
+        mapping:
+          - dps_val: low
+            value: 0.3
+          - dps_val: middle
+            value: 0.6
+          - dps_val: high
+            value: 1.0
+      - id: 7
+        type: integer
+        name: duration
+        unit: s
+        range:
+          min: 0
+          max: 1800
+      - id: 13
+        type: boolean
+        name: switch
+      - id: 21
+        type: string
+        name: tone
+        mapping:
+          - dps_val: mode_1
+            value: Type 1
+          - dps_val: mode_2
+            value: Type 2
+          - dps_val: mode_3
+            value: Type 3
+          - dps_val: mode_4
+            value: Type 4
+          - dps_val: mode_5
+            value: Type 5
+          - dps_val: mode_6
+            value: Type 6
+          - dps_val: mode_7
+            value: Type 7
+          - dps_val: mode_8
+            value: Type 8
+          - dps_val: mode_9
+            value: Type 9
+          - dps_val: mode_10
+            value: Type 10
+          - dps_val: mode_11
+            value: Type 11
+          - dps_val: mode_12
+            value: Type 12
+          - dps_val: mode_13
+            value: Type 13
+          - dps_val: mode_14
+            value: Type 14
+          - dps_val: mode_15
+            value: Type 15
+          - dps_val: mode_16
+            value: Type 16
+          - dps_val: mode_17
+            value: Type 17
+          - dps_val: mode_18
+            value: Type 18
+  - entity: sensor
+    class: battery
+    category: diagnostic
+    dps:
+      - id: 15
+        type: integer
+        optional: true
+        name: sensor
+        unit: "%"
+        class: measurement