Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to call service xiaomi_miio/vacuum_clean_segment. Service not found. #356

Closed
r3pek opened this issue Jan 5, 2022 · 7 comments
Closed

Comments

@r3pek
Copy link

r3pek commented Jan 5, 2022

Using the xiaomi-vacuum-map-card lovelace card, and trying to do a "Room clean" I get that error message. Am I missing something on the configuration or is it something not yet supported?

@al-one
Copy link
Owner

al-one commented Jan 5, 2022

The vacuum integrated through this component does not support this card if it does not support custom services.

@r3pek
Copy link
Author

r3pek commented Jan 5, 2022

Think I got it.... (didn't try it yet) but it's explained here: PiotrMachowski/lovelace-xiaomi-vacuum-map-card#251

@al-one
Copy link
Owner

al-one commented Jan 5, 2022

@r3pek
Copy link
Author

r3pek commented Jan 5, 2022

What I can't understand is that params: values. Because they're supposed to be in respect to the start-sweep function (aiid 1), but I can't find anywhere the parameters it takes (the start-sweep function)

@al-one
Copy link
Owner

al-one commented Jan 6, 2022

This is the code in the react plugin of viomi.vacuum.v18, which may be useful to you:

[
    {
      key: "clean",
      value: function clean() {
        var _this2 = this;

        var operType = this.props.getOperType();
        var mode = Base.device.mode;
        var run_state = this.state.run_state;

        var isWorking = _Config.default.run_state.isWorking(run_state);

        var isWorkingOrPause = _Config.default.run_state.isWorkingOrPause(run_state);

        var method,
            params = [];
        var preCleanProps = null;

        if (!isWorkingOrPause) {
          if (Base.device.is_mop === _Config.default.is_mop.custom) {
            method = _Config.default.methods.setCustomClean;
            params = [];
          } else if (operType === _Config.default.operType.roomClean || operType === _Config.default.operType.allClean) {
            if (_Config.default.supportCleanTimes) {
              var cleantimes = this.props.dealCompMethod("extraBtns", 'getCleanTimes');
              preCleanProps = {
                cleantimes: cleantimes
              };
            }

            var ids = [];

            if (operType === _Config.default.operType.roomClean) {
              ids = this.props.dealCompMethod('mapContainer', 'dealMapMethod', 'getSelectedRoomIds');

              if (!ids) {
                return;
              }

              if (ids.length === 0) {
                return Base.toast(Base.lang.plzChooseLess1Room);
              }

              this.props.dealCompMethod("mapContainer", "unSelectAllRooms", ids);
            }

            method = _Config.default.methods.startModeWork;
            var cleanRoomMode;

            if (mode === _Config.default.mode.wall) {
              cleanRoomMode = 1;
            } else {
              cleanRoomMode = 0;
            }

            params = [cleanRoomMode, 1, ids.join(",")];
          } else {
            var isPointing = this.props.dealCompMethod("extraBtns", "getIsPointing");
            preCleanProps = {};

            if (_Config.default.supportCleanTimes) {
              preCleanProps.cleantimes = this.props.dealCompMethod("extraBtns", 'getCleanTimes');
            }

            if (isPointing) {
              var pointData = this.props.dealCompMethod("mapContainer", 'getPointData');

              if (!pointData) {
                return Base.toast(Base.lang.plzSetPoint);
              }

              preCleanProps['target-point'] = pointData.x + "," + pointData.y;
              Base.log("设置定点清扫中心点坐标", pointData);
              method = _Config.default.methods.startPointClean;
            } else {
              var zoneData = this.props.dealCompMethod("mapContainer", 'getZoneData');

              if (!zoneData) {
                return Base.toast(Base.lang.zoneNotIn);
              }

              if (zoneData[0] === 0) {
                return Base.toast(Base.lang.plzSetZone);
              }

              var data = [];

              for (var i = 1; i < zoneData.length; i++) {
                var item = zoneData[i];
                var arr = item.split("_");
                data.push([arr[2], arr[3], arr[4], arr[5], arr[6], arr[7], arr[8], arr[9]].join(","));
              }

              if (_Config.default.supportMultipleZones) {
                preCleanProps['multiple-zone-points'] = JSON.stringify(data);
                Base.log(data);
              } else {
                preCleanProps['zone-points'] = data[0];
              }

              method = _Config.default.methods.startZoneClean;
            }

            this.props.dealCompMethod("mapContainer", 'clearZonePoint');
            this.props.dealCompMethod("extraBtns", 'resetZonePoint');
          }
        } else if (isWorking) {
          method = _Config.default.methods.pauseWork;
        } else {
          method = _Config.default.methods.startWork;
        }

        if (method) {
          if (preCleanProps) {
            this.props.loading(true);
            FetchUtil.setProps({
              props: preCleanProps,
              callback: function callback(result) {
                _this2.props.loading(false);

                if (result.status === FetchUtil.PropsStatus.success) {
                  _this2.doClean(method, params);
                } else {
                  Base.toast(Base.lang.setFail);
                  Base.log("set props fail", preCleanProps, result);

                  _this2.doClean(method, params);
                }
              }
            });
          } else {
            this.doClean(method, params);
          }
        }
      }
    }, {
      key: "doClean",
      value: function doClean(method, params) {
        var _this3 = this;

        Base.log(method, params);
        FetchUtil.doAction(method, params, function (result) {
          if (result.code === 0) {
            _this3.props.setSweptAreaTypeProp();
          } else {
            Base.toast(Base.lang.setFail);
            Base.log(method + ' error', result);

            _this3.props.resotreImmediately();
          }
        });
      }
    }
]

viomi.vacuum.v18.js.txt

@al-one al-one closed this as completed Mar 31, 2022
@basirmuhamedkulov
Copy link

What I can't understand is that params: values. Because they're supposed to be in respect to the start-sweep function (aiid 1), but I can't find anywhere the parameters it takes (the start-sweep function)

Hi. did you find soluton?

@FilipeOS
Copy link

FilipeOS commented Jan 1, 2024

I have the same issue when I try room cleaning or zone cleaning in roborock s5... Xiaomi Miot Auto and this Addon. Also status is always unknown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants