Open nichipedia opened 1 year ago
OK, it's on the plan now, please provide the device info json and it will help me better adapt your device, thanks.
{
path = /v1.0/devices/eb92c252e09f23544a9zlj/specifications
data = {
"result": {
"category": "sd",
"functions": [
{
"code": "switch_go",
"type": "Boolean",
"values": "{}"
},
{
"code": "mode",
"type": "Enum",
"values": "{\"range\":[\"standby\",\"spiral\",\"wall_follow\",\"random\",\"chargego\",\"partial_bow\"]}"
},
{
"code": "direction_control",
"type": "Enum",
"values": "{\"range\":[\"forward\",\"backward\",\"turn_left\",\"turn_right\",\"stop\"]}"
},
{
"code": "suction",
"type": "Enum",
"values": "{\"range\":[\"gentle\",\"normal\",\"strong\"]}"
},
{
"code": "water_control",
"type": "Enum",
"values": "{\"range\":[\"closed\",\"low\",\"high\"]}"
}
],
"status": [
{
"code": "switch_go",
"type": "Boolean",
"values": "{}"
},
{
"code": "mode",
"type": "Enum",
"values": "{\"range\":[\"standby\",\"spiral\",\"wall_follow\",\"random\",\"chargego\",\"partial_bow\"]}"
},
{
"code": "direction_control",
"type": "Enum",
"values": "{\"range\":[\"forward\",\"backward\",\"turn_left\",\"turn_right\",\"stop\"]}"
},
{
"code": "status",
"type": "Enum",
"values": "{\"range\":[\"standby\",\"smart_clean\",\"wall_clean\",\"spot_clean\",\"room_clean\",\"goto_charge\",\"charging\",\"charge_done\",\"cleaning\",\"sleep\",\"in_trouble\"]}"
},
{
"code": "residual_electricity",
"type": "Integer",
"values": "{\"unit\":\"%\",\"min\":0,\"max\":100,\"scale\":0,\"step\":1}"
},
{
"code": "suction",
"type": "Enum",
"values": "{\"range\":[\"gentle\",\"normal\",\"strong\"]}"
},
{
"code": "clean_time",
"type": "Integer",
"values": "{\"unit\":\"min\",\"min\":0,\"max\":9999,\"scale\":0,\"step\":1}"
},
{
"code": "fault",
"type": "Bitmap",
"values": "{\"label\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\"],\"maxlen\":15}"
},
{
"code": "water_control",
"type": "Enum",
"values": "{\"range\":[\"closed\",\"low\",\"high\"]}"
},
{
"code": "log_unseen",
"type": "String",
"values": "{\"maxlen\":255}"
},
{
"code": "fan_tank_unseen",
"type": "Enum",
"values": "{\"range\":[\"fan_in\",\"fan_tank_in\",\"fan_tank_none\"]}"
}
]
},
"success": true,
"t": 1672196138711,
"tid": "1bafa0e0865b11ed8bf3266109e39bbb"
}
Here is the JSON from the debug console. I really like the work yall are doing for this plugin. Works great! If I get some time I may pull and try my hand at implementing! 🤪
Welcome! However the homekit has many limitations, enum is one thing it don't have a good way to support. boolean has switches, integer has sliders(brightness, fanspeed, ...), but enum don't. maybe I have to create x switches for a enum which have x value.
I have done ZERO work with type script, and have only spent a small amount of time overviewing the the code base. Could you just create a class that just persists an immutable set of Strings? Here's some "pseudo code" of how I could do it in Java...
public class TestValues {
public static final String ENUM1 = "value1";
public static final String ENUM2 = "value2";
....
public static final Collection stuff = [key1, key2]
}
}
....
stuff.stream().foreach(//print each ENUM)
Effectively, thats all an enumeration is right? At least, the enum type in java.
I'm not familar with typescript too, this is just my second typescript project. study some basic synatax online and that's enough to write logics for me.
Currently vacuum accessories are not supported by this plugin or the official plugin.
It will be nice to automate my vacuum from the Home App scenes!