[miio] add support for Xiaomi Smart Plug 2 cuco.plug.v2eur (#16381)

* [miio] add support for Xiaomi Smart Plug 2 cuco.plug.v2eur

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
Marcel 2024-04-17 10:35:40 +02:00 committed by Ciprian Pascu
parent b44187c6bc
commit 455d1583c6
5 changed files with 5370 additions and 4931 deletions

File diff suppressed because it is too large Load Diff

View File

@ -49,6 +49,7 @@ 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),
CUCO_PLUG_V2EUR("cuco.plug.v2eur", "Xiaomi Smart Plug 2 (Wi-Fi)", 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),

View File

@ -26,6 +26,7 @@ thing.chunmi.cooker.normal4 = Mi IH Rice Cooker 4L
thing.chunmi.cooker.press1 = Mi IH Pressure Rice Cooker
thing.chunmi.cooker.press2 = Mi IH Pressure Rice Cooker
thing.cuco.plug.cp1 = Gosund Smart Plug
thing.cuco.plug.v2eur = Xiaomi Smart Plug 2 (Wi-Fi)
thing.deerma.humidifier.jsq = Mi Smart Antibacterial Humidifier
thing.deerma.humidifier.jsq1 = Mi S Smart Humidifer
thing.deerma.humidifier.jsq2w = Xiaomi Smart Humidifier 2
@ -496,6 +497,24 @@ ch.cuco.plug.cp1-miot.Manufacturer = Device Information-Device Manufacturer
ch.cuco.plug.cp1-miot.Model = Device Information-Device Model
ch.cuco.plug.cp1-miot.On = Switch-Switch Status
ch.cuco.plug.cp1-miot.SerialNumber = Device Information-Device Serial Number
ch.cuco.plug.v2eur-miot.actions = Actions
ch.cuco.plug.v2eur-miot.data_value = Cycle - Data Value
ch.cuco.plug.v2eur-miot.default_power_on_state = Switch - Default Power On State
ch.cuco.plug.v2eur-miot.delay = Delay - Delay
ch.cuco.plug.v2eur-miot.delay_remain_time = Delay - Delay Remain Time
ch.cuco.plug.v2eur-miot.delay_time = Delay - Delay Time
ch.cuco.plug.v2eur-miot.electric_power = Power Consumption - Electric Power
ch.cuco.plug.v2eur-miot.fault = Switch - Device Fault
ch.cuco.plug.v2eur-miot.on = Switch - Switch Status
ch.cuco.plug.v2eur-miot.on1 = Indicator Light - Switch Status
ch.cuco.plug.v2eur-miot.on2 = Charging Protection - On
ch.cuco.plug.v2eur-miot.on3 = Max Power Limit - On
ch.cuco.plug.v2eur-miot.physical_controls_locked = Physical Control Locked - Physical Control Locked
ch.cuco.plug.v2eur-miot.power = Charging Protection - Power
ch.cuco.plug.v2eur-miot.power1 = Max Power Limit - Power
ch.cuco.plug.v2eur-miot.power_consumption = Power Consumption - Power Consumption
ch.cuco.plug.v2eur-miot.protect_time = Charging Protection - Protect Time
ch.cuco.plug.v2eur-miot.status = Cycle - Status
ch.deerma.humidifier.jsq1.humidity = Humidity
ch.deerma.humidifier.jsq1.humidity_set = Humidity Setting
ch.deerma.humidifier.jsq1.led = LED indicator Light
@ -2383,6 +2402,10 @@ option.cgllc.airm.cgdn1-miot.screen_off-300 = Second
option.cgllc.airm.cgdn1-miot.screen_off-60 = Second
option.chuangmi.plug.212a01-miot.bt-gw-disable = Disable
option.chuangmi.plug.212a01-miot.bt-gw-enable = Enable
option.cuco.plug.v2eur-miot.actions-switch-toggle = Switch Toggle
option.cuco.plug.v2eur-miot.fault-0 = No Faults
option.cuco.plug.v2eur-miot.fault-1 = Over Temperature
option.cuco.plug.v2eur-miot.fault-2 = Overload
option.deerma.humidifier.jsq1.mode-1 = Low
option.deerma.humidifier.jsq1.mode-2 = Medium
option.deerma.humidifier.jsq1.mode-3 = High

View File

@ -0,0 +1,365 @@
{
"deviceMapping": {
"id": [
"cuco.plug.v2eur"
],
"propertyMethod": "get_properties",
"maxProperties": 1,
"channels": [
{
"property": "",
"friendlyName": "Actions",
"channel": "actions",
"type": "String",
"stateDescription": {
"options": [
{
"value": "switch-toggle",
"label": "Switch Toggle"
}
]
},
"refresh": false,
"actions": [
{
"command": "action",
"parameterType": "EMPTY",
"siid": 2,
"aiid": 1,
"condition": {
"name": "matchValue",
"parameters": [
{
"matchValue": "switch-toggle"
}
]
}
}
],
"readmeComment": "Value mapping `[\"switch-toggle\"\u003d\"Switch Toggle\"]`"
},
{
"property": "on",
"siid": 2,
"piid": 1,
"friendlyName": "Switch - Switch Status",
"channel": "on",
"type": "Switch",
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "ONOFFBOOL"
}
],
"category": "switch",
"tags": [
"Switch"
]
},
{
"property": "default-power-on-state",
"siid": 2,
"piid": 2,
"friendlyName": "Switch - Default Power On State",
"channel": "default_power_on_state",
"type": "Number",
"stateDescription": {
"minimum": 0,
"maximum": 2,
"step": 1,
"pattern": "%.0f"
},
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "NUMBER"
}
]
},
{
"property": "fault",
"siid": 2,
"piid": 3,
"friendlyName": "Switch - Device Fault",
"channel": "fault",
"type": "Number",
"stateDescription": {
"readOnly": true,
"options": [
{
"value": "0",
"label": "No Faults"
},
{
"value": "1",
"label": "Over Temperature"
},
{
"value": "2",
"label": "Overload"
}
]
},
"refresh": true,
"actions": [],
"readmeComment": "Value mapping `[\"0\"\u003d\"No Faults\",\"1\"\u003d\"Over Temperature\",\"2\"\u003d\"Overload\"]`"
},
{
"property": "physical-controls-locked",
"siid": 7,
"piid": 1,
"friendlyName": "Physical Control Locked - Physical Control Locked",
"channel": "physical_controls_locked",
"type": "Switch",
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "ONOFFBOOL"
}
]
},
{
"property": "power-consumption",
"siid": 11,
"piid": 1,
"friendlyName": "Power Consumption - Power Consumption",
"channel": "power_consumption",
"type": "Number",
"stateDescription": {
"minimum": 0,
"maximum": 65535,
"step": 1,
"pattern": "%.0f",
"readOnly": true
},
"refresh": true,
"actions": []
},
{
"property": "electric-power",
"siid": 11,
"piid": 2,
"friendlyName": "Power Consumption - Electric Power",
"channel": "electric_power",
"type": "Number:Power",
"unit": "watt",
"stateDescription": {
"minimum": 0,
"maximum": 5000,
"step": 1,
"pattern": "%.0f %unit%",
"readOnly": true
},
"refresh": true,
"actions": []
},
{
"property": "on1",
"siid": 13,
"piid": 1,
"friendlyName": "Indicator Light - Switch Status",
"channel": "on1",
"type": "Switch",
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "ONOFFBOOL"
}
],
"category": "switch",
"tags": [
"Switch"
]
},
{
"property": "delay",
"siid": 14,
"piid": 1,
"friendlyName": "Delay - Delay",
"channel": "delay",
"type": "Switch",
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "ONOFFBOOL"
}
]
},
{
"property": "delay-time",
"siid": 14,
"piid": 2,
"friendlyName": "Delay - Delay Time",
"channel": "delay_time",
"type": "Number:Time",
"unit": "seconds",
"stateDescription": {
"minimum": 0,
"maximum": 86400,
"step": 1,
"pattern": "%.0f %unit%"
},
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "STRING"
}
]
},
{
"property": "delay-remain-time",
"siid": 14,
"piid": 3,
"friendlyName": "Delay - Delay Remain Time",
"channel": "delay_remain_time",
"type": "Number:Time",
"unit": "seconds",
"stateDescription": {
"minimum": 0,
"maximum": 86400,
"step": 1,
"pattern": "%.0f %unit%",
"readOnly": true
},
"refresh": true,
"actions": []
},
{
"property": "on2",
"siid": 4,
"piid": 1,
"friendlyName": "Charging Protection - On",
"channel": "on2",
"type": "Switch",
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "ONOFFBOOL"
}
],
"category": "switch",
"tags": [
"Switch"
]
},
{
"property": "power",
"siid": 4,
"piid": 2,
"friendlyName": "Charging Protection - Power",
"channel": "power",
"type": "Number",
"stateDescription": {
"minimum": 2,
"maximum": 1200,
"step": 1,
"pattern": "%.0f"
},
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "STRING"
}
]
},
{
"property": "protect-time",
"siid": 4,
"piid": 3,
"friendlyName": "Charging Protection - Protect Time",
"channel": "protect_time",
"type": "Number:Time",
"unit": "minutes",
"stateDescription": {
"minimum": 1,
"maximum": 300,
"step": 1,
"pattern": "%.0f %unit%"
},
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "STRING"
}
]
},
{
"property": "status",
"siid": 5,
"piid": 1,
"friendlyName": "Cycle - Status",
"channel": "status",
"type": "Switch",
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "ONOFFBOOL"
}
]
},
{
"property": "data-value",
"siid": 5,
"piid": 2,
"friendlyName": "Cycle - Data Value",
"channel": "data_value",
"type": "String",
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "STRING"
}
]
},
{
"property": "on3",
"siid": 9,
"piid": 1,
"friendlyName": "Max Power Limit - On",
"channel": "on3",
"type": "Switch",
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "ONOFFBOOL"
}
]
},
{
"property": "power1",
"siid": 9,
"piid": 2,
"friendlyName": "Max Power Limit - Power",
"channel": "power1",
"type": "Number:Power",
"unit": "watt",
"stateDescription": {
"minimum": 300,
"maximum": 3600,
"step": 100,
"pattern": "%.0f %unit%"
},
"refresh": true,
"actions": [
{
"command": "set_properties",
"parameterType": "STRING"
}
]
}
],
"experimental": false
}
}

View File

@ -186,16 +186,16 @@ public class ReadmeHelper {
sw.write("### " + device.getDescription() + " (" + "<a name=\"" + link + "\">" + device.getModel()
+ "</a>" + ") Channels\n" + "\n");
sw.write(
"| Channel | Type | Description | Comment |\n");
"| Channel | Type | Description | Comment |\n");
sw.write(
"|----------------------|----------------------|------------------------------------------|------------|\n");
"|----------------------------|----------------------|------------------------------------------|------------|\n");
for (MiIoBasicChannel ch : dev.getDevice().getChannels()) {
if (UPDATE_OPTION_MAPPING_README_COMMENTS
&& ch.getReadmeComment().startsWith("Value mapping")) {
ch.setReadmeComment(readmeOptionMapping(ch, device.getModel()));
}
sw.write("| " + minLengthString(ch.getChannel(), 20) + " | " + minLengthString(ch.getType(), 20)
sw.write("| " + minLengthString(ch.getChannel(), 26) + " | " + minLengthString(ch.getType(), 20)
+ " | " + minLengthString(ch.getFriendlyName(), 40) + " | "
+ minLengthString(ch.getReadmeComment(), 10) + " |\n");
}
@ -240,7 +240,7 @@ public class ReadmeHelper {
String gr = "G_" + id;
sw.write("note: Autogenerated example. Replace the id (" + id
+ ") in the channel with your own. Replace `basic` with `generic` in the thing UID depending on how your thing was discovered.\n");
sw.write("\n```\n");
sw.write("\n```java\n");
sw.write("Group " + gr + " \"" + device.getDescription() + "\" <status>\n");
for (MiIoBasicChannel ch : dev.getDevice().getChannels()) {