]> git.basschouten.com Git - openhab-addons.git/commitdiff
[miio] allow for device remarks in the readme from json db (#8676)
authorMarcel <marcelrv@users.noreply.github.com>
Tue, 6 Oct 2020 22:04:36 +0000 (00:04 +0200)
committerGitHub <noreply@github.com>
Tue, 6 Oct 2020 22:04:36 +0000 (15:04 -0700)
* [miio] allow for device remarks in the readme from json db
* Update bundles/org.openhab.binding.miio/src/test/java/org/openhab/binding/miio/internal/ReadmeHelper.java

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/basic/DeviceMapping.java
bundles/org.openhab.binding.miio/src/main/resources/database/lumi.gateway.json
bundles/org.openhab.binding.miio/src/main/resources/database/yunmi.waterpurifier.json
bundles/org.openhab.binding.miio/src/test/java/org/openhab/binding/miio/internal/ReadmeHelper.java

index 3ffc2f91d1c6b79a76ab762a0a0af70a32539a4a..e9e0a9ebf910518088605e3a9e7796ec38247c98 100644 (file)
@@ -140,10 +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: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 Smart Home Gateway v1     | miio:basic       | [lumi.gateway.v1](#lumi-gateway-v1) | Yes       | Used to control the gateway itself. Use the mihome binding to control devices connected to the Xiaomi gateway. Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Smart Home Gateway v2     | miio:basic       | [lumi.gateway.v2](#lumi-gateway-v2) | Yes       | Used to control the gateway itself. Use the mihome binding to control devices connected to the Xiaomi gateway. Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Smart Home Gateway v3     | miio:basic       | [lumi.gateway.v3](#lumi-gateway-v3) | Yes       | Used to control the gateway itself. Use the mihome binding to control devices connected to the Xiaomi gateway. Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Xiaomi Mi Mijia Gateway V3 ZNDMWG03LM | miio:basic       | [lumi.gateway.mgl03](#lumi-gateway-mgl03) | Yes       | Used to control the gateway itself. Use the mihome binding to control devices connected to the Xiaomi gateway. Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
 | 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        |            |
@@ -206,21 +206,21 @@ or in case of unknown models include the model information e.g.:
 |  Mijia 1 Gang Wall Smart Switch (WIFI) - PTX switch | miio:basic       | [090615.switch.xswitch01](#090615-switch-xswitch01) | Yes       |            |
 |  Mijia 2 Gang Wall Smart Switch (WIFI) - PTX switch | miio:basic       | [090615.switch.xswitch02](#090615-switch-xswitch02) | Yes       |            |
 |  Mijia 3 Gang Wall Smart Switch (WIFI) - PTX switch | miio:basic       | [090615.switch.xswitch03](#090615-switch-xswitch03) | Yes       |            |
-| Mi Water Purifier v1         | miio:basic       | [yunmi.waterpurifier.v1](#yunmi-waterpurifier-v1) | Yes       |            |
-| Mi Water Purifier v2         | miio:basic       | [yunmi.waterpurifier.v2](#yunmi-waterpurifier-v2) | Yes       |            |
-| Mi Water Purifier v3         | miio:basic       | [yunmi.waterpurifier.v3](#yunmi-waterpurifier-v3) | Yes       |            |
-| Mi Water Purifier v4         | miio:basic       | [yunmi.waterpurifier.v4](#yunmi-waterpurifier-v4) | Yes       |            |
-| Mi Water Purifier lx2        | miio:basic       | [yunmi.waterpuri.lx2](#yunmi-waterpuri-lx2) | Yes       |            |
-| Mi Water Purifier lx3        | miio:basic       | [yunmi.waterpuri.lx3](#yunmi-waterpuri-lx3) | Yes       |            |
-| Mi Water Purifier lx4        | miio:basic       | [yunmi.waterpuri.lx4](#yunmi-waterpuri-lx4) | Yes       |            |
-| Mi Water Purifier lx5        | miio:basic       | [yunmi.waterpuri.lx5](#yunmi-waterpuri-lx5) | Yes       |            |
-| Mi Water Purifier lx6        | miio:basic       | [yunmi.waterpuri.lx6](#yunmi-waterpuri-lx6) | Yes       |            |
-| Mi Water Purifier lx7        | miio:basic       | [yunmi.waterpuri.lx7](#yunmi-waterpuri-lx7) | Yes       |            |
-| Mi Water Purifier lx8        | miio:basic       | [yunmi.waterpuri.lx8](#yunmi-waterpuri-lx8) | Yes       |            |
-| Mi Water Purifier lx9        | miio:basic       | [yunmi.waterpuri.lx9](#yunmi-waterpuri-lx9) | Yes       |            |
-| Mi Water Purifier lx10       | miio:basic       | [yunmi.waterpuri.lx10](#yunmi-waterpuri-lx10) | Yes       |            |
-| Mi Water Purifier lx11       | miio:basic       | [yunmi.waterpuri.lx11](#yunmi-waterpuri-lx11) | Yes       |            |
-| Mi Water Purifier lx12       | miio:basic       | [yunmi.waterpuri.lx12](#yunmi-waterpuri-lx12) | Yes       |            |
+| Mi Water Purifier v1         | miio:basic       | [yunmi.waterpurifier.v1](#yunmi-waterpurifier-v1) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier v2         | miio:basic       | [yunmi.waterpurifier.v2](#yunmi-waterpurifier-v2) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier v3         | miio:basic       | [yunmi.waterpurifier.v3](#yunmi-waterpurifier-v3) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier v4         | miio:basic       | [yunmi.waterpurifier.v4](#yunmi-waterpurifier-v4) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx2        | miio:basic       | [yunmi.waterpuri.lx2](#yunmi-waterpuri-lx2) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx3        | miio:basic       | [yunmi.waterpuri.lx3](#yunmi-waterpuri-lx3) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx4        | miio:basic       | [yunmi.waterpuri.lx4](#yunmi-waterpuri-lx4) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx5        | miio:basic       | [yunmi.waterpuri.lx5](#yunmi-waterpuri-lx5) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx6        | miio:basic       | [yunmi.waterpuri.lx6](#yunmi-waterpuri-lx6) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx7        | miio:basic       | [yunmi.waterpuri.lx7](#yunmi-waterpuri-lx7) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx8        | miio:basic       | [yunmi.waterpuri.lx8](#yunmi-waterpuri-lx8) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx9        | miio:basic       | [yunmi.waterpuri.lx9](#yunmi-waterpuri-lx9) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx10       | miio:basic       | [yunmi.waterpuri.lx10](#yunmi-waterpuri-lx10) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx11       | miio:basic       | [yunmi.waterpuri.lx11](#yunmi-waterpuri-lx11) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
+| Mi Water Purifier lx12       | miio:basic       | [yunmi.waterpuri.lx12](#yunmi-waterpuri-lx12) | Yes       | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses |
 | Xiaomi Wifi Extender         | miio:unsupported | xiaomi.repeater.v2     | No        |            |
 | Mi Internet Speaker          | miio:unsupported | xiaomi.wifispeaker.v1  | No        |            |
 | Xiaomi Mijia Whale Smart Toilet Cover | miio:basic       | [xjx.toilet.pro](#xjx-toilet-pro) | Yes       |            |
index e597415e2b1610e03731159b3b73332b9982754f..8bfe5d66025ad70f3186ba1640d309a68dd55edb 100644 (file)
@@ -42,6 +42,12 @@ public class DeviceMapping {
     @SerializedName("channels")
     @Expose
     private List<MiIoBasicChannel> miIoBasicChannels = new ArrayList<>();
+    @SerializedName("readmeComment")
+    @Expose
+    private @Nullable String readmeComment;
+    @SerializedName("experimental")
+    @Expose
+    private @Nullable Boolean experimental;
 
     public List<String> getId() {
         return id;
@@ -76,4 +82,21 @@ public class DeviceMapping {
     public void setChannels(List<MiIoBasicChannel> miIoBasicChannels) {
         this.miIoBasicChannels = miIoBasicChannels;
     }
+
+    public String getReadmeComment() {
+        final String readmeComment = this.readmeComment;
+        return (readmeComment != null) ? readmeComment : "";
+    }
+
+    public void setReadmeComment(String readmeComment) {
+        this.readmeComment = readmeComment;
+    }
+
+    public @Nullable Boolean getExperimental() {
+        return experimental;
+    }
+
+    public void setExperimental(Boolean experimental) {
+        this.experimental = experimental;
+    }
 }
index 81639f171b666f828d4974ac22fa981c1458f774..4e1768cc0c6f20016d8fe3ab9101d574f24be5dc 100644 (file)
                                ]
                        },
                        {
-                "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"
-                    }
-                ]
-            }
-                       
-               ]
+                               "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"
+                                       }
+                               ]
+                       }
+               ],
+               "readmeComment": "Used to control the gateway itself. Use the mihome binding to control devices connected to the Xiaomi gateway.",
+               "experimental": true
        }
 }
index 0560391ffcb336f25960f04fbcb14899431edefe..e8ed15045e6c605813586ab1cb6af22858b571fa 100644 (file)
                                "refresh": true,
                                "actions": []
                        }
-               ]
+               ],
+               "experimental": true
        }
 }
index e6ca5ef4b475ccb0d4c4bae3b42809a2ab100579..b4c5789ce4e3df45b6f6efdf146d4aabd1f33993 100644 (file)
@@ -90,6 +90,18 @@ public class ReadmeHelper {
             if (!device.getModel().equals("unknown")) {
                 String link = device.getModel().replace(".", "-");
                 boolean isSupported = device.getThingType().equals(MiIoBindingConstants.THING_TYPE_UNSUPPORTED);
+                String remark = "";
+                if (device.getThingType().equals(MiIoBindingConstants.THING_TYPE_BASIC)) {
+                    MiIoBasicDevice dev = findDatabaseEntry(device.getModel());
+                    if (dev != null) {
+                        remark = dev.getDevice().getReadmeComment();
+                        final Boolean experimental = dev.getDevice().getExperimental();
+                        if (experimental != null && experimental.booleanValue()) {
+                            remark += (remark.isBlank() ? "" : " ")
+                                    + "Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses";
+                        }
+                    }
+                }
                 sw.write("| ");
                 sw.write(minLengthString(device.getDescription(), 28));
                 sw.write(" | ");
@@ -99,7 +111,9 @@ public class ReadmeHelper {
                 sw.write(minLengthString(model, 22));
                 sw.write(" | ");
                 sw.write(isSupported ? "No       " : "Yes      ");
-                sw.write(" |            |\r\n");
+                sw.write(" | ");
+                sw.write(minLengthString(remark, 10));
+                sw.write(" |\r\n");
             }
         });
         return sw;