]> git.basschouten.com Git - openhab-addons.git/commitdiff
[miio] add support for Yeelight Dual Control Module (yeelink.switch.sw1) (#9295)
authorMarcel <marcel@verpaalen.com>
Tue, 8 Dec 2020 18:03:25 +0000 (10:03 -0800)
committerGitHub <noreply@github.com>
Tue, 8 Dec 2020 18:03:25 +0000 (10:03 -0800)
Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
bundles/org.openhab.binding.miio/README.md
bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java
bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.switch.sw1-miot.json [new file with mode: 0644]

index 8d7d877d6d677a200fb4ca2f99fe09e2e3ca56f1..f3ea85722c6f9bbb48480bbfb1832313376f64a3 100644 (file)
@@ -326,6 +326,7 @@ Currently the miio binding supports more than 210 different models.
 | Yeelight Color Bulb YLDP06YL 10W | miio:basic       | [yeelink.light.color2](#yeelink-light-color2) | Yes       |            |
 | Yeelight Color Bulb YLDP02YL 9W | miio:basic       | [yeelink.light.color3](#yeelink-light-color3) | Yes       |            |
 | Yeelight Bulb YLDP13YL (8,5W) | miio:basic       | [yeelink.light.color4](#yeelink-light-color4) | Yes       |            |
+| Yeelight Dual Control Module | miio:basic       | [yeelink.switch.sw1](#yeelink-switch-sw1) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
 | Yeelight yilai ceiling       | miio:basic       | [yilai.light.ceiling1](#yilai-light-ceiling1) | Yes       |            |
 | Yeelight yilai ceiling       | miio:basic       | [yilai.light.ceiling2](#yilai-light-ceiling2) | Yes       |            |
 | Yeelight yilai ceiling       | miio:basic       | [yilai.light.ceiling3](#yilai-light-ceiling3) | Yes       |            |
@@ -3236,6 +3237,20 @@ e.g. `smarthome:send actionCommand 'upd_timer["1498595904821", "on"]'` would ena
 | rgbColor         | Color   | RGB Color                           |            |
 | name             | String  | Name                                |            |
 
+### Yeelight Dual Control Module (<a name="yeelink-switch-sw1">yeelink.switch.sw1</a>) Channels
+
+| Channel          | Type    | Description                         | Comment    |
+|------------------|---------|-------------------------------------|------------|
+| on               | Switch  | First Switch - Switch Status        |            |
+| mode             | Number  | First Switch Default - Mode         | Value mapping [0="Off",1="On"] |
+| mode1            | Number  | First Switch - Delay                |            |
+| on1              | Switch  | Second Switch - Switch Status       |            |
+| mode2            | Number  | Second Switch Default - Mode        | Value mapping [0="Off",1="On"] |
+| mode3            | Number  | Second Switch Service - Delay       |            |
+| interlock        | Switch  | Extension - Interlock               |            |
+| flash            | Number  | Extension - Flash                   |            |
+| rc-list          | String  | Extension - Rc List                 |            |
+
 ### Yeelight yilai ceiling (<a name="yilai-light-ceiling1">yilai.light.ceiling1</a>) Channels
 
 | Channel          | Type    | Description                         | Comment    |
@@ -6724,6 +6739,23 @@ Color rgbColor "RGB Color" (G_light) {channel="miio:basic:light:rgbColor"}
 String name "Name" (G_light) {channel="miio:basic:light:name"}
 ```
 
+### Yeelight Dual Control Module (yeelink.switch.sw1) item file lines
+
+note: Autogenerated example. Replace the id (switch) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered.
+
+```java
+Group G_switch "Yeelight Dual Control Module" <status>
+Switch on "First Switch - Switch Status" (G_switch) {channel="miio:basic:switch:on"}
+Number mode "First Switch Default - Mode" (G_switch) {channel="miio:basic:switch:mode"}
+Number mode1 "First Switch - Delay" (G_switch) {channel="miio:basic:switch:mode1"}
+Switch on1 "Second Switch - Switch Status" (G_switch) {channel="miio:basic:switch:on1"}
+Number mode2 "Second Switch Default - Mode" (G_switch) {channel="miio:basic:switch:mode2"}
+Number mode3 "Second Switch Service - Delay" (G_switch) {channel="miio:basic:switch:mode3"}
+Switch interlock "Extension - Interlock" (G_switch) {channel="miio:basic:switch:interlock"}
+Number flash "Extension - Flash" (G_switch) {channel="miio:basic:switch:flash"}
+String rc-list "Extension - Rc List" (G_switch) {channel="miio:basic:switch:rc-list"}
+```
+
 ### Yeelight yilai ceiling (yilai.light.ceiling1) item file lines
 
 note: Autogenerated example. Replace the id (light) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered.
index 3e9ca19b70c69f5b3f84fbedfa1fbde91040cebf..c21d23e986e5a147d8fb3b5beca8156df457956b 100644 (file)
@@ -260,6 +260,7 @@ public enum MiIoDevices {
     YEELIGHT_C2("yeelink.light.color2", "Yeelight Color Bulb YLDP06YL 10W", THING_TYPE_BASIC),
     YEELIGHT_C3("yeelink.light.color3", "Yeelight Color Bulb YLDP02YL 9W", THING_TYPE_BASIC),
     YEELIGHT_C4("yeelink.light.color4", "Yeelight Bulb YLDP13YL (8,5W)", THING_TYPE_BASIC),
+    YEELINK_SWITCH_SW1("yeelink.switch.sw1", "Yeelight Dual Control Module", THING_TYPE_BASIC),
     YL_CEILING1("yilai.light.ceiling1", "Yeelight yilai ceiling", THING_TYPE_BASIC),
     YL_CEILING2("yilai.light.ceiling2", "Yeelight yilai ceiling", THING_TYPE_BASIC),
     YL_CEILING3("yilai.light.ceiling3", "Yeelight yilai ceiling", THING_TYPE_BASIC),
diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.switch.sw1-miot.json b/bundles/org.openhab.binding.miio/src/main/resources/database/yeelink.switch.sw1-miot.json
new file mode 100644 (file)
index 0000000..969147f
--- /dev/null
@@ -0,0 +1,213 @@
+{
+       "deviceMapping": {
+               "id": [
+                       "yeelink.switch.sw1"
+               ],
+               "propertyMethod": "get_properties",
+               "maxProperties": 1,
+               "channels": [
+                       {
+                               "property": "on",
+                               "siid": 2,
+                               "piid": 1,
+                               "friendlyName": "First Switch - Switch Status",
+                               "channel": "on",
+                               "type": "Switch",
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "ONOFFBOOL"
+                                       }
+                               ],
+                               "tags": [
+                                       "Switch"
+                               ]
+                       },
+                       {
+                               "property": "mode",
+                               "siid": 2,
+                               "piid": 2,
+                               "friendlyName": "First Switch Default - Mode",
+                               "channel": "mode",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "options": [
+                                               {
+                                                       "value": "0",
+                                                       "label": "Off"
+                                               },
+                                               {
+                                                       "value": "1",
+                                                       "label": "On"
+                                               }
+                                       ]
+                               },
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "NUMBER"
+                                       }
+                               ],
+                               "tags": [
+                                       "Switch"
+                               ],
+                               "readmeComment": "Value mapping [0\u003d\"Off\",1\u003d\"On\"]"
+                       },
+                       {
+                               "property": "mode1",
+                               "siid": 2,
+                               "piid": 3,
+                               "friendlyName": "First Switch - Delay",
+                               "channel": "mode1",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "minimum": -1.0,
+                                       "maximum": 43200.0,
+                                       "step": 1.0,
+                                       "pattern": "%.1f"
+                               },
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "STRING"
+                                       }
+                               ],
+                               "tags": [
+                                       "Control"
+                               ]
+                       },
+                       {
+                               "property": "on1",
+                               "siid": 3,
+                               "piid": 1,
+                               "friendlyName": "Second Switch - Switch Status",
+                               "channel": "on1",
+                               "type": "Switch",
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "ONOFFBOOL"
+                                       }
+                               ],
+                               "tags": [
+                                       "Switch"
+                               ]
+                       },
+                       {
+                               "property": "mode2",
+                               "siid": 3,
+                               "piid": 2,
+                               "friendlyName": "Second Switch Default - Mode",
+                               "channel": "mode2",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "options": [
+                                               {
+                                                       "value": "0",
+                                                       "label": "Off"
+                                               },
+                                               {
+                                                       "value": "1",
+                                                       "label": "On"
+                                               }
+                                       ]
+                               },
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "NUMBER"
+                                       }
+                               ],
+                               "tags": [
+                                       "Switch"
+                               ],
+                               "readmeComment": "Value mapping [0\u003d\"Off\",1\u003d\"On\"]"
+                       },
+                       {
+                               "property": "mode3",
+                               "siid": 3,
+                               "piid": 3,
+                               "friendlyName": "Second Switch Service - Delay",
+                               "channel": "mode3",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "minimum": -1.0,
+                                       "maximum": 43200.0,
+                                       "step": 1.0,
+                                       "pattern": "%.1f"
+                               },
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "STRING"
+                                       }
+                               ],
+                               "tags": [
+                                       "Control"
+                               ]
+                       },
+                       {
+                               "property": "interlock",
+                               "siid": 4,
+                               "piid": 1,
+                               "friendlyName": "Extension - Interlock",
+                               "channel": "interlock",
+                               "type": "Switch",
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "ONOFFBOOL"
+                                       }
+                               ],
+                               "tags": [
+                                       "Switch"
+                               ]
+                       },
+                       {
+                               "property": "flash",
+                               "siid": 4,
+                               "piid": 2,
+                               "friendlyName": "Extension - Flash",
+                               "channel": "flash",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "minimum": 0.0,
+                                       "maximum": 1.0,
+                                       "step": 1.0,
+                                       "pattern": "%.0f"
+                               },
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "NUMBER"
+                                       }
+                               ],
+                               "tags": [
+                                       "Control"
+                               ]
+                       },
+                       {
+                               "property": "rc-list",
+                               "siid": 4,
+                               "piid": 3,
+                               "friendlyName": "Extension - Rc List",
+                               "channel": "rc-list",
+                               "type": "String",
+                               "stateDescription": {
+                                       "readOnly": true
+                               },
+                               "refresh": true,
+                               "actions": []
+                       }
+               ],
+               "experimental": true
+       }
+}