From: Marcel Date: Mon, 16 Nov 2020 20:26:50 +0000 (+0100) Subject: [miio] update readme (#9014) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=d6d68c7a96ba5ebaca1e5348a9b2040b6c0c2903;p=openhab-addons.git [miio] update readme (#9014) * [miio] update readme Signed-off-by: Marcel Verpaalen --- diff --git a/bundles/org.openhab.binding.miio/README.base.md b/bundles/org.openhab.binding.miio/README.base.md index 791f81a23b..2591657065 100644 --- a/bundles/org.openhab.binding.miio/README.base.md +++ b/bundles/org.openhab.binding.miio/README.base.md @@ -30,7 +30,8 @@ The binding needs a token from the Xiaomi Mi Device in order to be able to contr The binding can retrieve the needed tokens from the Xiaomi cloud. Go to the binding config page and enter your cloud username and password. The server(s) to which your devices are connected need to be entered as well. -Use the one of the regional servers: ru,us,tw,sg,cn,de. Multiple servers can be separated with comma, or leave blank to test all known servers. +Use the one of the regional servers: cn,de,i2,tw,ru,sg,us. +Multiple servers can be separated with comma, or leave blank to test all known servers. ## Tokens without cloud access @@ -50,7 +51,8 @@ Note. The Xiaomi devices change the token when inclusion is done. Hence if you g ## Binding Configuration No binding configuration is required. However to enable cloud functionality enter your Xiaomi username, password and server(s). -The list of the known countries and related severs is [here](#Country-Servers) +The list of the known countries and related severs is [here](#Country-Servers). + After successful Xiaomi cloud login, the binding will use the connection to retrieve the required device tokens from the cloud. For Xiaomi vacuums the map can be visualized in openHAB using the cloud connection. @@ -100,10 +102,10 @@ Besides the regular configuration (like ip address, token) the modelId needs to Normally the modelId is populated with the model of your device, however in this case, use the modelId of a similar device. Look at the openHAB forum, or the openHAB GitHub repository for the modelId of similar devices. -## Supported property test +## Supported property test for unsupported devices The unsupported device has a test channel with switch. When switching on, all known properties are tested, this may take few minutes. -A test report will be shown in the log and is saved in the userdata/miio folder. +A test report will be shown in the log and is saved in the `userdata/miio` folder with a filename `test-[your model]-[timestamp].txt`. If supported properties are found, an experimental database file is saved to the conf/misc/miio folder (see below chapter). The thing will go offline and will come back online as basic device, supporting the found channels. The database file may need to be modified to display the right channel names. @@ -250,6 +252,7 @@ Additionally depending on the capabilities of your robot vacuum other channels m ### Country Servers Known country Servers: cn, de, i2, ru, sg, us + Mapping of countries in mihome app to server: | Country | Country Code | Server | diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md index 9e08ec8fc5..f0f96d84ef 100644 --- a/bundles/org.openhab.binding.miio/README.md +++ b/bundles/org.openhab.binding.miio/README.md @@ -30,7 +30,8 @@ The binding needs a token from the Xiaomi Mi Device in order to be able to contr The binding can retrieve the needed tokens from the Xiaomi cloud. Go to the binding config page and enter your cloud username and password. The server(s) to which your devices are connected need to be entered as well. -Use the one of the regional servers: ru,us,tw,sg,cn,de. Multiple servers can be separated with comma, or leave blank to test all known servers. +Use the one of the regional servers: cn,de,i2,tw,ru,sg,us. +Multiple servers can be separated with comma, or leave blank to test all known servers. ## Tokens without cloud access @@ -50,7 +51,8 @@ Note. The Xiaomi devices change the token when inclusion is done. Hence if you g ## Binding Configuration No binding configuration is required. However to enable cloud functionality enter your Xiaomi username, password and server(s). -The list of the known countries and related severs is [here](#Country-Servers) +The list of the known countries and related severs is [here](#Country-Servers). + After successful Xiaomi cloud login, the binding will use the connection to retrieve the required device tokens from the cloud. For Xiaomi vacuums the map can be visualized in openHAB using the cloud connection. @@ -82,6 +84,8 @@ or in case of unknown models include the model information of a similar device t # Mi IO Devices +Currently the miio binding supports more than 200 different models. + | Device | ThingType | Device Model | Supported | Remark | |------------------------------|------------------|------------------------|-----------|------------| | AUX Air Conditioner | miio:unsupported | aux.aircondition.v1 | No | | @@ -346,10 +350,10 @@ Besides the regular configuration (like ip address, token) the modelId needs to Normally the modelId is populated with the model of your device, however in this case, use the modelId of a similar device. Look at the openHAB forum, or the openHAB GitHub repository for the modelId of similar devices. -## Supported property test +## Supported property test for unsupported devices The unsupported device has a test channel with switch. When switching on, all known properties are tested, this may take few minutes. -A test report will be shown in the log and is saved in the userdata/miio folder. +A test report will be shown in the log and is saved in the `userdata/miio` folder with a filename `test-[your model]-[timestamp].txt`. If supported properties are found, an experimental database file is saved to the conf/misc/miio folder (see below chapter). The thing will go offline and will come back online as basic device, supporting the found channels. The database file may need to be modified to display the right channel names. @@ -6631,6 +6635,7 @@ Number usedhours "Run Time" (G_heater) {channel="miio:basic:heater:usedhours"} ### Country Servers Known country Servers: cn, de, i2, ru, sg, us + Mapping of countries in mihome app to server: | Country | Country Code | Server | diff --git a/bundles/org.openhab.binding.miio/src/test/java/org/openhab/binding/miio/internal/ReadmeHelper.java b/bundles/org.openhab.binding.miio/src/test/java/org/openhab/binding/miio/internal/ReadmeHelper.java index baf2592c2b..090e22b957 100644 --- a/bundles/org.openhab.binding.miio/src/test/java/org/openhab/binding/miio/internal/ReadmeHelper.java +++ b/bundles/org.openhab.binding.miio/src/test/java/org/openhab/binding/miio/internal/ReadmeHelper.java @@ -79,8 +79,14 @@ public class ReadmeHelper { } private StringWriter deviceList() { + long items = Arrays.asList(MiIoDevices.values()).stream() + .filter(device -> !device.getThingType().equals(MiIoBindingConstants.THING_TYPE_UNSUPPORTED)).count(); + String devicesCount = String.format("Currently the miio binding supports more than %d different models.", + (items / 10) * 10); + LOGGER.info(devicesCount); StringWriter sw = new StringWriter(); - + sw.write(devicesCount); + sw.write("\r\n\r\n"); sw.write( "| Device | ThingType | Device Model | Supported | Remark |\r\n"); sw.write( @@ -177,7 +183,9 @@ public class ReadmeHelper { for (MiIoBasicDevice entry : findDatabaseEntrys()) { for (String id : entry.getDevice().getId()) { if (!MiIoDevices.getType(id).getThingType().equals(MiIoBindingConstants.THING_TYPE_BASIC)) { - LOGGER.info("id :" + id + " not found"); + LOGGER.info("id : {} " + id + + " not found. Suggested line to add to MiIoDevices.java: {}(\"{}\", \"{}\", THING_TYPE_BASIC),", + id, id.toUpperCase().replace(".", "_"), id, id); } } }