From d41927c70313de9838cc93dec7658668901a038d Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 18 Nov 2020 01:16:36 +0100 Subject: [PATCH] [miio] Add support zhimi.heater.zb1 & zhimi.heater.za2 (#9055) * [miio] Add support zhimi.heater.zb1 & zhimi.heater.za2 * [miio] capitalize channel labels Signed-off-by: Marcel Verpaalen --- bundles/org.openhab.binding.miio/README.md | 72 +++++- .../binding/miio/internal/MiIoDevices.java | 2 + .../miio/internal/MiIoQuantiyTypes.java | 3 + .../resources/OH-INF/thing/commonChannels.xml | 36 +++ .../database/zhimi.heater.za2-miot.json | 156 +++++++++++++ .../database/zhimi.heater.zb1-miot.json | 215 ++++++++++++++++++ 6 files changed, 483 insertions(+), 1 deletion(-) create mode 100644 bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.za2-miot.json create mode 100644 bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.zb1-miot.json diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md index e73d51ad3..89dce3257 100644 --- a/bundles/org.openhab.binding.miio/README.md +++ b/bundles/org.openhab.binding.miio/README.md @@ -84,7 +84,7 @@ 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. +Currently the miio binding supports more than 210 different models. | Device | ThingType | Device Model | Supported | Remark | |------------------------------|------------------|------------------------|-----------|------------| @@ -325,6 +325,8 @@ Currently the miio binding supports more than 200 different models. | Yeelight yilai ceiling | miio:basic | [yilai.light.ceiling2](#yilai-light-ceiling2) | Yes | | | Yeelight yilai ceiling | miio:basic | [yilai.light.ceiling3](#yilai-light-ceiling3) | Yes | | | Zhimi Heater | miio:basic | [zhimi.heater.za1](#zhimi-heater-za1) | Yes | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses | +| Zhimi Heater | miio:basic | [zhimi.heater.za2](#zhimi-heater-za2) | Yes | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses | +| Zhimi Heater | miio:basic | [zhimi.heater.zb1](#zhimi-heater-zb1) | Yes | Experimental support. Please report back if all channels are functional. Preferably share the debug log of property refresh and command responses | # Advanced: Unsupported devices @@ -3220,6 +3222,37 @@ e.g. `smarthome:send actionCommand 'upd_timer["1498595904821", "on"]'` would ena | temperature | Number:Temperature | Temperature | | | usedhours | Number | Run Time | | +### Zhimi Heater (zhimi.heater.za2) Channels + +| Channel | Type | Description | Comment | +|------------------|---------|-------------------------------------|------------| +| fault | Number | Heater - Device Fault | | +| on | Switch | Heater - Power | | +| target-temperature | Number:Temperature | Heater - Target Temperature | | +| alarm | Switch | Alarm - Alarm | | +| countdown-time | Number:Time | Countdown - Countdown Time | | +| relative-humidity | Number | Environment - Relative Humidity | | +| temperature | Number:Temperature | Environment - Temperature | | +| brightness | Dimmer | Indicator Light - Brightness | | +| physical-controls-locked | Switch | Physical Control Locked - Physical Controls Locked | | +| use-time | Number:Time | Private-Service - Use Time | | + +### Zhimi Heater (zhimi.heater.zb1) Channels + +| Channel | Type | Description | Comment | +|------------------|---------|-------------------------------------|------------| +| fault | Number | Heater - Device Fault | | +| on | Switch | Heater - Power | | +| target-temperature | Number:Temperature | Heater - Target Temperature | | +| alarm | Switch | Alarm - Alarm | | +| countdown-time | Number:Time | Countdown - Countdown Time | | +| relative-humidity | Number | Environment - Relative Humidity | | +| temperature | Number:Temperature | Environment - Temperature | | +| brightness | Dimmer | Indicator Light - Brightness | | +| physical-controls-locked | Switch | Physical Control Locked - Physical Controls Locked | | +| use-time | Number:Time | Private-Service - Use Time | | +| country-code | Number | Private-Service - Country-Code | Value mapping [0="Unknown",1="US",82="KR",44="EU",81="JP",7="RU",86="CN",852="HK",886="TW",33="FR"] | + @@ -6623,6 +6656,43 @@ Number:Temperature temperature "Temperature" (G_heater) {channel="miio:basic:hea Number usedhours "Run Time" (G_heater) {channel="miio:basic:heater:usedhours"} ``` +### Zhimi Heater (zhimi.heater.za2) item file lines + +note: Autogenerated example. Replace the id (heater) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +```java +Group G_heater "Zhimi Heater" +Number fault "Heater - Device Fault" (G_heater) {channel="miio:basic:heater:fault"} +Switch on "Heater - Power" (G_heater) {channel="miio:basic:heater:on"} +Number:Temperature target-temperature "Heater - Target Temperature" (G_heater) {channel="miio:basic:heater:target-temperature"} +Switch alarm "Alarm - Alarm" (G_heater) {channel="miio:basic:heater:alarm"} +Number:Time countdown-time "Countdown - Countdown Time" (G_heater) {channel="miio:basic:heater:countdown-time"} +Number relative-humidity "Environment - Relative Humidity" (G_heater) {channel="miio:basic:heater:relative-humidity"} +Number:Temperature temperature "Environment - Temperature" (G_heater) {channel="miio:basic:heater:temperature"} +Dimmer brightness "Indicator Light - Brightness" (G_heater) {channel="miio:basic:heater:brightness"} +Switch physical-controls-locked "Physical Control Locked - Physical Controls Locked" (G_heater) {channel="miio:basic:heater:physical-controls-locked"} +Number:Time use-time "Private-Service - Use Time" (G_heater) {channel="miio:basic:heater:use-time"} +``` + +### Zhimi Heater (zhimi.heater.zb1) item file lines + +note: Autogenerated example. Replace the id (heater) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +```java +Group G_heater "Zhimi Heater" +Number fault "Heater - Device Fault" (G_heater) {channel="miio:basic:heater:fault"} +Switch on "Heater - Power" (G_heater) {channel="miio:basic:heater:on"} +Number:Temperature target-temperature "Heater - Target Temperature" (G_heater) {channel="miio:basic:heater:target-temperature"} +Switch alarm "Alarm - Alarm" (G_heater) {channel="miio:basic:heater:alarm"} +Number:Time countdown-time "Countdown - Countdown Time" (G_heater) {channel="miio:basic:heater:countdown-time"} +Number relative-humidity "Environment - Relative Humidity" (G_heater) {channel="miio:basic:heater:relative-humidity"} +Number:Temperature temperature "Environment - Temperature" (G_heater) {channel="miio:basic:heater:temperature"} +Dimmer brightness "Indicator Light - Brightness" (G_heater) {channel="miio:basic:heater:brightness"} +Switch physical-controls-locked "Physical Control Locked - Physical Controls Locked" (G_heater) {channel="miio:basic:heater:physical-controls-locked"} +Number:Time use-time "Private-Service - Use Time" (G_heater) {channel="miio:basic:heater:use-time"} +Number country-code "Private-Service - Country-Code" (G_heater) {channel="miio:basic:heater:country-code"} +``` + ### Country Servers 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 18eb0675a..e045ea22e 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 @@ -262,6 +262,8 @@ public enum MiIoDevices { YL_CEILING2("yilai.light.ceiling2", "Yeelight yilai ceiling", THING_TYPE_BASIC), YL_CEILING3("yilai.light.ceiling3", "Yeelight yilai ceiling", THING_TYPE_BASIC), ZHIMI_HEATER_ZA1("zhimi.heater.za1", "Zhimi Heater", THING_TYPE_BASIC), + ZHIMI_HEATER_ZA2("zhimi.heater.za2", "Zhimi Heater", THING_TYPE_BASIC), + ZHIMI_HEATER_ZB1("zhimi.heater.zb1", "Zhimi Heater", THING_TYPE_BASIC), UNKNOWN("unknown", "Unknown Mi IO Device", THING_TYPE_UNSUPPORTED); public static MiIoDevices getType(String modelString) { diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoQuantiyTypes.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoQuantiyTypes.java index 303c62bab..49cf9a3f2 100644 --- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoQuantiyTypes.java +++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoQuantiyTypes.java @@ -38,6 +38,9 @@ public enum MiIoQuantiyTypes { SECOND(SmartHomeUnits.SECOND), MINUTE(SmartHomeUnits.MINUTE), HOUR(SmartHomeUnits.HOUR), + SECONDS(SmartHomeUnits.SECOND), + MINUTES(SmartHomeUnits.MINUTE), + HOURS(SmartHomeUnits.HOUR), AMPERE(SmartHomeUnits.AMPERE), WATT(SmartHomeUnits.WATT); diff --git a/bundles/org.openhab.binding.miio/src/main/resources/OH-INF/thing/commonChannels.xml b/bundles/org.openhab.binding.miio/src/main/resources/OH-INF/thing/commonChannels.xml index a9b137edf..fcc970956 100644 --- a/bundles/org.openhab.binding.miio/src/main/resources/OH-INF/thing/commonChannels.xml +++ b/bundles/org.openhab.binding.miio/src/main/resources/OH-INF/thing/commonChannels.xml @@ -82,6 +82,18 @@ + + + Number:Temperature + + + + + Number:Time + + + + String @@ -712,4 +724,28 @@ + + Number:Temperature + + + + + + Number + + + + + + + + + + + + + + + + diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.za2-miot.json b/bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.za2-miot.json new file mode 100644 index 000000000..2a9a00710 --- /dev/null +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.za2-miot.json @@ -0,0 +1,156 @@ +{ + "deviceMapping": { + "id": [ + "zhimi.heater.za2" + ], + "propertyMethod": "get_properties", + "maxProperties": 1, + "channels": [ + { + "property": "fault", + "siid": 2, + "piid": 1, + "friendlyName": "Heater - Device Fault", + "channel": "fault", + "channelType": "miot_uint32", + "type": "Number", + "refresh": true, + "actions": [] + }, + { + "property": "on", + "siid": 2, + "piid": 2, + "friendlyName": "Heater - Power", + "channel": "on", + "channelType": "miot_bool", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "target-temperature", + "siid": 2, + "piid": 6, + "friendlyName": "Heater - Target Temperature", + "channel": "target-temperature", + "channelType": "ZhimiHeaterZa2_target-temperature", + "type": "Number:Temperature", + "unit": "CELCIUS", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "alarm", + "siid": 3, + "piid": 1, + "friendlyName": "Alarm - Alarm", + "channel": "alarm", + "channelType": "miot_bool", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "countdown-time", + "siid": 4, + "piid": 1, + "friendlyName": "Countdown - Countdown Time", + "channel": "countdown-time", + "channelType": "time", + "type": "Number:Time", + "unit": "hours", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "STRING" + } + ] + }, + { + "property": "relative-humidity", + "siid": 5, + "piid": 7, + "friendlyName": "Environment - Relative Humidity", + "channel": "relative-humidity", + "channelType": "humidity", + "type": "Number", + "refresh": true, + "actions": [] + }, + { + "property": "temperature", + "siid": 5, + "piid": 8, + "friendlyName": "Environment - Temperature", + "channel": "temperature", + "channelType": "temperatureC", + "type": "Number:Temperature", + "unit": "CELCIUS", + "refresh": true, + "actions": [] + }, + { + "property": "brightness", + "siid": 6, + "piid": 1, + "friendlyName": "Indicator Light - Brightness", + "channel": "brightness", + "channelType": "brightness", + "type": "Dimmer", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "physical-controls-locked", + "siid": 7, + "piid": 1, + "friendlyName": "Physical Control Locked - Physical Controls Locked", + "channel": "physical-controls-locked", + "channelType": "miot_bool", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "use-time", + "siid": 8, + "piid": 7, + "friendlyName": "Private-Service - Use Time", + "channel": "use-time", + "channelType": "time", + "type": "Number:Time", + "unit": "seconds", + "refresh": true, + "actions": [] + } + ], + "experimental": true + } +} diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.zb1-miot.json b/bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.zb1-miot.json new file mode 100644 index 000000000..7d37d20a2 --- /dev/null +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.zb1-miot.json @@ -0,0 +1,215 @@ +{ + "deviceMapping": { + "id": [ + "zhimi.heater.zb1" + ], + "propertyMethod": "get_properties", + "maxProperties": 1, + "channels": [ + { + "property": "fault", + "siid": 2, + "piid": 1, + "friendlyName": "Heater - Device Fault", + "channel": "fault", + "channelType": "miot_uint32", + "type": "Number", + "refresh": true, + "actions": [] + }, + { + "property": "on", + "siid": 2, + "piid": 2, + "friendlyName": "Heater - Power", + "channel": "on", + "channelType": "miot_bool", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "target-temperature", + "siid": 2, + "piid": 6, + "friendlyName": "Heater - Target Temperature", + "channel": "target-temperature", + "channelType": "ZhimiHeaterZa2_target-temperature", + "type": "Number:Temperature", + "unit": "CELCIUS", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "alarm", + "siid": 3, + "piid": 1, + "friendlyName": "Alarm - Alarm", + "channel": "alarm", + "channelType": "miot_bool", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "countdown-time", + "siid": 4, + "piid": 1, + "friendlyName": "Countdown - Countdown Time", + "channel": "countdown-time", + "channelType": "time", + "type": "Number:Time", + "unit": "hours", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "STRING" + } + ] + }, + { + "property": "relative-humidity", + "siid": 5, + "piid": 7, + "friendlyName": "Environment - Relative Humidity", + "channel": "relative-humidity", + "channelType": "humidity", + "type": "Number", + "refresh": true, + "actions": [] + }, + { + "property": "temperature", + "siid": 5, + "piid": 8, + "friendlyName": "Environment - Temperature", + "channel": "temperature", + "channelType": "temperatureC", + "type": "Number:Temperature", + "unit": "CELCIUS", + "refresh": true, + "actions": [] + }, + { + "property": "brightness", + "siid": 6, + "piid": 1, + "friendlyName": "Indicator Light - Brightness", + "channel": "brightness", + "channelType": "brightness", + "type": "Dimmer", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "physical-controls-locked", + "siid": 7, + "piid": 1, + "friendlyName": "Physical Control Locked - Physical Controls Locked", + "channel": "physical-controls-locked", + "channelType": "miot_bool", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "use-time", + "siid": 8, + "piid": 7, + "friendlyName": "Private-Service - Use Time", + "channel": "use-time", + "channelType": "time", + "type": "Number:Time", + "unit": "seconds", + "refresh": true, + "actions": [] + }, + { + "property": "country-code", + "siid": 8, + "piid": 8, + "friendlyName": "Private-Service - Country-Code", + "channel": "country-code", + "channelType": "ZhimiHeaterZb1_country-code", + "type": "Number", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ], + "value-list": [ + { + "value": 0, + "description": "Unknown" + }, + { + "value": 1, + "description": "US" + }, + { + "value": 82, + "description": "KR" + }, + { + "value": 44, + "description": "EU" + }, + { + "value": 81, + "description": "JP" + }, + { + "value": 7, + "description": "RU" + }, + { + "value": 86, + "description": "CN" + }, + { + "value": 852, + "description": "HK" + }, + { + "value": 886, + "description": "TW" + }, + { + "value": 33, + "description": "FR" + } + ], + "readmeComment": "Value mapping [0\u003d\"Unknown\",1\u003d\"US\",82\u003d\"KR\",44\u003d\"EU\",81\u003d\"JP\",7\u003d\"RU\",86\u003d\"CN\",852\u003d\"HK\",886\u003d\"TW\",33\u003d\"FR\"]" + } + ], + "experimental": true + } +}