[miio] add support for deerma Humidifier (#10181)
* [miio] deerma Humidifier Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -27,6 +27,7 @@ public enum CommandParameterType {
|
||||
ONOFFPARA("onoffpara"),
|
||||
ONOFFBOOL("onoffbool"),
|
||||
ONOFFBOOLSTRING("onoffboolstring"),
|
||||
ONOFFNUMBER("onoffnumber"),
|
||||
STRING("string"),
|
||||
CUSTOMSTRING("customstring"),
|
||||
NUMBER("number"),
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user