From 54e128fee6887fc8e511e9cb3be208b2d1cc9730 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 2 Oct 2023 09:18:18 +0200 Subject: [PATCH] [miio] Add support "Mi Smart Antibacterial Humidifier" (#15676) Adding support for the following models: * Xiaomi Smart Humidifier 2 (modelId: deerma.humidifier.jsq2w) closing #15639 Signed-off-by: Marcel Verpaalen --- bundles/org.openhab.binding.miio/README.md | 48 +++ .../binding/miio/internal/MiIoDevices.java | 1 + .../resources/OH-INF/i18n/basic.properties | 29 ++ .../database/deerma.humidifier.jsq2w.json | 337 ++++++++++++++++++ 4 files changed, 415 insertions(+) create mode 100644 bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq2w.json diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md index d4fe2542b..6a718537c 100644 --- a/bundles/org.openhab.binding.miio/README.md +++ b/bundles/org.openhab.binding.miio/README.md @@ -236,6 +236,7 @@ Currently the miio binding supports more than 360 different models. | Gosund Smart Plug | miio:basic | [cuco.plug.cp1](#cuco-plug-cp1) | Yes | | | Mi Smart Antibacterial Humidifier | miio:basic | [deerma.humidifier.jsq](#deerma-humidifier-jsq) | Yes | | | Mi S Smart Humidifer | miio:basic | [deerma.humidifier.jsq1](#deerma-humidifier-jsq1) | Yes | | +| Xiaomi Smart Humidifier 2 | miio:basic | [deerma.humidifier.jsq2w](#deerma-humidifier-jsq2w) | Yes | | | Mi Smart Antibacterial Humidifier | miio:basic | [deerma.humidifier.jsq5](#deerma-humidifier-jsq5) | Yes | | | Mi Smart Humidifer S | miio:basic | [deerma.humidifier.jsqs](#deerma-humidifier-jsqs) | Yes | | | Mi Smart Humidifier | miio:basic | [deerma.humidifier.mjjsq](#deerma-humidifier-mjjsq) | Yes | | @@ -884,6 +885,28 @@ Note, not all the values need to be in the json file, e.g. a subset of the param | watertankstatus | Number | Watertank Status | | | wet_and_protect | Switch | Wet and Protect | | +### Xiaomi Smart Humidifier 2 (deerma.humidifier.jsq2w) Channels + +| Channel | Type | Description | Comment | +|----------------------|----------------------|------------------------------------------|------------| +| on | Switch | Humidifier - Switch Status | | +| fault | Number | Humidifier - Device Fault | Value mapping `["0"="No Faults","1"="Insufficient Water","2"="Water Separation"]` | +| fan_level | Number | Humidifier - Fan Level | Value mapping `["1"="Level1","2"="Level2","3"="Level3","4"="Humidity"]` | +| target_humidity | Number:Dimensionless | Humidifier - Target Humidity | | +| status | Number | Status | Value mapping `["1"="Idle","2"="Busy"]` | +| mode | Number | Mode | Value mapping `["0"="None","1"="Constant Humidity"]` | +| relative_humidity | Number:Dimensionless | Environment - Relative Humidity | | +| temperature | Number:Temperature | Environment - Temperature | | +| alarm | Switch | Alarm - Alarm | | +| on1 | Switch | Indicator Light - Switch Status | | +| tank_filed | Switch | Tank Filed | | +| water_shortage_fault | Switch | Water Shortage Fault | | +| humi_sensor_fault | Switch | Humi-Sensor Fault | | +| temp_sensor_fault | Switch | Temp-Sensor Fault | | +| overwet_protect | Switch | Overwet Protect | | +| overwet_protect_on | Switch | Overwet Protect On | | +| overtop_humidity | Switch | Overtop Humidity | | + ### Mi Smart Antibacterial Humidifier (deerma.humidifier.jsq5) Channels | Channel | Type | Description | Comment | @@ -6445,6 +6468,31 @@ Number watertankstatus "Watertank Status" (G_humidifier) {channel="miio:basic:hu Switch wet_and_protect "Wet and Protect" (G_humidifier) {channel="miio:basic:humidifier:wet_and_protect"} ``` +### Xiaomi Smart Humidifier 2 (deerma.humidifier.jsq2w) item file lines + +note: Autogenerated example. Replace the id (humidifier) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. + +``` +Group G_humidifier "Xiaomi Smart Humidifier 2" +Switch on "Humidifier - Switch Status" (G_humidifier) {channel="miio:basic:humidifier:on"} +Number fault "Humidifier - Device Fault" (G_humidifier) {channel="miio:basic:humidifier:fault"} +Number fan_level "Humidifier - Fan Level" (G_humidifier) {channel="miio:basic:humidifier:fan_level"} +Number:Dimensionless target_humidity "Humidifier - Target Humidity" (G_humidifier) {channel="miio:basic:humidifier:target_humidity"} +Number status "Status" (G_humidifier) {channel="miio:basic:humidifier:status"} +Number mode "Mode" (G_humidifier) {channel="miio:basic:humidifier:mode"} +Number:Dimensionless relative_humidity "Environment - Relative Humidity" (G_humidifier) {channel="miio:basic:humidifier:relative_humidity"} +Number:Temperature temperature "Environment - Temperature" (G_humidifier) {channel="miio:basic:humidifier:temperature"} +Switch alarm "Alarm - Alarm" (G_humidifier) {channel="miio:basic:humidifier:alarm"} +Switch on1 "Indicator Light - Switch Status" (G_humidifier) {channel="miio:basic:humidifier:on1"} +Switch tank_filed "Tank Filed" (G_humidifier) {channel="miio:basic:humidifier:tank_filed"} +Switch water_shortage_fault "Water Shortage Fault" (G_humidifier) {channel="miio:basic:humidifier:water_shortage_fault"} +Switch humi_sensor_fault "Humi-Sensor Fault" (G_humidifier) {channel="miio:basic:humidifier:humi_sensor_fault"} +Switch temp_sensor_fault "Temp-Sensor Fault" (G_humidifier) {channel="miio:basic:humidifier:temp_sensor_fault"} +Switch overwet_protect "Overwet Protect" (G_humidifier) {channel="miio:basic:humidifier:overwet_protect"} +Switch overwet_protect_on "Overwet Protect On" (G_humidifier) {channel="miio:basic:humidifier:overwet_protect_on"} +Switch overtop_humidity "Overtop Humidity" (G_humidifier) {channel="miio:basic:humidifier:overtop_humidity"} +``` + ### Mi Smart Antibacterial Humidifier (deerma.humidifier.jsq5) item file lines note: Autogenerated example. Replace the id (humidifier) in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered. 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 430938f2a..313ba416d 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 @@ -51,6 +51,7 @@ public enum MiIoDevices { CUCO_PLUG_CP1("cuco.plug.cp1", "Gosund Smart Plug", THING_TYPE_BASIC), DEERMA_HUMIDIFIER_JSQ("deerma.humidifier.jsq", "Mi Smart Antibacterial Humidifier", THING_TYPE_BASIC), DEERMA_HUMIDIFIER_JSQ1("deerma.humidifier.jsq1", "Mi S Smart Humidifer ", THING_TYPE_BASIC), + DEERMA_HUMIDIFIER_JSQ2W("deerma.humidifier.jsq2w", "Xiaomi Smart Humidifier 2", THING_TYPE_BASIC), DEERMA_HUMIDIFIER_JSQ5("deerma.humidifier.jsq5", "Mi Smart Antibacterial Humidifier", THING_TYPE_BASIC), DEERMA_HUMIDIFIER_JSQS("deerma.humidifier.jsqs", "Mi Smart Humidifer S", THING_TYPE_BASIC), DEERMA_HUMIDIFIER_MJJSQ("deerma.humidifier.mjjsq", "Mi Smart Humidifier", THING_TYPE_BASIC), diff --git a/bundles/org.openhab.binding.miio/src/main/resources/OH-INF/i18n/basic.properties b/bundles/org.openhab.binding.miio/src/main/resources/OH-INF/i18n/basic.properties index 1126d11af..70dc4449b 100644 --- a/bundles/org.openhab.binding.miio/src/main/resources/OH-INF/i18n/basic.properties +++ b/bundles/org.openhab.binding.miio/src/main/resources/OH-INF/i18n/basic.properties @@ -28,6 +28,7 @@ thing.chunmi.cooker.press2 = Mi IH Pressure Rice Cooker thing.cuco.plug.cp1 = Gosund Smart Plug thing.deerma.humidifier.jsq = Mi Smart Antibacterial Humidifier thing.deerma.humidifier.jsq1 = Mi S Smart Humidifer +thing.deerma.humidifier.jsq2w = Xiaomi Smart Humidifier 2 thing.deerma.humidifier.jsq5 = Mi Smart Antibacterial Humidifier thing.deerma.humidifier.jsqs = Mi Smart Humidifer S thing.deerma.humidifier.mjjsq = Mi Smart Humidifier @@ -502,6 +503,23 @@ ch.deerma.humidifier.jsq1.power = Power ch.deerma.humidifier.jsq1.sound = Notification Sounds ch.deerma.humidifier.jsq1.watertankstatus = Watertank Status ch.deerma.humidifier.jsq1.wet_and_protect = Wet and Protect +ch.deerma.humidifier.jsq2w.alarm = Alarm - Alarm +ch.deerma.humidifier.jsq2w.fan_level = Humidifier - Fan Level +ch.deerma.humidifier.jsq2w.fault = Humidifier - Device Fault +ch.deerma.humidifier.jsq2w.humi_sensor_fault = Humi-Sensor Fault +ch.deerma.humidifier.jsq2w.mode = Mode +ch.deerma.humidifier.jsq2w.on = Humidifier - Switch Status +ch.deerma.humidifier.jsq2w.on1 = Indicator Light - Switch Status +ch.deerma.humidifier.jsq2w.overtop_humidity = Overtop Humidity +ch.deerma.humidifier.jsq2w.overwet_protect = Overwet Protect +ch.deerma.humidifier.jsq2w.overwet_protect_on = Overwet Protect On +ch.deerma.humidifier.jsq2w.relative_humidity = Environment - Relative Humidity +ch.deerma.humidifier.jsq2w.status = Status +ch.deerma.humidifier.jsq2w.tank_filed = Tank Filed +ch.deerma.humidifier.jsq2w.target_humidity = Humidifier - Target Humidity +ch.deerma.humidifier.jsq2w.temp_sensor_fault = Temp-Sensor Fault +ch.deerma.humidifier.jsq2w.temperature = Environment - Temperature +ch.deerma.humidifier.jsq2w.water_shortage_fault = Water Shortage Fault ch.deerma.humidifier.jsq5.alarm = Alarm - Alarm ch.deerma.humidifier.jsq5.fan_level = Humidifier - Fan Level ch.deerma.humidifier.jsq5.fault = Humidifier - Device Fault @@ -2305,6 +2323,17 @@ option.deerma.humidifier.jsq1.mode-1 = Low option.deerma.humidifier.jsq1.mode-2 = Medium option.deerma.humidifier.jsq1.mode-3 = High option.deerma.humidifier.jsq1.mode-4 = Humidity +option.deerma.humidifier.jsq2w.fan_level-1 = Level1 +option.deerma.humidifier.jsq2w.fan_level-2 = Level2 +option.deerma.humidifier.jsq2w.fan_level-3 = Level3 +option.deerma.humidifier.jsq2w.fan_level-4 = Humidity +option.deerma.humidifier.jsq2w.fault-0 = No Faults +option.deerma.humidifier.jsq2w.fault-1 = Insufficient Water +option.deerma.humidifier.jsq2w.fault-2 = Water Separation +option.deerma.humidifier.jsq2w.mode-0 = None +option.deerma.humidifier.jsq2w.mode-1 = Constant Humidity +option.deerma.humidifier.jsq2w.status-1 = Idle +option.deerma.humidifier.jsq2w.status-2 = Busy option.deerma.humidifier.jsq5.fan_level-1 = Level1 option.deerma.humidifier.jsq5.fan_level-2 = Level2 option.deerma.humidifier.jsq5.fan_level-3 = Level3 diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq2w.json b/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq2w.json new file mode 100644 index 000000000..bfb8878b3 --- /dev/null +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq2w.json @@ -0,0 +1,337 @@ +{ + "deviceMapping": { + "id": [ + "deerma.humidifier.jsq2w" + ], + "propertyMethod": "get_properties", + "maxProperties": 1, + "channels": [ + { + "property": "on", + "siid": 2, + "piid": 1, + "friendlyName": "Humidifier - Switch Status", + "channel": "on", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ], + "category": "switch", + "tags": [ + "Switch" + ] + }, + { + "property": "fault", + "siid": 2, + "piid": 2, + "friendlyName": "Humidifier - Device Fault", + "channel": "fault", + "type": "Number", + "stateDescription": { + "readOnly": true, + "options": [ + { + "value": "0", + "label": "No Faults" + }, + { + "value": "1", + "label": "Insufficient Water" + }, + { + "value": "2", + "label": "Water Separation" + } + ] + }, + "refresh": true, + "actions": [], + "readmeComment": "Value mapping `[\"0\"\u003d\"No Faults\",\"1\"\u003d\"Insufficient Water\",\"2\"\u003d\"Water Separation\"]`" + }, + { + "property": "fan-level", + "siid": 2, + "piid": 5, + "friendlyName": "Humidifier - Fan Level", + "channel": "fan_level", + "type": "Number", + "stateDescription": { + "options": [ + { + "value": "1", + "label": "Level1" + }, + { + "value": "2", + "label": "Level2" + }, + { + "value": "3", + "label": "Level3" + }, + { + "value": "4", + "label": "Humidity" + } + ] + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ], + "readmeComment": "Value mapping `[\"1\"\u003d\"Level1\",\"2\"\u003d\"Level2\",\"3\"\u003d\"Level3\",\"4\"\u003d\"Humidity\"]`" + }, + { + "property": "target-humidity", + "siid": 2, + "piid": 6, + "friendlyName": "Humidifier - Target Humidity", + "channel": "target_humidity", + "type": "Number:Dimensionless", + "unit": "percentage", + "stateDescription": { + "minimum": 40, + "maximum": 70, + "step": 1, + "pattern": "%.0f %%" + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ] + }, + { + "property": "status", + "siid": 2, + "piid": 7, + "friendlyName": "Status", + "channel": "status", + "type": "Number", + "stateDescription": { + "readOnly": true, + "options": [ + { + "value": "1", + "label": "Idle" + }, + { + "value": "2", + "label": "Busy" + } + ] + }, + "refresh": true, + "actions": [], + "readmeComment": "Value mapping `[\"1\"\u003d\"Idle\",\"2\"\u003d\"Busy\"]`" + }, + { + "property": "mode", + "siid": 2, + "piid": 8, + "friendlyName": "Mode", + "channel": "mode", + "type": "Number", + "stateDescription": { + "readOnly": true, + "options": [ + { + "value": "0", + "label": "None" + }, + { + "value": "1", + "label": "Constant Humidity" + } + ] + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ], + "readmeComment": "Value mapping `[\"0\"\u003d\"None\",\"1\"\u003d\"Constant Humidity\"]`" + }, + { + "property": "relative-humidity", + "siid": 3, + "piid": 1, + "friendlyName": "Environment - Relative Humidity", + "channel": "relative_humidity", + "type": "Number:Dimensionless", + "unit": "percentage", + "stateDescription": { + "minimum": 0, + "maximum": 100, + "step": 1, + "pattern": "%.0f %%", + "readOnly": true + }, + "refresh": true, + "actions": [], + "category": "humidity", + "tags": [ + "Measurement", + "Humidity" + ] + }, + { + "property": "temperature", + "siid": 3, + "piid": 7, + "friendlyName": "Environment - Temperature", + "channel": "temperature", + "type": "Number:Temperature", + "unit": "celsius", + "stateDescription": { + "minimum": -30, + "maximum": 100, + "step": 1, + "pattern": "%.0f %unit%", + "readOnly": true + }, + "refresh": true, + "actions": [] + }, + { + "property": "alarm", + "siid": 5, + "piid": 1, + "friendlyName": "Alarm - Alarm", + "channel": "alarm", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "on1", + "siid": 6, + "piid": 1, + "friendlyName": "Indicator Light - Switch Status", + "channel": "on1", + "type": "Switch", + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "tank-filed", + "siid": 7, + "piid": 1, + "friendlyName": "Tank Filed", + "channel": "tank_filed", + "type": "Switch", + "stateDescription": { + "readOnly": true + }, + "refresh": true, + "actions": [] + }, + { + "property": "water-shortage-fault", + "siid": 7, + "piid": 2, + "friendlyName": "Water Shortage Fault", + "channel": "water_shortage_fault", + "type": "Switch", + "stateDescription": { + "readOnly": true + }, + "refresh": true, + "actions": [] + }, + { + "property": "the-tank-filed", + "siid": 7, + "piid": 3, + "friendlyName": "Humi-Sensor Fault", + "channel": "humi_sensor_fault", + "type": "Switch", + "stateDescription": { + "readOnly": true + }, + "refresh": true, + "actions": [] + }, + { + "property": "temp-sensor-fault", + "siid": 7, + "piid": 4, + "friendlyName": "Temp-Sensor Fault", + "channel": "temp_sensor_fault", + "type": "Switch", + "stateDescription": { + "readOnly": true + }, + "refresh": true, + "actions": [] + }, + { + "property": "overwet-protect", + "siid": 7, + "piid": 5, + "friendlyName": "Overwet Protect", + "channel": "overwet_protect", + "type": "Switch", + "stateDescription": { + "readOnly": true + }, + "refresh": true, + "actions": [] + }, + { + "property": "overwet-protect-on", + "siid": 7, + "piid": 6, + "friendlyName": "Overwet Protect On", + "channel": "overwet_protect_on", + "type": "Switch", + "stateDescription": { + "readOnly": true + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "ONOFFBOOL" + } + ] + }, + { + "property": "overtop-humidity", + "siid": 7, + "piid": 7, + "friendlyName": "Overtop Humidity", + "channel": "overtop_humidity", + "type": "Switch", + "stateDescription": { + "readOnly": true + }, + "refresh": true, + "actions": [] + } + ], + "experimental": false + } +}