From 58f40a5c734a124684b014346e11fb6dcb7b4079 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sat, 20 Nov 2021 12:34:00 +0100 Subject: [PATCH] [miio] add support Mi Smart Humidifier deerma.humidifier.jsq5 (#11577) https://community.openhab.org/t/mi-smart-antibacterial-humidifier-not-recognized/127562 Signed-off-by: Marcel Verpaalen --- bundles/org.openhab.binding.miio/README.md | 34 +++ .../binding/miio/internal/MiIoDevices.java | 1 + .../database/deerma.humidifier.jsq5.json | 214 ++++++++++++++++++ 3 files changed, 249 insertions(+) create mode 100644 bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq5.json diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md index 1a3a95208019..c8251f60c582 100644 --- a/bundles/org.openhab.binding.miio/README.md +++ b/bundles/org.openhab.binding.miio/README.md @@ -205,6 +205,7 @@ Currently the miio binding supports more than 300 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 | | +| Mi Smart Antibacterial Humidifier | miio:basic | [deerma.humidifier.jsq5](#deerma-humidifier-jsq5) | Yes | | | Mi Smart Humidifier | miio:basic | [deerma.humidifier.mjjsq](#deerma-humidifier-mjjsq) | Yes | | | Mi Fresh Air Ventilator A1-150 | miio:basic | [dmaker.airfresh.a1](#dmaker-airfresh-a1) | Yes | | | Mi Fresh Air Ventilator | miio:basic | [dmaker.airfresh.t2017](#dmaker-airfresh-t2017) | Yes | | @@ -794,6 +795,21 @@ 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 | | +### Mi Smart Antibacterial Humidifier (deerma.humidifier.jsq5) 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 | | +| relative_humidity | Number:Dimensionless | Environment - Relative Humidity | | +| temperature | Number:Temperature | Environment - Temperature | | +| alarm | Switch | Alarm - Alarm | | +| on1 | Switch | Indicator Light - Switch Status | | +| water_shortage_fault | Switch | Custom - Water Shortage Fault | | +| the_tank_filed | Switch | Custom - The Tank Filed | | + ### Mi Smart Humidifier (deerma.humidifier.mjjsq) Channels | Channel | Type | Description | Comment | @@ -5589,6 +5605,24 @@ 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"} ``` +### 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. + +``` +Group G_humidifier "Mi Smart Antibacterial Humidifier" +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: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 water_shortage_fault "Custom - Water Shortage Fault" (G_humidifier) {channel="miio:basic:humidifier:water_shortage_fault"} +Switch the_tank_filed "Custom - The Tank Filed" (G_humidifier) {channel="miio:basic:humidifier:the_tank_filed"} +``` + ### Mi Smart Humidifier (deerma.humidifier.mjjsq) 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 dbc8a17a59d9..e8e89b15ba7f 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_JSQ5("deerma.humidifier.jsq5", "Mi Smart Antibacterial Humidifier", THING_TYPE_BASIC), DEERMA_HUMIDIFIER_MJJSQ("deerma.humidifier.mjjsq", "Mi Smart Humidifier", THING_TYPE_BASIC), DMAKER_AIRFRESH_A1("dmaker.airfresh.a1", "Mi Fresh Air Ventilator A1-150", THING_TYPE_BASIC), DMAKER_AIRFRESH_T2017("dmaker.airfresh.t2017", "Mi Fresh Air Ventilator", THING_TYPE_BASIC), diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq5.json b/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq5.json new file mode 100644 index 000000000000..9a8cfbc9a93f --- /dev/null +++ b/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq5.json @@ -0,0 +1,214 @@ +{ + "deviceMapping": { + "id": [ + "deerma.humidifier.jsq5" + ], + "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": 80, + "step": 1, + "pattern": "%.0f %%" + }, + "refresh": true, + "actions": [ + { + "command": "set_properties", + "parameterType": "NUMBER" + } + ] + }, + { + "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": "water-shortage-fault", + "siid": 7, + "piid": 1, + "friendlyName": "Custom - Water Shortage Fault", + "channel": "water_shortage_fault", + "type": "Switch", + "stateDescription": { + "readOnly": true + }, + "refresh": true, + "actions": [] + }, + { + "property": "the-tank-filed", + "siid": 7, + "piid": 2, + "friendlyName": "Custom - The Tank Filed", + "channel": "the_tank_filed", + "type": "Switch", + "stateDescription": { + "readOnly": true + }, + "refresh": true, + "actions": [] + } + ], + "experimental": false + } +}