[miio] Cloud Communication for devices (#8981)

* [miio]  Cloud Communication for devices

Allows to define if communication to devices is direct or send via the
Xiaomi cloud.
Introduce additional channel to execute commands via cloud.

Other small improvements
* Use common method from abstract handler to send commands
* Common way to handle custom commands
* Introduce small delay before refreshing robot properties after sending
commands (similar to the basic handler) so devices have time to update
their properties

* [miio] simplify cloudconnector
* [miio] Cleanup all jobs when unloading
* [miio] update to use dedicated ScheduledExecutorService

Use dedicated ScheduledExecutorService to avoid unloading problems

* Update bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoAbstractHandler.java
* [miio] fix for removeif
* miio- Improve scheduler
* [miio] fix communication error if device is not on the network
* [miio] update with comments from feedback

* remove scheduler tracking
* improve status setting for cloud communication
* [miio] update with feedback review

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

Co-authored-by: Connor Petty <mistercpp2000@gmail.com>
This commit is contained in:
Marcel
2020-11-29 05:03:12 +01:00
committed by GitHub
parent ab7ac79fab
commit ad202edefa
19 changed files with 255 additions and 112 deletions

View File

@@ -2,7 +2,7 @@
<config-description:config-descriptions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0https://openhab.org/schemas/config-description-1.0.0.xsd">
xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0 https://openhab.org/schemas/config-description-1.0.0.xsd">
<config-description uri="thing-type:miio:config">
<parameter name="host" type="text" required="true">
@@ -23,6 +23,16 @@
<description>Device model string, used to determine the subtype.</description>
<advanced>true</advanced>
</parameter>
<parameter name="communication" type="text" required="false">
<default>direct</default>
<label>Communication Method</label>
<description>Determines how the binding communicates with this device</description>
<options>
<option value="direct">Direct (Default)</option>
<option value="cloud">Cloud</option>
</options>
<advanced>true</advanced>
</parameter>
<parameter name="refreshInterval" type="integer" min="0" max="9999" required="false">
<label>Refresh Interval</label>
<description>Refresh interval for refreshing the data in seconds. (0=disabled)</description>