hass-xiaomi-miot
hass-xiaomi-miot copied to clipboard
vacuum robot imilab v1
Good evening, I have a robot vacuum imilab v1 I want to install https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Vacuum-Map-Camera found codes for imilab v1 https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:vacuum:0000A006:chuangmi-hmi707:1 https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:vacuum:0000A006:chuangmi-hmi707:2 https://home.miot-spec.com/s/chuangmi.vacuum.hmi707 please help i dont understand it
Any question ?
@al-one clarification below:
@arsenal3008 wants to know how to start room/zone cleaning with chuangmi.vacuum.hmi707
vacuum using Home Assistant service call
@al-one clarification below:
@arsenal3008 wants to know how to start room/zone cleaning with
chuangmi.vacuum.hmi707
vacuum using Home Assistant service call
everything works zones and points do not work
When you succeed you can send service call data here and I will help with card setup.
https://home.miot-spec.com/spec/chuangmi.vacuum.hmi707
MiHome plugin: chuangmi.vacuum.hmi707.js
function getStartCleanParams() {
switch (_this8.state.mapType) {
case _RMConstant.RMConstant.mapType.zone:
{
var areaInfo = _this8.mainmapRef._getArea();
if (!areaInfo || areaInfo.length === 0) {
_this8.showToast(_LocalizedStrings.LS.go_no_select_id);
return null;
}
_this8.mainmapRef._clearAddZoneArr();
return [_RMConstant.RMConstant.sweep_mode.area, areaInfo];
}
case _RMConstant.RMConstant.mapType.full:
{
return [_RMConstant.RMConstant.sweep_mode.total, ""];
}
case _RMConstant.RMConstant.mapType.spec_area:
{
var _areaInfo = _this8.mainmapRef._getZone();
if (!_areaInfo || _areaInfo.length === 0) {
_this8.showToast(_LocalizedStrings.LS.go_no_tmp_area);
return null;
}
_this8.mainmapRef._clearAddZoneArr();
return [_RMConstant.RMConstant.sweep_mode.area, _areaInfo];
}
case _RMConstant.RMConstant.mapType.spec_point:
{
var _areaInfo2 = _this8.mainmapRef._getSpot();
if (!_areaInfo2 || _areaInfo2.length === 0) {
_this8.showToast(_LocalizedStrings.LS.go_no_tmp_area);
return null;
}
_this8.mainmapRef._clearAddZoneArr();
return [_RMConstant.RMConstant.sweep_mode.point, _areaInfo2];
}
}
};
_getZoneData = function () {
var mapConfig = _this.mapData.mapConfig;
var height = mapConfig.height,
resolution = mapConfig.resolution,
xMin = mapConfig.xMin,
yMin = mapConfig.yMin,
mapId = mapConfig.mapId;
var ratio = _this.state.ratio;
var areaInfo = {};
areaInfo.MapId = mapId;
areaInfo.ExtraAreas = [];
if (_this.zoneRefArr.length > 0) {
for (var i = 0; i < _this.zoneRefArr.length; i++) {
var value = _this.zoneRefArr[i].returnXY();
var extraData = {};
var leftTop = _MapUtils.default.screenToDevice(value[0][0], value[0][1], height, xMin, yMin, resolution, ratio);
var rightTop = _MapUtils.default.screenToDevice(value[1][0], value[1][1], height, xMin, yMin, resolution, ratio);
var leftBottom = _MapUtils.default.screenToDevice(value[2][0], value[2][1], height, xMin, yMin, resolution, ratio);
var rightBottom = _MapUtils.default.screenToDevice(value[3][0], value[3][1], height, xMin, yMin, resolution, ratio);
var zoneArray = [[leftTop.x, leftTop.y], [rightTop.x, rightTop.y], [rightBottom.x, rightBottom.y], [leftBottom.x, leftBottom.y]];
extraData.name = '划区';
extraData.id = 300;
extraData.tag = '4';
extraData.vertexs = zoneArray;
extraData.active = 'normal';
extraData.mode = 'area';
areaInfo.ExtraAreas.push(extraData);
}
return JSON.stringify(areaInfo);
}
return '{}';
};
_getSpotPosition = function () {
var mapConfig = _this.mapData.mapConfig;
var height = mapConfig.height,
resolution = mapConfig.resolution,
xMin = mapConfig.xMin,
yMin = mapConfig.yMin,
mapId = mapConfig.mapId;
var _this$state$ratio2 = _this.state.ratio,
ratio = _this$state$ratio2 === undefined ? 1 : _this$state$ratio2;
var areaInfo = {};
if (_this._spot) {
var value = _this._spot.returnSpotXY();
var pageX = value[0];
var pageY = value[1];
var zoneWidth = value[2];
var zoneHeight = value[3];
var lt = _MapUtils.default.screenToDevice(pageX, pageY, height, xMin, yMin, resolution, ratio);
var rt = _MapUtils.default.screenToDevice(pageX + zoneWidth, pageY, height, xMin, yMin, resolution, ratio);
var lb = _MapUtils.default.screenToDevice(pageX, pageY + zoneHeight, height, xMin, yMin, resolution, ratio);
var rb = _MapUtils.default.screenToDevice(pageX + zoneWidth, pageY + zoneHeight, height, xMin, yMin, resolution, ratio);
var zoneArray = [[lt.x, lt.y], [rt.x, rt.y], [rb.x, rb.y], [lb.x, lb.y]];
areaInfo.MapId = mapId;
areaInfo.ExtraAreas = {};
areaInfo.ExtraAreas.name = '定点';
areaInfo.ExtraAreas.id = 301;
areaInfo.ExtraAreas.tag = '5';
areaInfo.ExtraAreas.vertexs = zoneArray;
areaInfo.ExtraAreas.active = 'normal';
areaInfo.ExtraAreas.mode = 'point';
var data = JSON.stringify(areaInfo);
return data;
}
return '{}';
};
The best way to get command parameters is through MiHome APP modified by vevs, please refer to: https://github.com/al-one/hass-xiaomi-miot/issues/114#issuecomment-868721912