From e6dfd0c9468f9b4a901abb381163a61dbeaa3f58 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 4 Oct 2020 18:31:56 +0200 Subject: [PATCH] [miio] enable telnet for lumi gateway (#8639) * [miio] enable telnet for lumi gateway * allow enable telnet and some other functions on gateway * use new fw as default for chugmi plug Signed-off-by: Marcel Verpaalen --- bundles/org.openhab.binding.miio/README.md | 99 ++++++++++++++++++- .../binding/miio/internal/MiIoDevices.java | 7 +- .../resources/database/chuangmi.plug.v3.json | 2 +- .../database/chuangmi.plug.v3fw.json | 1 + .../main/resources/database/lumi.gateway.json | 80 +++++++++++++++ 5 files changed, 182 insertions(+), 7 deletions(-) create mode 100644 bundles/org.openhab.binding.miio/src/main/resources/database/lumi.gateway.json diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md index f0f70db8574..f64e5383e09 100644 --- a/bundles/org.openhab.binding.miio/README.md +++ b/bundles/org.openhab.binding.miio/README.md @@ -140,9 +140,10 @@ or in case of unknown models include the model information e.g.: | Xiaomi Mijia Smart Tower Fan | miio:basic | [dmaker.fan.p9](#dmaker-fan-p9) | Yes | | | Xiaomi Mijia Smart Tower Fan | miio:basic | [dmaker.fan.p10](#dmaker-fan-p10) | Yes | | | Viomi Internet refrigerator iLive | miio:unsupported | viomi.fridge.v3 | No | | -| Mi Smart Home Gateway v1 | miio:unsupported | lumi.gateway.v1 | No | | -| Mi Smart Home Gateway v2 | miio:unsupported | lumi.gateway.v2 | No | | -| Mi Smart Home Gateway v3 | miio:unsupported | lumi.gateway.v3 | No | | +| Mi Smart Home Gateway v1 | miio:basic | [lumi.gateway.v1](#lumi-gateway-v1) | Yes | | +| Mi Smart Home Gateway v2 | miio:basic | [lumi.gateway.v2](#lumi-gateway-v2) | Yes | | +| Mi Smart Home Gateway v3 | miio:basic | [lumi.gateway.v3](#lumi-gateway-v3) | Yes | | +| Xiaomi Mi Mijia Gateway V3 ZNDMWG03LM | miio:basic | [lumi.gateway.mgl03](#lumi-gateway-mgl03) | Yes | | | Mi Humdifier | miio:basic | [zhimi.humidifier.v1](#zhimi-humidifier-v1) | Yes | | | Light Control (Wall Switch) | miio:unsupported | lumi.ctrl_neutral1.v1 | No | | | Light Control (Wall Switch) | miio:unsupported | lumi.ctrl_neutral2.v1 | No | | @@ -1067,6 +1068,46 @@ e.g. `smarthome:send actionCommand 'upd_timer["1498595904821", "on"]'` would ena | SpeedLevel | Number | Fan-Speed Level | | PhysicalControlsLocked | Switch | Physical Control Locked-Physical Control Locked | +### Mi Smart Home Gateway v1 (lumi.gateway.v1) Channels + +| Channel | Type | Description | +|------------------|---------|-------------------------------------| +| telnetEnable | Switch | Enable Telnet | +| doorbellVol | Number | Doorbell Volume | +| gatewayVol | Number | Gateway Volume | +| alarmingVol | Number | Alarming Volume | +| doorbellPush | String | Doorbell Push | + +### Mi Smart Home Gateway v2 (lumi.gateway.v2) Channels + +| Channel | Type | Description | +|------------------|---------|-------------------------------------| +| telnetEnable | Switch | Enable Telnet | +| doorbellVol | Number | Doorbell Volume | +| gatewayVol | Number | Gateway Volume | +| alarmingVol | Number | Alarming Volume | +| doorbellPush | String | Doorbell Push | + +### Mi Smart Home Gateway v3 (lumi.gateway.v3) Channels + +| Channel | Type | Description | +|------------------|---------|-------------------------------------| +| telnetEnable | Switch | Enable Telnet | +| doorbellVol | Number | Doorbell Volume | +| gatewayVol | Number | Gateway Volume | +| alarmingVol | Number | Alarming Volume | +| doorbellPush | String | Doorbell Push | + +### Xiaomi Mi Mijia Gateway V3 ZNDMWG03LM (lumi.gateway.mgl03) Channels + +| Channel | Type | Description | +|------------------|---------|-------------------------------------| +| telnetEnable | Switch | Enable Telnet | +| doorbellVol | Number | Doorbell Volume | +| gatewayVol | Number | Gateway Volume | +| alarmingVol | Number | Alarming Volume | +| doorbellPush | String | Doorbell Push | + ### Mi Humdifier (zhimi.humidifier.v1) Channels | Channel | Type | Description | @@ -2806,6 +2847,58 @@ Number SpeedLevel "Fan-Speed Level" (G_fan) {channel="miio:basic:fan:SpeedLevel" Switch PhysicalControlsLocked "Physical Control Locked-Physical Control Locked" (G_fan) {channel="miio:basic:fan:PhysicalControlsLocked"} ``` +### Mi Smart Home Gateway v1 (lumi.gateway.v1) item file lines + +note: Autogenerated example. Replace the id (gateway) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +```java +Group G_gateway "Mi Smart Home Gateway v1" +Switch telnetEnable "Enable Telnet" (G_gateway) {channel="miio:basic:gateway:telnetEnable"} +Number doorbellVol "Doorbell Volume" (G_gateway) {channel="miio:basic:gateway:doorbellVol"} +Number gatewayVol "Gateway Volume" (G_gateway) {channel="miio:basic:gateway:gatewayVol"} +Number alarmingVol "Alarming Volume" (G_gateway) {channel="miio:basic:gateway:alarmingVol"} +String doorbellPush "Doorbell Push" (G_gateway) {channel="miio:basic:gateway:doorbellPush"} +``` + +### Mi Smart Home Gateway v2 (lumi.gateway.v2) item file lines + +note: Autogenerated example. Replace the id (gateway) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +```java +Group G_gateway "Mi Smart Home Gateway v2" +Switch telnetEnable "Enable Telnet" (G_gateway) {channel="miio:basic:gateway:telnetEnable"} +Number doorbellVol "Doorbell Volume" (G_gateway) {channel="miio:basic:gateway:doorbellVol"} +Number gatewayVol "Gateway Volume" (G_gateway) {channel="miio:basic:gateway:gatewayVol"} +Number alarmingVol "Alarming Volume" (G_gateway) {channel="miio:basic:gateway:alarmingVol"} +String doorbellPush "Doorbell Push" (G_gateway) {channel="miio:basic:gateway:doorbellPush"} +``` + +### Mi Smart Home Gateway v3 (lumi.gateway.v3) item file lines + +note: Autogenerated example. Replace the id (gateway) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +```java +Group G_gateway "Mi Smart Home Gateway v3" +Switch telnetEnable "Enable Telnet" (G_gateway) {channel="miio:basic:gateway:telnetEnable"} +Number doorbellVol "Doorbell Volume" (G_gateway) {channel="miio:basic:gateway:doorbellVol"} +Number gatewayVol "Gateway Volume" (G_gateway) {channel="miio:basic:gateway:gatewayVol"} +Number alarmingVol "Alarming Volume" (G_gateway) {channel="miio:basic:gateway:alarmingVol"} +String doorbellPush "Doorbell Push" (G_gateway) {channel="miio:basic:gateway:doorbellPush"} +``` + +### Xiaomi Mi Mijia Gateway V3 ZNDMWG03LM (lumi.gateway.mgl03) item file lines + +note: Autogenerated example. Replace the id (gateway) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +```java +Group G_gateway "Xiaomi Mi Mijia Gateway V3 ZNDMWG03LM" +Switch telnetEnable "Enable Telnet" (G_gateway) {channel="miio:basic:gateway:telnetEnable"} +Number doorbellVol "Doorbell Volume" (G_gateway) {channel="miio:basic:gateway:doorbellVol"} +Number gatewayVol "Gateway Volume" (G_gateway) {channel="miio:basic:gateway:gatewayVol"} +Number alarmingVol "Alarming Volume" (G_gateway) {channel="miio:basic:gateway:alarmingVol"} +String doorbellPush "Doorbell Push" (G_gateway) {channel="miio:basic:gateway:doorbellPush"} +``` + ### Mi Humdifier (zhimi.humidifier.v1) item file lines note: Autogenerated example. Replace the id (humidifier) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java index ff7d0933dfc..1dafc594095 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoDevices.java @@ -81,9 +81,10 @@ public enum MiIoDevices { FAN_P9("dmaker.fan.p9", "Xiaomi Mijia Smart Tower Fan", THING_TYPE_BASIC), FAN_P10("dmaker.fan.p10", "Xiaomi Mijia Smart Tower Fan", THING_TYPE_BASIC), FRIDGE_V3("viomi.fridge.v3", "Viomi Internet refrigerator iLive", THING_TYPE_UNSUPPORTED), - GATEWAY1("lumi.gateway.v1", "Mi Smart Home Gateway v1", THING_TYPE_UNSUPPORTED), - GATEWAY2("lumi.gateway.v2", "Mi Smart Home Gateway v2", THING_TYPE_UNSUPPORTED), - GATEWAY3("lumi.gateway.v3", "Mi Smart Home Gateway v3", THING_TYPE_UNSUPPORTED), + GATEWAY1("lumi.gateway.v1", "Mi Smart Home Gateway v1", THING_TYPE_BASIC), + GATEWAY2("lumi.gateway.v2", "Mi Smart Home Gateway v2", THING_TYPE_BASIC), + GATEWAY3("lumi.gateway.v3", "Mi Smart Home Gateway v3", THING_TYPE_BASIC), + GATEWAY_MGL3("lumi.gateway.mgl03", "Xiaomi Mi Mijia Gateway V3 ZNDMWG03LM", THING_TYPE_BASIC), HUMIDIFIER("zhimi.humidifier.v1", "Mi Humdifier", THING_TYPE_BASIC), LUMI_C11("lumi.ctrl_neutral1.v1", "Light Control (Wall Switch)", THING_TYPE_UNSUPPORTED), LUMI_C12("lumi.ctrl_neutral2.v1", "Light Control (Wall Switch)", THING_TYPE_UNSUPPORTED), diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/chuangmi.plug.v3.json b/bundles/org.openhab.binding.miio/src/main/resources/database/chuangmi.plug.v3.json index d1a54e45da1..8ef70ddc3fb 100644 --- a/bundles/org.openhab.binding.miio/src/main/resources/database/chuangmi.plug.v3.json +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/chuangmi.plug.v3.json @@ -1,7 +1,7 @@ { "deviceMapping": { "id": [ - "chuangmi.plug.v3" + "chuangmi.plug.v3old" ], "channels": [ { diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/chuangmi.plug.v3fw.json b/bundles/org.openhab.binding.miio/src/main/resources/database/chuangmi.plug.v3fw.json index 60c67f399f0..295825b1473 100644 --- a/bundles/org.openhab.binding.miio/src/main/resources/database/chuangmi.plug.v3fw.json +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/chuangmi.plug.v3fw.json @@ -1,6 +1,7 @@ { "deviceMapping": { "id": [ + "chuangmi.plug.v3", "chuangmi.plug.v3fw" ], "channels": [ diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/lumi.gateway.json b/bundles/org.openhab.binding.miio/src/main/resources/database/lumi.gateway.json new file mode 100644 index 00000000000..5a8b0b1c1fd --- /dev/null +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/lumi.gateway.json @@ -0,0 +1,80 @@ +{ + "deviceMapping": { + "id": [ + "lumi.gateway.v1", + "lumi.gateway.v2", + "lumi.gateway.v3", + "lumi.gateway.mgl03" + ], + "propertyMethod": "get_prop", + "maxProperties": 4, + "channels": [ + { + "property": "", + "friendlyName": "Enable Telnet", + "channel": "telnetEnable", + "type": "Switch", + "refresh": false, + "actions": [ + { + "command": "enable_telnet_service", + "parameterType": "EMPTY" + } + ] + }, + { + "property": "doorbell_volume", + "friendlyName": "Doorbell Volume", + "channel": "doorbellVol", + "type": "Number", + "refresh": true, + "actions": [ + { + "command": "set_doorbell_volume", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "gateway_volume", + "friendlyName": "Gateway Volume", + "channel": "gatewayVol", + "type": "Number", + "refresh": true, + "actions": [ + { + "command": "set_gateway_volume", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "alarming_volume", + "friendlyName": "Alarming Volume", + "channel": "alarmingVol", + "type": "Number", + "refresh": true, + "actions": [ + { + "command": "set_alarming_volume", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "doorbell_push", + "friendlyName": "Doorbell Push", + "channel": "doorbellPush", + "type": "String", + "refresh": true, + "actions": [ + { + "command": "set_doorbell_push", + "parameterType": "STRING" + } + ] + } + + ] + } +}