]> git.basschouten.com Git - openhab-addons.git/commitdiff
[miio] Add support zhimi.heater.zb1 & zhimi.heater.za2 (#9055)
authorMarcel <marcelrv@users.noreply.github.com>
Wed, 18 Nov 2020 00:16:36 +0000 (01:16 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Nov 2020 00:16:36 +0000 (16:16 -0800)
* [miio] Add support zhimi.heater.zb1 & zhimi.heater.za2
* [miio] capitalize channel labels

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/MiIoDevices.java
bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/MiIoQuantiyTypes.java
bundles/org.openhab.binding.miio/src/main/resources/OH-INF/thing/commonChannels.xml
bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.za2-miot.json [new file with mode: 0644]
bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.heater.zb1-miot.json [new file with mode: 0644]

index e73d51ad361a89a11c02dcfde36d6c1e89e43277..89dce3257e70af453b709449164c51ff47471749 100644 (file)
@@ -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 (<a name="zhimi-heater-za2">zhimi.heater.za2</a>) 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 (<a name="zhimi-heater-zb1">zhimi.heater.zb1</a>) 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" <status>
+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" <status>
+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"}
+```
+
 
 
 ### <a name="Country-Servers">Country Servers</a>
index 18eb0675a1c9a861296a8d72b4d412b477ae12b6..e045ea22ef924d76ae5ca11297026597364d4175 100644 (file)
@@ -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) {
index 303c62bab03eab40886807eb65fb21b03fbb60d7..49cf9a3f297cab9e4ab4660b18ad7ec0a8d9478f 100644 (file)
@@ -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);
 
index a9b137edfa10041a274997ed126a82d08ae30a00..fcc9709565de581d87c6ad797534e0be399392f1 100644 (file)
                <state readOnly="true"/>
        </channel-type>
 
+       <!-- Generic Numeric QtyType channels -->
+       <channel-type id="temperatureRW">
+               <item-type>Number:Temperature</item-type>
+               <label>Temperature</label>
+               <state pattern="%.1f %unit%"/>
+       </channel-type>
+       <channel-type id="time">
+               <item-type>Number:Time</item-type>
+               <label>Hours</label>
+               <state readOnly="true" pattern="%.0f %unit%"/>
+       </channel-type>
+
        <!-- Common Actions channels -->
        <channel-type id="commands" advanced="true">
                <item-type>String</item-type>
                        </options>
                </state>
        </channel-type>
+       <channel-type id="ZhimiHeaterZa2_target-temperature">
+               <item-type>Number:Temperature</item-type>
+               <label>Heater - Target Temperature</label>
+               <state min="16" max="28" step="1" pattern="%.1f %unit%">
+               </state>
+       </channel-type>
+       <channel-type id="ZhimiHeaterZb1_country-code">
+               <item-type>Number</item-type>
+               <label>Private-Service - Country-Code</label>
+               <state>
+                       <options>
+                               <option value="0">Unknown</option>
+                               <option value="1">US</option>
+                               <option value="7">RU</option>
+                               <option value="33">FR</option>
+                               <option value="44">EU</option>
+                               <option value="81">JP</option>
+                               <option value="82">KR</option>
+                               <option value="86">CN</option>
+                               <option value="852">HK</option>
+                               <option value="886">TW</option>
+                       </options>
+               </state>
+       </channel-type>
 </thing:thing-descriptions>
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 (file)
index 0000000..2a9a007
--- /dev/null
@@ -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 (file)
index 0000000..7d37d20
--- /dev/null
@@ -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
+       }
+}