From 343981fc120cc8e4c4300a25be4e190b000f6ac4 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 11 Oct 2020 20:58:09 +0200 Subject: [PATCH] [miio] add chungmi plug (#8728) add chuangmi.plug.hmi206 chuangmi.plug.hmi208 Signed-off-by: Marcel Verpaalen --- bundles/org.openhab.binding.miio/README.md | 48 ++++++++++++++++++- .../binding/miio/internal/MiIoDevices.java | 2 + .../database/chuangmi.plug.v3fw.json | 4 +- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md index 0c4baba6b3..328b5c5653 100644 --- a/bundles/org.openhab.binding.miio/README.md +++ b/bundles/org.openhab.binding.miio/README.md @@ -185,6 +185,8 @@ or in case of unknown models include the model information e.g.: | Mi Power-plug v3 | miio:basic | [chuangmi.plug.v3](#chuangmi-plug-v3) | Yes | | | Mi Power-plug | miio:basic | [chuangmi.plug.m3](#chuangmi-plug-m3) | Yes | | | Mi Smart Plug | miio:basic | [chuangmi.plug.hmi205](#chuangmi-plug-hmi205) | Yes | | +| Mi Smart Plug | miio:basic | [chuangmi.plug.hmi206](#chuangmi-plug-hmi206) | Yes | | +| Mi Smart Plug | miio:basic | [chuangmi.plug.hmi208](#chuangmi-plug-hmi208) | Yes | | | Qing Mi Smart Power Strip v1 | miio:basic | [qmi.powerstrip.v1](#qmi-powerstrip-v1) | Yes | | | Mi Power-strip v2 | miio:basic | [zimi.powerstrip.v2](#zimi-powerstrip-v2) | Yes | | | Mi Toothbrush | miio:unsupported | soocare.toothbrush.x3 | No | | @@ -329,7 +331,7 @@ The thing will go offline and will come back online as basic device, supporting The database file may need to be modified to display the right channel names. After validation, please share the logfile and json files on the openHAB forum or the openHAB GitHub to build future support for this model. -# Advanced: adding local database files to support new devices +## Advanced: adding local database files to support new devices Things using the basic handler (miio:basic things) are driven by json 'database' files. This instructs the binding which channels to create, which properties and actions are associated with the channels etc. @@ -337,7 +339,7 @@ The conf/misc/miio (e.g. in Linux `/opt/openhab2/conf/misc/miio/`) is scanned fo Note that local database files take preference over build-in ones, hence if a json file is local and in the database the local file will be used. For format, please check the current database files in openHAB GitHub. -## Channels +# Channels Depending on the device, different channels are available. @@ -1685,6 +1687,24 @@ e.g. `smarthome:send actionCommand 'upd_timer["1498595904821", "on"]'` would ena | temperature | Number | Temperature | | | led | Switch | Indicator light | | +### Mi Smart Plug (chuangmi.plug.hmi206) Channels + +| Channel | Type | Description | Comment | +|------------------|---------|-------------------------------------|------------| +| power | Switch | Power | If this channel does not respond to on/off replace the model with chuangmi.plug.v3old in the config or upgrade firmware | +| usb | Switch | USB | | +| temperature | Number | Temperature | | +| led | Switch | Wifi LED | | + +### Mi Smart Plug (chuangmi.plug.hmi208) Channels + +| Channel | Type | Description | Comment | +|------------------|---------|-------------------------------------|------------| +| power | Switch | Power | If this channel does not respond to on/off replace the model with chuangmi.plug.v3old in the config or upgrade firmware | +| usb | Switch | USB | | +| temperature | Number | Temperature | | +| led | Switch | Wifi LED | | + ### Qing Mi Smart Power Strip v1 (qmi.powerstrip.v1) Channels | Channel | Type | Description | Comment | @@ -4568,6 +4588,30 @@ Number temperature "Temperature" (G_plug) {channel="miio:basic:plug:temperature" Switch led "Indicator light" (G_plug) {channel="miio:basic:plug:led"} ``` +### Mi Smart Plug (chuangmi.plug.hmi206) item file lines + +note: Autogenerated example. Replace the id (plug) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +```java +Group G_plug "Mi Smart Plug" +Switch power "Power" (G_plug) {channel="miio:basic:plug:power"} +Switch usb "USB" (G_plug) {channel="miio:basic:plug:usb"} +Number temperature "Temperature" (G_plug) {channel="miio:basic:plug:temperature"} +Switch led "Wifi LED" (G_plug) {channel="miio:basic:plug:led"} +``` + +### Mi Smart Plug (chuangmi.plug.hmi208) item file lines + +note: Autogenerated example. Replace the id (plug) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +```java +Group G_plug "Mi Smart Plug" +Switch power "Power" (G_plug) {channel="miio:basic:plug:power"} +Switch usb "USB" (G_plug) {channel="miio:basic:plug:usb"} +Number temperature "Temperature" (G_plug) {channel="miio:basic:plug:temperature"} +Switch led "Wifi LED" (G_plug) {channel="miio:basic:plug:led"} +``` + ### Qing Mi Smart Power Strip v1 (qmi.powerstrip.v1) item file lines note: Autogenerated example. Replace the id (powerstrip) 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 c927e9bc98..7619224fc8 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 @@ -127,6 +127,8 @@ public enum MiIoDevices { POWERPLUG3("chuangmi.plug.v3", "Mi Power-plug v3", THING_TYPE_BASIC), POWERPLUGM3("chuangmi.plug.m3", "Mi Power-plug", THING_TYPE_BASIC), POWERPLUG_HMI205("chuangmi.plug.hmi205", "Mi Smart Plug", THING_TYPE_BASIC), + CHUANGMI_PLUG_HMI206("chuangmi.plug.hmi206", "Mi Smart Plug", THING_TYPE_BASIC), + CHUANGMI_PLUG_HMI208("chuangmi.plug.hmi208", "Mi Smart Plug", THING_TYPE_BASIC), POWERSTRIP("qmi.powerstrip.v1", "Qing Mi Smart Power Strip v1", THING_TYPE_BASIC), POWERSTRIP2("zimi.powerstrip.v2", "Mi Power-strip v2", THING_TYPE_BASIC), TOOTHBRUSH("soocare.toothbrush.x3", "Mi Toothbrush", THING_TYPE_UNSUPPORTED), 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 b6dcffe29c..04acd4fc57 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 @@ -2,7 +2,9 @@ "deviceMapping": { "id": [ "chuangmi.plug.v3", - "chuangmi.plug.v3fw" + "chuangmi.plug.v3fw", + "chuangmi.plug.hmi206", + "chuangmi.plug.hmi208" ], "channels": [ { -- 2.47.3