]> git.basschouten.com Git - openhab-addons.git/commitdiff
[miio] Add support for Xiaomi Mi Air Purifier 3C BHR4518GL (zhimi.airp.mb4a) (#12076)
authorMarcel <marcel@verpaalen.com>
Mon, 7 Mar 2022 22:47:17 +0000 (23:47 +0100)
committerGitHub <noreply@github.com>
Mon, 7 Mar 2022 22:47:17 +0000 (23:47 +0100)
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/resources/OH-INF/i18n/basic.properties
bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.airp.mb4a-miot.json [new file with mode: 0644]
bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.airpurifier.mb4-miot.json

index 84c287bc9fcf8a097feccf1c8dd1a77ec6b39ee5..5732fedc84b7a84cb336b5fca1dc0d8a58f46744 100644 (file)
@@ -501,6 +501,7 @@ Currently the miio binding supports more than 330 different models.
 | Smartmi Fresh Air System (Heating) | miio:basic       | [zhimi.airfresh.va4](#zhimi-airfresh-va4) | Yes          |            |
 | Mi Fresh Air Ventilator C1-80      | miio:basic       | [zhimi.airfresh.ua1](#zhimi-airfresh-ua1) | Yes          |            |
 | Mi PM2.5 Air Quality Monitor       | miio:basic       | [zhimi.airmonitor.v1](#zhimi-airmonitor-v1) | Yes          |            |
+| Mi Air Purifier 3C                 | miio:basic       | [zhimi.airp.mb4a](#zhimi-airp-mb4a) | Yes          |            |
 | Mi Air Purifier 2 (mini)           | miio:basic       | [zhimi.airpurifier.m1](#zhimi-airpurifier-m1) | Yes          |            |
 | Mi Air Purifier 2                  | miio:basic       | [zhimi.airpurifier.m2](#zhimi-airpurifier-m2) | Yes          |            |
 | Mi Air Purifier 2S                 | miio:basic       | [zhimi.airpurifier.ma1](#zhimi-airpurifier-ma1) | Yes          |            |
@@ -4777,6 +4778,25 @@ Note, not all the values need to be in the json file, e.g. a subset of the param
 | night_begin          | Number               | Night Begin Time                         |            |
 | night_end            | Number               | Night End Time                           |            |
 
+### Mi Air Purifier 3C (<a name="zhimi-airp-mb4a">zhimi.airp.mb4a</a>) Channels
+
+| Channel              | Type                 | Description                              | Comment    |
+|----------------------|----------------------|------------------------------------------|------------|
+| actions              | String               | Actions                                  | Value mapping `["filter-reset-filter-life"="Filter Reset Filter Life"]` |
+| on                   | Switch               | Power                                    |            |
+| fault                | String               | Air Purifier - Device Fault              |            |
+| mode                 | Number               | Mode                                     | Value mapping `["0"="Auto","1"="Sleep","2"="Favorite"]` |
+| pm2_5_density        | Number               | Environment - PM2 5 Density              |            |
+| filter_life_level    | Number:Dimensionless | Filter - Filter Life Level               |            |
+| filter_used_time     | Number:Time          | Filter - Filter Used Time                |            |
+| alarm                | Switch               | Alarm - Alarm                            |            |
+| brightness           | Number               | Screen - Brightness                      |            |
+| physical_controls_locked | Switch               | Physical Control Locked - Physical Control Locked |            |
+| moto_speed_rpm       | Number               | Custom Service - Moto Speed Rpm          |            |
+| miio_lib_version     | String               | Custom Service - Miio Lib Version        |            |
+| favorite_speed       | Number               | Custom Service - Favorite Speed          |            |
+| aqi_updata_heartbeat | Number:Time          | Custom Service - Aqi Updata Heartbeat    |            |
+
 ### Mi Air Purifier 2 (mini) (<a name="zhimi-airpurifier-m1">zhimi.airpurifier.m1</a>) Channels
 
 | Channel              | Type                 | Description                              | Comment    |
@@ -10697,6 +10717,28 @@ Number night_begin "Night Begin Time" (G_airmonitor) {channel="miio:basic:airmon
 Number night_end "Night End Time" (G_airmonitor) {channel="miio:basic:airmonitor:night_end"}
 ```
 
+### Mi Air Purifier 3C (zhimi.airp.mb4a) item file lines
+
+note: Autogenerated example. Replace the id (airp) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered.
+
+```
+Group G_airp "Mi Air Purifier 3C" <status>
+String actions "Actions" (G_airp) {channel="miio:basic:airp:actions"}
+Switch on "Power" (G_airp) {channel="miio:basic:airp:on"}
+String fault "Air Purifier - Device Fault" (G_airp) {channel="miio:basic:airp:fault"}
+Number mode "Mode" (G_airp) {channel="miio:basic:airp:mode"}
+Number pm2_5_density "Environment - PM2 5 Density" (G_airp) {channel="miio:basic:airp:pm2_5_density"}
+Number:Dimensionless filter_life_level "Filter - Filter Life Level" (G_airp) {channel="miio:basic:airp:filter_life_level"}
+Number:Time filter_used_time "Filter - Filter Used Time" (G_airp) {channel="miio:basic:airp:filter_used_time"}
+Switch alarm "Alarm - Alarm" (G_airp) {channel="miio:basic:airp:alarm"}
+Number brightness "Screen - Brightness" (G_airp) {channel="miio:basic:airp:brightness"}
+Switch physical_controls_locked "Physical Control Locked - Physical Control Locked" (G_airp) {channel="miio:basic:airp:physical_controls_locked"}
+Number moto_speed_rpm "Custom Service - Moto Speed Rpm" (G_airp) {channel="miio:basic:airp:moto_speed_rpm"}
+String miio_lib_version "Custom Service - Miio Lib Version" (G_airp) {channel="miio:basic:airp:miio_lib_version"}
+Number favorite_speed "Custom Service - Favorite Speed" (G_airp) {channel="miio:basic:airp:favorite_speed"}
+Number:Time aqi_updata_heartbeat "Custom Service - Aqi Updata Heartbeat" (G_airp) {channel="miio:basic:airp:aqi_updata_heartbeat"}
+```
+
 ### Mi Air Purifier 2 (mini) (zhimi.airpurifier.m1) item file lines
 
 note: Autogenerated example. Replace the id (airpurifier) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered.
index 2bb0fa863940d2f8ca985170ab70c7a7685b1cda..270fec28a3eb6273540507d7df5b439ea5f8dfbe 100644 (file)
@@ -374,6 +374,7 @@ public enum MiIoDevices {
     ZHIMI_AIRFRESH_VA4("zhimi.airfresh.va4", "Smartmi Fresh Air System (Heating)", THING_TYPE_BASIC),
     ZHIMI_AIRFRESH_UA1("zhimi.airfresh.ua1", "Mi Fresh Air Ventilator C1-80", THING_TYPE_BASIC),
     ZHIMI_AIRMONITOR_V1("zhimi.airmonitor.v1", "Mi PM2.5 Air Quality Monitor", THING_TYPE_BASIC),
+    ZHIMI_AIRP_MB4A("zhimi.airp.mb4a", "Mi Air Purifier 3C", THING_TYPE_BASIC),
     ZHIMI_AIRPURIFIER_M1("zhimi.airpurifier.m1", "Mi Air Purifier 2 (mini)", THING_TYPE_BASIC),
     ZHIMI_AIRPURIFIER_M2("zhimi.airpurifier.m2", "Mi Air Purifier 2", THING_TYPE_BASIC),
     ZHIMI_AIRPURIFIER_MA1("zhimi.airpurifier.ma1", "Mi Air Purifier 2S", THING_TYPE_BASIC),
index c131cbe89bf41ab3d04f4b3716071202677f18be..533349535cbe1f225202c1e69e7142057e5e1cf1 100644 (file)
@@ -315,6 +315,7 @@ thing.zhimi.airfresh.va2 = Smartmi Ventilation System
 thing.zhimi.airfresh.va4 = Smartmi Fresh Air System (Heating)
 thing.zhimi.airfresh.ua1 = Mi Fresh Air Ventilator C1-80
 thing.zhimi.airmonitor.v1 = Mi PM2.5 Air Quality Monitor
+thing.zhimi.airp.mb4a = Mi Air Purifier 3C
 thing.zhimi.airpurifier.m1 = Mi Air Purifier 2 (mini)
 thing.zhimi.airpurifier.m2 = Mi Air Purifier 2
 thing.zhimi.airpurifier.ma1 = Mi Air Purifier 2S
@@ -1412,6 +1413,20 @@ ch.zhimi.airmonitor.v1.night_state = Night State
 ch.zhimi.airmonitor.v1.power = Power
 ch.zhimi.airmonitor.v1.time_state = Time State
 ch.zhimi.airmonitor.v1.usb_state = USB State
+ch.zhimi.airp.mb4a-miot.actions = Actions
+ch.zhimi.airp.mb4a-miot.alarm = Alarm - Alarm
+ch.zhimi.airp.mb4a-miot.aqi_updata_heartbeat = Custom Service - Aqi Updata Heartbeat
+ch.zhimi.airp.mb4a-miot.brightness = Screen - Brightness
+ch.zhimi.airp.mb4a-miot.fault = Air Purifier - Device Fault
+ch.zhimi.airp.mb4a-miot.favorite_speed = Custom Service - Favorite Speed
+ch.zhimi.airp.mb4a-miot.filter_life_level = Filter - Filter Life Level
+ch.zhimi.airp.mb4a-miot.filter_used_time = Filter - Filter Used Time
+ch.zhimi.airp.mb4a-miot.miio_lib_version = Custom Service - Miio Lib Version
+ch.zhimi.airp.mb4a-miot.mode = Mode
+ch.zhimi.airp.mb4a-miot.moto_speed_rpm = Custom Service - Moto Speed Rpm
+ch.zhimi.airp.mb4a-miot.on = Power
+ch.zhimi.airp.mb4a-miot.physical_controls_locked = Physical Control Locked - Physical Control Locked
+ch.zhimi.airp.mb4a-miot.pm2_5_density = Environment - PM2 5 Density
 ch.zhimi.airpurifier.m1.aqi = Air Quality Index
 ch.zhimi.airpurifier.m1.averageaqi = Average Air Quality Index
 ch.zhimi.airpurifier.m1.buzzer = Buzzer Status
@@ -2828,6 +2843,10 @@ option.zhimi.airfresh.va4.mode-low = 1
 option.zhimi.airfresh.va4.mode-middle = 2
 option.zhimi.airfresh.va4.mode-silent = Night
 option.zhimi.airfresh.va4.mode-strong = 3
+option.zhimi.airp.mb4a-miot.actions-filter-reset-filter-life = Filter Reset Filter Life
+option.zhimi.airp.mb4a-miot.mode-0 = Auto
+option.zhimi.airp.mb4a-miot.mode-1 = Sleep
+option.zhimi.airp.mb4a-miot.mode-2 = Favorite
 option.zhimi.airpurifier.m1.favoritelevel-0 = Favorite 0
 option.zhimi.airpurifier.m1.favoritelevel-1 = Favorite 1
 option.zhimi.airpurifier.m1.favoritelevel-10 = Favorite 10
diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.airp.mb4a-miot.json b/bundles/org.openhab.binding.miio/src/main/resources/database/zhimi.airp.mb4a-miot.json
new file mode 100644 (file)
index 0000000..fc945d3
--- /dev/null
@@ -0,0 +1,291 @@
+{
+       "deviceMapping": {
+               "id": [
+                       "zhimi.airp.mb4a"
+               ],
+               "propertyMethod": "get_properties",
+               "maxProperties": 1,
+               "channels": [
+                       {
+                               "property": "",
+                               "friendlyName": "Actions",
+                               "channel": "actions",
+                               "type": "String",
+                               "stateDescription": {
+                                       "options": [
+                                               {
+                                                       "value": "filter-reset-filter-life",
+                                                       "label": "Filter Reset Filter Life"
+                                               }
+                                       ]
+                               },
+                               "refresh": false,
+                               "actions": [
+                                       {
+                                               "command": "action",
+                                               "parameterType": "EMPTY",
+                                               "parameters": [
+                                                       3.0
+                                               ],
+                                               "siid": 4,
+                                               "aiid": 1,
+                                               "condition": {
+                                                       "name": "matchValue",
+                                                       "parameters": [
+                                                               {
+                                                                       "matchValue": "filter-reset-filter-life"
+                                                               }
+                                                       ]
+                                               }
+                                       }
+                               ],
+                               "readmeComment": "Value mapping `[\"filter-reset-filter-life\"\u003d\"Filter Reset Filter Life\"]`"
+                       },
+                       {
+                               "property": "on",
+                               "siid": 2,
+                               "piid": 1,
+                               "friendlyName": "Power",
+                               "channel": "on",
+                               "type": "Switch",
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "ONOFFBOOL"
+                                       }
+                               ],
+                               "category": "switch",
+                               "tags": [
+                                       "Switch"
+                               ]
+                       },
+                       {
+                               "property": "fault",
+                               "siid": 2,
+                               "piid": 2,
+                               "friendlyName": "Air Purifier - Device Fault",
+                               "channel": "fault",
+                               "type": "String",
+                               "stateDescription": {
+                                       "readOnly": true
+                               },
+                               "refresh": true,
+                               "actions": []
+                       },
+                       {
+                               "property": "mode",
+                               "siid": 2,
+                               "piid": 4,
+                               "friendlyName": "Mode",
+                               "channel": "mode",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "options": [
+                                               {
+                                                       "value": "0",
+                                                       "label": "Auto"
+                                               },
+                                               {
+                                                       "value": "1",
+                                                       "label": "Sleep"
+                                               },
+                                               {
+                                                       "value": "2",
+                                                       "label": "Favorite"
+                                               }
+                                       ]
+                               },
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "NUMBER"
+                                       }
+                               ],
+                               "tags": [
+                                       "Control"
+                               ],
+                               "readmeComment": "Value mapping `[\"0\"\u003d\"Auto\",\"1\"\u003d\"Sleep\",\"2\"\u003d\"Favorite\"]`"
+                       },
+                       {
+                               "property": "pm2.5-density",
+                               "siid": 3,
+                               "piid": 4,
+                               "friendlyName": "Environment - PM2 5 Density",
+                               "channel": "pm2_5_density",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "minimum": 0,
+                                       "maximum": 600,
+                                       "step": 1,
+                                       "pattern": "%.1f",
+                                       "readOnly": true
+                               },
+                               "refresh": true,
+                               "actions": []
+                       },
+                       {
+                               "property": "filter-life-level",
+                               "siid": 4,
+                               "piid": 1,
+                               "friendlyName": "Filter - Filter Life Level",
+                               "channel": "filter_life_level",
+                               "type": "Number:Dimensionless",
+                               "unit": "percentage",
+                               "stateDescription": {
+                                       "minimum": 0,
+                                       "maximum": 100,
+                                       "step": 1,
+                                       "pattern": "%.0f %unit%",
+                                       "readOnly": true
+                               },
+                               "refresh": true,
+                               "actions": []
+                       },
+                       {
+                               "property": "filter-used-time",
+                               "siid": 4,
+                               "piid": 3,
+                               "friendlyName": "Filter - Filter Used Time",
+                               "channel": "filter_used_time",
+                               "type": "Number:Time",
+                               "unit": "hours",
+                               "stateDescription": {
+                                       "minimum": 0,
+                                       "maximum": 65000,
+                                       "step": 1,
+                                       "pattern": "%.0f %unit%",
+                                       "readOnly": true
+                               },
+                               "refresh": true,
+                               "actions": []
+                       },
+                       {
+                               "property": "alarm",
+                               "siid": 6,
+                               "piid": 1,
+                               "friendlyName": "Alarm - Alarm",
+                               "channel": "alarm",
+                               "type": "Switch",
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "ONOFFBOOL"
+                                       }
+                               ]
+                       },
+                       {
+                               "property": "brightness",
+                               "siid": 7,
+                               "piid": 2,
+                               "friendlyName": "Screen - Brightness",
+                               "channel": "brightness",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "minimum": 0,
+                                       "maximum": 8,
+                                       "step": 1,
+                                       "pattern": "%.0f"
+                               },
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "NUMBER"
+                                       }
+                               ]
+                       },
+                       {
+                               "property": "physical-controls-locked",
+                               "siid": 8,
+                               "piid": 1,
+                               "friendlyName": "Physical Control Locked - Physical Control Locked",
+                               "channel": "physical_controls_locked",
+                               "type": "Switch",
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "ONOFFBOOL"
+                                       }
+                               ]
+                       },
+                       {
+                               "property": "moto-speed-rpm",
+                               "siid": 9,
+                               "piid": 1,
+                               "friendlyName": "Custom Service - Moto Speed Rpm",
+                               "channel": "moto_speed_rpm",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "minimum": 0,
+                                       "maximum": 65535,
+                                       "step": 1,
+                                       "pattern": "%.0f",
+                                       "readOnly": true
+                               },
+                               "refresh": true,
+                               "actions": []
+                       },
+                       {
+                               "property": "miio-lib-version",
+                               "siid": 9,
+                               "piid": 2,
+                               "friendlyName": "Custom Service - Miio Lib Version",
+                               "channel": "miio_lib_version",
+                               "type": "String",
+                               "stateDescription": {
+                                       "readOnly": true
+                               },
+                               "refresh": true,
+                               "actions": []
+                       },
+                       {
+                               "property": "favorite-speed",
+                               "siid": 9,
+                               "piid": 3,
+                               "friendlyName": "Custom Service - Favorite Speed",
+                               "channel": "favorite_speed",
+                               "type": "Number",
+                               "stateDescription": {
+                                       "minimum": 300,
+                                       "maximum": 2200,
+                                       "step": 1,
+                                       "pattern": "%.0f"
+                               },
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "STRING"
+                                       }
+                               ]
+                       },
+                       {
+                               "property": "aqi-updata-heartbeat",
+                               "siid": 9,
+                               "piid": 4,
+                               "friendlyName": "Custom Service - Aqi Updata Heartbeat",
+                               "channel": "aqi_updata_heartbeat",
+                               "type": "Number:Time",
+                               "unit": "seconds",
+                               "stateDescription": {
+                                       "minimum": 0,
+                                       "maximum": 65534,
+                                       "step": 1,
+                                       "pattern": "%.0f %unit%"
+                               },
+                               "refresh": true,
+                               "actions": [
+                                       {
+                                               "command": "set_properties",
+                                               "parameterType": "NUMBER"
+                                       }
+                               ]
+                       }
+               ],
+               "experimental": false
+       }
+}
index d35771789ac003a5737e78bf62cce294c519a36f..7de9dc4ece375f26cb203dd1bc8bc51b07ed0b80 100644 (file)
                                        "minimum": 0,
                                        "maximum": 65535,
                                        "step": 1,
-                                       "pattern": "%.1f",
+                                       "pattern": "%.0f",
                                        "readOnly": true
                                },
                                "refresh": true,
                                        "minimum": 300,
                                        "maximum": 2200,
                                        "step": 1,
-                                       "pattern": "%.1f"
+                                       "pattern": "%.0f"
                                },
                                "refresh": true,
                                "actions": [