diff --git a/bundles/org.openhab.binding.miio/README.md b/bundles/org.openhab.binding.miio/README.md
index 806207bbf..4a328b228 100644
--- a/bundles/org.openhab.binding.miio/README.md
+++ b/bundles/org.openhab.binding.miio/README.md
@@ -173,7 +173,7 @@ This will change the communication method and the Mi IO binding can communicate
# Mi IO Devices
-Currently the miio binding supports more than 260 different models.
+Currently the miio binding supports more than 270 different models.
| Device | ThingType | Device Model | Supported | Remark |
|------------------------------|------------------|------------------------|-----------|------------|
@@ -197,6 +197,8 @@ Currently the miio binding supports more than 260 different models.
| Mi IH Pressure Rice Cooker | miio:unsupported | chunmi.cooker.press1 | No | |
| Mi IH Pressure Rice Cooker | miio:unsupported | chunmi.cooker.press2 | No | |
| 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 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 | |
@@ -610,6 +612,43 @@ e.g. `openhab:send actionCommand 'upd_timer["1498595904821", "on"]'` would enabl
| SerialNumber | String | Device Information-Device Serial Number | |
| On | Switch | Switch-Switch Status | |
+### Mi Smart Antibacterial Humidifier (deerma.humidifier.jsq) Channels
+
+| Channel | Type | Description | Comment |
+|----------------------|----------------------|------------------------------------------|------------|
+| power | Switch | Power | |
+| mode | Number | Mode | |
+| humidity | Number:Dimensionless | Humidity | |
+| humidity_set | Number:Dimensionless | Humidity Setting | |
+| led | Switch | LED indicator Light | |
+| sound | Switch | Notification Sounds | |
+| watertankstatus | Number | Watertank Status | |
+
+### Mi S Smart humidifer (deerma.humidifier.jsq1) Channels
+
+| Channel | Type | Description | Comment |
+|----------------------|----------------------|------------------------------------------|------------|
+| power | Switch | Power | |
+| mode | Number | Mode | |
+| humidity | Number:Dimensionless | Humidity | |
+| humidity_set | Number:Dimensionless | Humidity Setting | |
+| led | Switch | LED indicator Light | |
+| sound | Switch | Notification Sounds | |
+| watertankstatus | Number | Watertank Status | |
+| wet_and_protect | Switch | Wet and Protect | |
+
+### Mi Smart Humidifier (deerma.humidifier.mjjsq) Channels
+
+| Channel | Type | Description | Comment |
+|----------------------|----------------------|------------------------------------------|------------|
+| power | Switch | Power | |
+| mode | Number | Mode | |
+| humidity | Number:Dimensionless | Humidity | |
+| humidity_set | Number:Dimensionless | Humidity Setting | |
+| led | Switch | LED indicator Light | |
+| sound | Switch | Notification Sounds | |
+| watertankstatus | Number | Watertank Status | |
+
### Mi Fresh Air Ventilator A1-150 (dmaker.airfresh.a1) Channels
| Channel | Type | Description | Comment |
@@ -4722,6 +4761,52 @@ String SerialNumber "Device Information-Device Serial Number" (G_plug) {channel=
Switch On "Switch-Switch Status" (G_plug) {channel="miio:basic:plug:On"}
```
+### Mi Smart Antibacterial Humidifier (deerma.humidifier.jsq) 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 power "Power" (G_humidifier) {channel="miio:basic:humidifier:power"}
+Number mode "Mode" (G_humidifier) {channel="miio:basic:humidifier:mode"}
+Number:Dimensionless humidity "Humidity" (G_humidifier) {channel="miio:basic:humidifier:humidity"}
+Number:Dimensionless humidity_set "Humidity Setting" (G_humidifier) {channel="miio:basic:humidifier:humidity_set"}
+Switch led "LED indicator Light" (G_humidifier) {channel="miio:basic:humidifier:led"}
+Switch sound "Notification Sounds" (G_humidifier) {channel="miio:basic:humidifier:sound"}
+Number watertankstatus "Watertank Status" (G_humidifier) {channel="miio:basic:humidifier:watertankstatus"}
+```
+
+### Mi S Smart humidifer (deerma.humidifier.jsq1) 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 S Smart humidifer "
+Switch power "Power" (G_humidifier) {channel="miio:basic:humidifier:power"}
+Number mode "Mode" (G_humidifier) {channel="miio:basic:humidifier:mode"}
+Number:Dimensionless humidity "Humidity" (G_humidifier) {channel="miio:basic:humidifier:humidity"}
+Number:Dimensionless humidity_set "Humidity Setting" (G_humidifier) {channel="miio:basic:humidifier:humidity_set"}
+Switch led "LED indicator Light" (G_humidifier) {channel="miio:basic:humidifier:led"}
+Switch sound "Notification Sounds" (G_humidifier) {channel="miio:basic:humidifier:sound"}
+Number watertankstatus "Watertank Status" (G_humidifier) {channel="miio:basic:humidifier:watertankstatus"}
+Switch wet_and_protect "Wet and Protect" (G_humidifier) {channel="miio:basic:humidifier:wet_and_protect"}
+```
+
+### 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.
+
+```
+Group G_humidifier "Mi Smart Humidifier"
+Switch power "Power" (G_humidifier) {channel="miio:basic:humidifier:power"}
+Number mode "Mode" (G_humidifier) {channel="miio:basic:humidifier:mode"}
+Number:Dimensionless humidity "Humidity" (G_humidifier) {channel="miio:basic:humidifier:humidity"}
+Number:Dimensionless humidity_set "Humidity Setting" (G_humidifier) {channel="miio:basic:humidifier:humidity_set"}
+Switch led "LED indicator Light" (G_humidifier) {channel="miio:basic:humidifier:led"}
+Switch sound "Notification Sounds" (G_humidifier) {channel="miio:basic:humidifier:sound"}
+Number watertankstatus "Watertank Status" (G_humidifier) {channel="miio:basic:humidifier:watertankstatus"}
+```
+
### Mi Fresh Air Ventilator A1-150 (dmaker.airfresh.a1) item file lines
note: Autogenerated example. Replace the id (airfresh) 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 b3c224629..1125f9e52 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
@@ -45,6 +45,8 @@ public enum MiIoDevices {
CHUNMI_COOKER_PRESS1("chunmi.cooker.press1", "Mi IH Pressure Rice Cooker", THING_TYPE_UNSUPPORTED),
CHUNMI_COOKER_PRESS2("chunmi.cooker.press2", "Mi IH Pressure Rice Cooker", THING_TYPE_UNSUPPORTED),
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_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/java/org/openhab/binding/miio/internal/basic/CommandParameterType.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/CommandParameterType.java
index c2a26b770..7a379a581 100644
--- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/CommandParameterType.java
+++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/basic/CommandParameterType.java
@@ -27,6 +27,7 @@ public enum CommandParameterType {
ONOFFPARA("onoffpara"),
ONOFFBOOL("onoffbool"),
ONOFFBOOLSTRING("onoffboolstring"),
+ ONOFFNUMBER("onoffnumber"),
STRING("string"),
CUSTOMSTRING("customstring"),
NUMBER("number"),
diff --git a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java
index bb7731f47..0f1d8ae74 100644
--- a/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java
+++ b/bundles/org.openhab.binding.miio/src/main/java/org/openhab/binding/miio/internal/handler/MiIoBasicHandler.java
@@ -196,6 +196,8 @@ public class MiIoBasicHandler extends MiIoAbstractHandler {
value = new JsonPrimitive(boolCommand);
} else if (paramType == CommandParameterType.ONOFFBOOLSTRING) {
value = new JsonPrimitive(command == OnOffType.ON ? "true" : "false");
+ } else if (paramType == CommandParameterType.ONOFFNUMBER) {
+ value = new JsonPrimitive(command == OnOffType.ON ? 1 : 0);
}
} else if (command instanceof DecimalType) {
value = new JsonPrimitive(((DecimalType) command).toBigDecimal());
@@ -570,8 +572,13 @@ public class MiIoBasicHandler extends MiIoAbstractHandler {
updateState(basicChannel.getChannel(), new StringType(val.getAsString()));
break;
case "switch":
- updateState(basicChannel.getChannel(), val.getAsString().toLowerCase().equals("on")
- || val.getAsString().toLowerCase().equals("true") ? OnOffType.ON : OnOffType.OFF);
+ if (val.getAsJsonPrimitive().isNumber()) {
+ updateState(basicChannel.getChannel(), val.getAsInt() > 0 ? OnOffType.ON : OnOffType.OFF);
+ } else {
+ String strVal = val.getAsString().toLowerCase();
+ updateState(basicChannel.getChannel(),
+ strVal.equals("on") || strVal.equals("true") ? OnOffType.ON : OnOffType.OFF);
+ }
break;
case "color":
Color rgb = new Color(val.getAsInt());
diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq1.json b/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq1.json
new file mode 100644
index 000000000..2a8a2a531
--- /dev/null
+++ b/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.jsq1.json
@@ -0,0 +1,158 @@
+{
+ "deviceMapping": {
+ "id": [
+ "deerma.humidifier.jsq1"
+ ],
+ "maxProperties": 1,
+ "channels": [
+ {
+ "property": "OnOff_State",
+ "friendlyName": "Power",
+ "channel": "power",
+ "type": "Switch",
+ "refresh": true,
+ "actions": [
+ {
+ "command": "Set_OnOff",
+ "parameterType": "ONOFFNUMBER"
+ }
+ ],
+ "category": "switch",
+ "tags": [
+ "Switch"
+ ]
+ },
+ {
+ "property": "Humidifier_Gear",
+ "friendlyName": "Mode",
+ "channel": "mode",
+ "type": "Number",
+ "stateDescription": {
+ "options": [
+ {
+ "value": "1",
+ "label": "Low"
+ },
+ {
+ "value": "2",
+ "label": "Medium"
+ },
+ {
+ "value": "3",
+ "label": "High"
+ },
+ {
+ "value": "4",
+ "label": "Humidity "
+ }
+ ]
+ },
+ "refresh": true,
+ "actions": [
+ {
+ "command": "Set_HumidifierGears",
+ "parameterType": "NUMBER"
+ }
+ ]
+ },
+ {
+ "property": "Humidity_Value",
+ "friendlyName": "Humidity",
+ "channel": "humidity",
+ "type": "Number:Dimensionless",
+ "unit": "PERCENT",
+ "stateDescription": {
+ "minimum": 0,
+ "maximum": 100,
+ "step": 1,
+ "pattern": "%.0f %unit%",
+ "readOnly": true
+ },
+ "refresh": true,
+ "actions": [],
+ "category": "humidity",
+ "tags": [
+ "Measurement",
+ "Humidity"
+ ]
+ },
+ {
+ "property": "HumiSet_Value",
+ "friendlyName": "Humidity Setting",
+ "channel": "humidity_set",
+ "type": "Number:Dimensionless",
+ "unit": "PERCENT",
+ "stateDescription": {
+ "minimum": 0,
+ "maximum": 100,
+ "step": 1,
+ "pattern": "%.0f %unit%",
+ "readOnly": false
+ },
+ "refresh": true,
+ "actions": [
+ {
+ "command": "Set_HumiValue",
+ "parameterType": "NUMBER"
+ }
+ ],
+ "category": "humidity",
+ "tags": [
+ "SetPoint",
+ "Humidity"
+ ]
+ },
+ {
+ "property": "Led_State",
+ "friendlyName": "LED indicator Light",
+ "channel": "led",
+ "type": "Switch",
+ "refresh": true,
+ "actions": [
+ {
+ "command": "SetLedState",
+ "parameterType": "ONOFFNUMBER"
+ }
+ ]
+ },
+ {
+ "property": "TipSound_State",
+ "friendlyName": "Notification Sounds",
+ "channel": "sound",
+ "type": "Switch",
+ "refresh": true,
+ "actions": [
+ {
+ "command": "SetTipSound_Status",
+ "parameterType": "ONOFFNUMBER"
+ }
+ ]
+ },
+ {
+ "property": "watertankstatus",
+ "friendlyName": "Watertank Status",
+ "channel": "watertankstatus",
+ "type": "Number",
+ "stateDescription": {
+ "pattern": "%.0f",
+ "readOnly": true
+ },
+ "refresh": true,
+ "actions": []
+ },
+ {
+ "property": "wet_and_protect",
+ "friendlyName": "Wet and Protect",
+ "channel": "wet_and_protect",
+ "type": "Switch",
+ "refresh": true,
+ "actions": [
+ {
+ "command": "Set_wet_and_protect",
+ "parameterType": "ONOFFNUMBER"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.mjjsq.json b/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.mjjsq.json
new file mode 100644
index 000000000..d3ce6308f
--- /dev/null
+++ b/bundles/org.openhab.binding.miio/src/main/resources/database/deerma.humidifier.mjjsq.json
@@ -0,0 +1,146 @@
+{
+ "deviceMapping": {
+ "id": [
+ "deerma.humidifier.mjjsq",
+ "deerma.humidifier.jsq"
+ ],
+ "maxProperties": 1,
+ "channels": [
+ {
+ "property": "OnOff_State",
+ "friendlyName": "Power",
+ "channel": "power",
+ "type": "Switch",
+ "refresh": true,
+ "actions": [
+ {
+ "command": "Set_OnOff",
+ "parameterType": "ONOFFNUMBER"
+ }
+ ],
+ "category": "switch",
+ "tags": [
+ "Switch"
+ ]
+ },
+ {
+ "property": "Humidifier_Gear",
+ "friendlyName": "Mode",
+ "channel": "mode",
+ "type": "Number",
+ "stateDescription": {
+ "options": [
+ {
+ "value": "1",
+ "label": "Low"
+ },
+ {
+ "value": "2",
+ "label": "Medium"
+ },
+ {
+ "value": "3",
+ "label": "High"
+ },
+ {
+ "value": "4",
+ "label": "Humidity "
+ }
+ ]
+ },
+ "refresh": true,
+ "actions": [
+ {
+ "command": "Set_HumidifierGears",
+ "parameterType": "NUMBER"
+ }
+ ]
+ },
+ {
+ "property": "Humidity_Value",
+ "friendlyName": "Humidity",
+ "channel": "humidity",
+ "type": "Number:Dimensionless",
+ "unit": "PERCENT",
+ "stateDescription": {
+ "minimum": 0,
+ "maximum": 100,
+ "step": 1,
+ "pattern": "%.0f %unit%",
+ "readOnly": true
+ },
+ "refresh": true,
+ "actions": [],
+ "category": "humidity",
+ "tags": [
+ "Measurement",
+ "Humidity"
+ ]
+ },
+ {
+ "property": "HumiSet_Value",
+ "friendlyName": "Humidity Setting",
+ "channel": "humidity_set",
+ "type": "Number:Dimensionless",
+ "unit": "PERCENT",
+ "stateDescription": {
+ "minimum": 0,
+ "maximum": 100,
+ "step": 1,
+ "pattern": "%.0f %unit%",
+ "readOnly": false
+ },
+ "refresh": true,
+ "actions": [
+ {
+ "command": "Set_HumiValue",
+ "parameterType": "NUMBER"
+ }
+ ],
+ "category": "humidity",
+ "tags": [
+ "SetPoint",
+ "Humidity"
+ ]
+ },
+ {
+ "property": "Led_State",
+ "friendlyName": "LED indicator Light",
+ "channel": "led",
+ "type": "Switch",
+ "refresh": true,
+ "actions": [
+ {
+ "command": "SetLedState",
+ "parameterType": "ONOFFNUMBER"
+ }
+ ]
+ },
+ {
+ "property": "TipSound_State",
+ "friendlyName": "Notification Sounds",
+ "channel": "sound",
+ "type": "Switch",
+ "refresh": true,
+ "actions": [
+ {
+ "command": "SetTipSound_Status",
+ "parameterType": "ONOFFNUMBER"
+ }
+ ]
+ },
+ {
+ "property": "watertankstatus",
+ "friendlyName": "Watertank Status",
+ "channel": "watertankstatus",
+ "type": "Number",
+ "stateDescription": {
+ "pattern": "%.0f",
+ "readOnly": true
+ },
+ "refresh": true,
+ "actions": []
+ }
+ ]
+ }
+}