Xiaomi Vacuum Control

Strange, can’t remember that I had to do anything special to get the map working.
Basically just created the default items for all (including advanced) from “Add items from thing” and it worked.

Have you any log output hinting an error?

This widget looks great. I very much would like to use it.
However when I copied the code and tried to save it, it produces a server error and is not possible to save. I suspect a typo when it was merged for the last time.

I am able to copy and save other widgets without a problem.

Does anyone else face the same problem?

Hi, I’ve the same issue with getting displayed the cleaning map in OH3.1. The _celaningMap item is created as type of image and it’s value alway is NULL and no image is displayed.

No errors in the log file. In DEBUG mode the rrmap files were saved in /var/lib/openhab/miio and there were no problems with the communication to the cloud. All other data are displayed correctly in the items.

Did you get your map working, yet?

That would indeed be odd, I’m not aware of specific issues for the maps in 3.1.
Esp if you have rrmap files created and no errors.

Are you 100% sure it is linked to a channel?

If indeed that is the case, share a debug log… maybe I can detect something odd that would be causing this. Another thought could be to download the offline map viewer, and see if that one shows something with the rrmap files

Yes, 100 % sure it is linked to a channel. The screen snipped shows the grey image and the channel which is the item linked to.

I also downloaded the offline map viewer and can see there my map loading a rrmap file which was created in DEBUG-Mode before.

It seems to me like the item not getting updated with the map image. All other items of the vaccum getting updated periodically.

Here a log snippet for a Periodic update process for the values of the roborock.

2021-11-24 15:15:54.445 [DEBUG] [o.internal.handler.MiIoVacuumHandler] - Periodic update for 'miio:generic:0F92FFDD' (miio:vacuum)

2021-11-24 15:15:54.447 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":1470,"method":"get_dnd_timer","params":[]} -> 192.168.178.31 (Device: 0F92FFDD token: 70723077XXXXXXXXXXXXXXXX5339696D Queue: 1). Send via cloudserver: de

2021-11-24 15:15:54.450 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":1471,"method":"get_clean_summary","params":[]} -> 192.168.178.31 (Device: 0F92FFDD token: 70723077XXXXXXXXXXXXXXXX5339696D Queue: 2). Send via cloudserver: de

2021-11-24 15:15:54.452 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":1472,"method":"get_status","params":[]} -> 192.168.178.31 (Device: 0F92FFDD token: 70723077XXXXXXXXXXXXXXXX5339696D Queue: 3). Send via cloudserver: de

2021-11-24 15:15:54.454 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":1473,"method":"miIO.info","params":[]} -> 192.168.178.31 (Device: 0F92FFDD token: 70723077XXXXXXXXXXXXXXXX5339696D Queue: 4). Send via cloudserver: de

2021-11-24 15:15:54.456 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":1474,"method":"get_consumable","params":[]} -> 192.168.178.31 (Device: 0F92FFDD token: 70723077XXXXXXXXXXXXXXXX5339696D Queue: 5). Send via cloudserver: de

2021-11-24 15:15:54.459 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":1475,"method":"get_map_v1","params":[]} -> 192.168.178.31 (Device: 0F92FFDD token: 70723077XXXXXXXXXXXXXXXX5339696D Queue: 6). Send via cloudserver: de

2021-11-24 15:15:54.524 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":1470,"method":"get_dnd_timer","params":[]} to https://de.api.io.mi.com/app/home/rpc/261291997

2021-11-24 15:15:54.605 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/261291997. Response: {"code":0,"exe_time":1,"id":1470,"otlocalts":1637763354586553,"result":[{"enabled":1,"end_hour":8,"end_minute":0,"start_hour":22,"start_minute":0}]}

2021-11-24 15:15:54.607 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":1,"id":1470,"otlocalts":1637763354586553,"result":[{"enabled":1,"end_hour":8,"end_minute":0,"start_hour":22,"start_minute":0}]}

2021-11-24 15:15:54.609 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":1470,"method":"get_dnd_timer","params":[]} send via cloudserver de

2021-11-24 15:15:54.611 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0F92FFDD type: DND_GET, result: [{"enabled":1,"end_hour":8,"end_minute":0,"start_hour":22,"start_minute":0}], fullresponse: {"code":0,"exe_time":1,"id":1470,"otlocalts":1637763354586553,"result":[{"enabled":1,"end_hour":8,"end_minute":0,"start_hour":22,"start_minute":0}]}

2021-11-24 15:15:54.614 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":1471,"method":"get_clean_summary","params":[]} to https://de.api.io.mi.com/app/home/rpc/261291997

2021-11-24 15:15:54.698 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/261291997. Response: {"code":0,"exe_time":2,"id":1471,"otlocalts":1637763354678727,"result":[204315,3296485000,116,[1637749202,1637610570,1637500520,1637223256,1636557125,1636546706,1636191730,1634727567,1632386141,1631019495,1630673264,1629957677,1627904506,1627744168,1627476064,1627108163,1626077677,1624960997,1624089186,1623762650]]}

2021-11-24 15:15:54.699 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":2,"id":1471,"otlocalts":1637763354678727,"result":[204315,3296485000,116,[1637749202,1637610570,1637500520,1637223256,1636557125,1636546706,1636191730,1634727567,1632386141,1631019495,1630673264,1629957677,1627904506,1627744168,1627476064,1627108163,1626077677,1624960997,1624089186,1623762650]]}

2021-11-24 15:15:54.701 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":1471,"method":"get_clean_summary","params":[]} send via cloudserver de

2021-11-24 15:15:54.704 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0F92FFDD type: CLEAN_SUMMARY_GET, result: [204315,3296485000,116,[1637749202,1637610570,1637500520,1637223256,1636557125,1636546706,1636191730,1634727567,1632386141,1631019495,1630673264,1629957677,1627904506,1627744168,1627476064,1627108163,1626077677,1624960997,1624089186,1623762650]], fullresponse: {"code":0,"exe_time":2,"id":1471,"otlocalts":1637763354678727,"result":[204315,3296485000,116,[1637749202,1637610570,1637500520,1637223256,1636557125,1636546706,1636191730,1634727567,1632386141,1631019495,1630673264,1629957677,1627904506,1627744168,1627476064,1627108163,1626077677,1624960997,1624089186,1623762650]]}

2021-11-24 15:15:54.707 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":1472,"method":"get_status","params":[]} to https://de.api.io.mi.com/app/home/rpc/261291997

2021-11-24 15:15:54.788 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/261291997. Response: {"code":0,"exe_time":1,"id":1472,"otlocalts":1637763354769739,"result":[{"battery":100,"clean_area":892500,"clean_time":37,"dnd_enabled":0,"error_code":0,"fan_power":102,"in_cleaning":1,"in_fresh_state":0,"in_returning":0,"lab_status":1,"lock_status":0,"map_present":1,"map_status":3,"msg_seq":891,"msg_ver":3,"state":5,"water_box_status":0}]}

2021-11-24 15:15:54.790 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":1,"id":1472,"otlocalts":1637763354769739,"result":[{"battery":100,"clean_area":892500,"clean_time":37,"dnd_enabled":0,"error_code":0,"fan_power":102,"in_cleaning":1,"in_fresh_state":0,"in_returning":0,"lab_status":1,"lock_status":0,"map_present":1,"map_status":3,"msg_seq":891,"msg_ver":3,"state":5,"water_box_status":0}]}

2021-11-24 15:15:54.792 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":1472,"method":"get_status","params":[]} send via cloudserver de

2021-11-24 15:15:54.795 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0F92FFDD type: GET_STATUS, result: [{"battery":100,"clean_area":892500,"clean_time":37,"dnd_enabled":0,"error_code":0,"fan_power":102,"in_cleaning":1,"in_fresh_state":0,"in_returning":0,"lab_status":1,"lock_status":0,"map_present":1,"map_status":3,"msg_seq":891,"msg_ver":3,"state":5,"water_box_status":0}], fullresponse: {"code":0,"exe_time":1,"id":1472,"otlocalts":1637763354769739,"result":[{"battery":100,"clean_area":892500,"clean_time":37,"dnd_enabled":0,"error_code":0,"fan_power":102,"in_cleaning":1,"in_fresh_state":0,"in_returning":0,"lab_status":1,"lock_status":0,"map_present":1,"map_status":3,"msg_seq":891,"msg_ver":3,"state":5,"water_box_status":0}]}

2021-11-24 15:15:54.805 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":1473,"method":"miIO.info","params":[]} to https://de.api.io.mi.com/app/home/rpc/261291997

2021-11-24 15:15:54.886 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/261291997. Response: {"code":0,"id":1473,"message":"ok","otlocalts":1637763354867319,"partner_id":"","result":{"ap":{"bssid":"3C:92:AB:6A:D3:6C","rssi":-41,"ssid":"HomeWLAN"},"fw_ver":"3.5.8_002034","hw_ver":"Linux","life":15863,"mac":"50:EC:50:12:44:B6","miio_ver":"miio-client 3.5.8","model":"roborock.vacuum.s5","netif":{"gw":"192.168.178.1","localIp":"192.168.178.31","mask":"255.255.255.0"},"token":"70723077XXXXXXXXXXXXXXXX5339696D"}}

2021-11-24 15:15:54.888 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"id":1473,"message":"ok","otlocalts":1637763354867319,"partner_id":"","result":{"ap":{"bssid":"3C:92:AB:6A:D3:6C","rssi":-41,"ssid":"HomeWLAN"},"fw_ver":"3.5.8_002034","hw_ver":"Linux","life":15863,"mac":"50:EC:50:12:44:B6","miio_ver":"miio-client 3.5.8","model":"roborock.vacuum.s5","netif":{"gw":"192.168.178.1","localIp":"192.168.178.31","mask":"255.255.255.0"},"token":"70723077XXXXXXXXXXXXXXXX5339696D"}}

2021-11-24 15:15:54.890 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":1473,"method":"miIO.info","params":[]} send via cloudserver de

2021-11-24 15:15:54.893 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0F92FFDD type: MIIO_INFO, result: {"ap":{"bssid":"3C:92:AB:6A:D3:6C","rssi":-41,"ssid":"HomeWLAN"},"fw_ver":"3.5.8_002034","hw_ver":"Linux","life":15863,"mac":"50:EC:50:12:44:B6","miio_ver":"miio-client 3.5.8","model":"roborock.vacuum.s5","netif":{"gw":"192.168.178.1","localIp":"192.168.178.31","mask":"255.255.255.0"},"token":"70723077XXXXXXXXXXXXXXXX5339696D"}, fullresponse: {"code":0,"id":1473,"message":"ok","otlocalts":1637763354867319,"partner_id":"","result":{"ap":{"bssid":"3C:92:AB:6A:D3:6C","rssi":-41,"ssid":"HomeWLAN"},"fw_ver":"3.5.8_002034","hw_ver":"Linux","life":15863,"mac":"50:EC:50:12:44:B6","miio_ver":"miio-client 3.5.8","model":"roborock.vacuum.s5","netif":{"gw":"192.168.178.1","localIp":"192.168.178.31","mask":"255.255.255.0"},"token":"70723077XXXXXXXXXXXXXXXX5339696D"}}

2021-11-24 15:15:54.896 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":1474,"method":"get_consumable","params":[]} to https://de.api.io.mi.com/app/home/rpc/261291997

2021-11-24 15:15:54.978 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/261291997. Response: {"code":0,"exe_time":2,"id":1474,"otlocalts":1637763354959754,"result":[{"filter_element_work_time":0,"filter_work_time":25009,"main_brush_work_time":205220,"sensor_dirty_time":3875,"side_brush_work_time":205220}]}

2021-11-24 15:15:54.980 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":2,"id":1474,"otlocalts":1637763354959754,"result":[{"filter_element_work_time":0,"filter_work_time":25009,"main_brush_work_time":205220,"sensor_dirty_time":3875,"side_brush_work_time":205220}]}

2021-11-24 15:15:54.982 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":1474,"method":"get_consumable","params":[]} send via cloudserver de

2021-11-24 15:15:54.985 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0F92FFDD type: CONSUMABLES_GET, result: [{"filter_element_work_time":0,"filter_work_time":25009,"main_brush_work_time":205220,"sensor_dirty_time":3875,"side_brush_work_time":205220}], fullresponse: {"code":0,"exe_time":2,"id":1474,"otlocalts":1637763354959754,"result":[{"filter_element_work_time":0,"filter_work_time":25009,"main_brush_work_time":205220,"sensor_dirty_time":3875,"side_brush_work_time":205220}]}

2021-11-24 15:15:54.992 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"id":1475,"method":"get_map_v1","params":[]} to https://de.api.io.mi.com/app/home/rpc/261291997

2021-11-24 15:15:55.074 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Request to de server /home/rpc/261291997. Response: {"code":0,"exe_time":1,"id":1475,"otlocalts":1637763355055787,"result":["robomap%2F261291997%2F15"]}

2021-11-24 15:15:55.076 [DEBUG] [miio.internal.cloud.MiCloudConnector] - response: {"code":0,"exe_time":1,"id":1475,"otlocalts":1637763355055787,"result":["robomap%2F261291997%2F15"]}

2021-11-24 15:15:55.078 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command {"id":1475,"method":"get_map_v1","params":[]} send via cloudserver de

2021-11-24 15:15:55.080 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for 0F92FFDD type: GET_MAP, result: ["robomap%2F261291997%2F15"], fullresponse: {"code":0,"exe_time":1,"id":1475,"otlocalts":1637763355055787,"result":["robomap%2F261291997%2F15"]}

2021-11-24 15:15:55.083 [DEBUG] [g.miio.internal.cloud.CloudConnector] - Getting vacuum map robomap%2F261291997%2F15 from Xiaomi cloud server: 'de'

2021-11-24 15:15:55.084 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Send request: {"obj_name":"robomap%2F261291997%2F15"} to https://de.api.io.mi.com/app/home/getmapfileurl

2021-11-24 15:15:55.127 [DEBUG] [miio.internal.cloud.MiCloudConnector] - Received  JSON message {"code":0,"message":"ok","result":{"url":"https://awsde0.fds.api.xiaomi.com/robomap/robomap/261291997/15?Expires=1637765155000&GalaxyAccessKeyId=5173733726437&Signature=X9AKjZl0Smt7Wdk3Gmf4lta4Lok=","obj_name":"robomap/261291997/15","method":"GET","expires_time":1637765155,"ok":true}}

2021-11-24 15:15:55.502 [DEBUG] [o.internal.handler.MiIoVacuumHandler] - Mapdata saved to /var/lib/openhab/miio/robomap%2F261291997%2F1520211124-151555.rrmap

2021-11-24 15:15:56.109 [DEBUG] [inding.miio.internal.robot.RRMapDraw] - Identified rooms in map: 16 17 1 18 19 20 21

After that all items except the cleaningMap item were updated:

2021-11-24 15:27:25.221 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_Batterieladung' updated to 100

2021-11-24 15:27:25.225 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_Status_Clean_Area' updated to 1.1

2021-11-24 15:27:25.229 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_CleaningTime' updated to 0

2021-11-24 15:27:25.231 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_ErrorCode' updated to No error

2021-11-24 15:27:25.234 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_FanPower' updated to 102

2021-11-24 15:27:25.236 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_ControlFanLevel' updated to 102

2021-11-24 15:27:25.239 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_State' updated to Charging

2021-11-24 15:27:25.241 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_ControlVacuum' updated to dock

2021-11-24 15:27:25.320 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_MainBrushRemaining' updated to 81

2021-11-24 15:27:25.324 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_SideBrushRemaining' updated to 71

2021-11-24 15:27:25.327 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_FilterUsageRemaining' updated to 96

2021-11-24 15:27:25.329 [INFO ] [openhab.event.ItemStateEvent        ] - Item 'Vacuum_Cleaner_Roberta_SensorDirtRemaining' updated to 96

Yes, indeed something is happening in the parser. So at least it gets to the processing stage as you have a line.
2021-11-24 15:15:56.109 [DEBUG] [inding.miio.internal.robot.RRMapDraw] - Identified rooms in map: 16 17 1 18 19 20 21

RRMapDraw is responsible for rendering the image. The only thing that comes to mind was an issue with the fonts, which was reported long time ago. (somehow java did not see any available fonts in a headless server).

To avoid the text, checkout this post Xiaomi Robot Vacuum Binding - #1895 by marcel_verpaalen mapConfig.json should contain an empty text like this { "text": ""}
You can also try the following { "text": "" , "cropBorder": -1 , "showLogo": false} as that avoids some nastry logic.

Note, your path of the file is somewhat unusual (it does not contain the usual userdata part), I think the mapConfig.json needs to be stored in the same folder

Unfortunately no changes in behaviour.

I tried to use { "text": ""} or { "text": "" , "cropBorder": -1 , "showLogo": false} or a blank file named mapConfig.json in the hope the binding will create a valid file out of it, only for testing, if this file is recognized from the binding. But the file leaves empty.

After editing the file mapConfig.json I restarted first the binding, than the openhab service and than editing some minor changes to the thing. Nothing changed in concern to the mapConfig.json file or the display issue of the map image.

I put the file mapConfig.json to this location /var/lib/openhab/miio. Here also the rrmap files and miio-Tokens.json files stored.

The log shows the same as before an ends with:
2021-11-24 18:26:36.226 [DEBUG] [inding.miio.internal.robot.RRMapDraw] - Identified rooms in map: 16 17 1 18 19 20 21

I use openhabianpi installtion of OH3.1 on an raspberry pi 3b.

Did you expect any more log messages after the last one with RRMapDraw? I see no java errors or other errors in the log concerning this issue. Maybe some general issue with image item in OH3.1?
I did not use the image item before, so don’t know if it is working in general.

Ah… yes, this mapoptions were only introduced with the 3.2 version indeed.

No, there are no log messages expected in RRMapDraw. I would indeed expect a big ugly unhandled error stacktrace in case of an error.

Only thing I can try is to compile a version with some more logging to dig deeper… but maybe try to load the 3.2 version first (I think you can use 3.2 bindings jars in oh3.1)

Hi i am trying this nice widget and i need some help. My Vacuum cleaner is an Mi Robot Vacuum-Mop P. i managed to setup the widget but i have problem with the room ids.
My robot use other command to sent it in rooms . for example the command is set_mode_withroom [0,1,1,10]
first didgit is to start the robot, the second is the mode the 3 how many rooms to clean and the 4 is the id of the rooms
so its mean if i sent this command “set_mode_withroom [0,1,2,10,11]” via executecommand channel the robot wiil start to clean with mode vaccum 2 rooms the 10 and 11 room.

the question is can someone to edit the command of the widget to sent also these parameters?? for example an extra variable to count how many buttons are clicked. i dont have Knowledges of java json.

Thanks
Nikos

As a starter for you, I modified the widget so far, that it builds up the correct command (as far as I can tell with static values for first and second digit.

Depending on the selections of the room, the command changes. (No room selected leads to an invalid command I guess.)

To show it, I’m using the button text to show the command. You can tell best if this works for you:
set_mode_withroom

uid: tetsuo-repo-oh3-widget-vacuum
version: 1.3.0
tags:
  - vacuum
  - room
  - map
  - control
props:
  parameters:
    - description: Prefix of item names. Look in your items for e.g. _CleaningMap and use everything before the underscore as prefix
      label: Item prefix
      name: itemPrefix
      required: true
      type: TEXT
    - description: 'json array with key value rooms like this [{"icon": "chat_bubble_2","roomId": 16,"label": "Roomname"}]'
      label: Rooms
      name: rooms
      required: true
      type: TEXT
    - description: Number of buttons for each row
      label: Chunk size
      name: chunkSize
      required: false
timestamp: Jun 3, 2021, 2:47:00 PM
component: f7-block
slots:
  default:
    - component: f7-row
      config: {}
      slots:
        default:
          - component: f7-block
            config:
              style:
                - width: 75%
                - margin: 0
                - padding: 0
            slots:
              default:
                - component: oh-image-card
                  config:
                    item: =props.itemPrefix+"_CleaningMap"
                    hidden: =items[props.itemPrefix+"_CleaningMap"] === undefined
                    style:
                      borderRadius: 2em
          - component: f7-block
            config:
              style:
                - width: 25%
                - margin: auto
                - padding: 0
            slots:
              default:
                - component: f7-gauge
                  config:
                    style:
                      - width: 100%
                      - height: 100%
                    value: =(items[props.itemPrefix+"_Batterieladung"].state/100)
                    valueText: =(items[props.itemPrefix+"_Batterieladung"].state) + "%"
                    valueTextColor: '=items[props.itemPrefix+"_Batterieladung"].state < 25 ? "#f32617" : items[props.itemPrefix+"_Batterieladung"].state < 60 ? "#ffe81e" : "#6ec071"'
                    borderWidth: 18
                    labelText: '=items[props.itemPrefix+"_ControlVacuum"].state !== "dock"? "Batterie" : "Wird aufgeladen"'
                    borderColor: '=items[props.itemPrefix+"_Batterieladung"].state < 25 ? "#f32617" : items[props.itemPrefix+"_Batterieladung"].state < 60 ? "#ffe81e" : "#6ec071"'
                - component: oh-trend
                  config:
                    trendItem: =props.itemPrefix+"_Batterieladung"
                    trendStrokeWidth: 2
                    trendGradient:
                      - "#6ec071"
                    style:
                      --f7-theme-color-bg-color: transparent
                      background: transparent
                      filter: opacity(20%)
                      width: 100%
                      height: 100%
                      top: 0
                      left: 0
                      z-index: 0
                - component: f7-card
                  slots:
                    default:
                      - component: f7-card-content
                        slots:
                          default:
                            - component: f7-card-header
                              slots:
                                default:
                                  - component: Label
                                    config:
                                      text: '=items[props.itemPrefix+"_ControlVacuum"].state === "vacuum" ? "Dauer" : "Letzte Dauer"'
                                      style:
                                        - fontWeight: 100
                                        - color: rgb(136, 136, 136)
                            - component: Label
                              config:
                                text: =items[props.itemPrefix+"_CleaningDuration"].state
                                style:
                                  height: 2.5em
                                  line-height: 2.5em
                                  text-align: center
                                  color: var(--f7-theme-color)
                                  font-weight: bold
                                  font-size: 2em
                            - component: f7-progressbar
                              config: 
                                visible: =items[props.itemPrefix+"_ControlVacuum"].state === "vacuum"
                                infinite: true
                                class: color-blue
    - component: f7-row
      config:
        visible: =items[props.itemPrefix+"_ControlVacuum"].state !== "vacuum"
      slots:
        default:
          - component: f7-col
            slots:
              default:
                - component: f7-card
                  slots:
                    default:
                      - component: f7-card-header
                        slots:
                          default:
                            - component: Label
                              config:
                                text: Aktionen
                                style:
                                  - fontWeight: 100
                                  - color: rgb(136, 136, 136)
                      - component: f7-card-content
                        slots:
                          default:
                            - component: oh-button
                              config:
                                style:
                                  height: 2.5em
                                  line-height: 2.5em
                                  font-size: 2em
                                text: =items[props.itemPrefix+"_ControlVacuum"].displayState
                                large: true
                                action: options
                                actionItem: =props.itemPrefix+"_ControlVacuum"
                                item: =props.itemPrefix+"_ControlVacuum"
          - component: f7-col
            slots:
              default:
                - component: f7-card
                  slots:
                    default:
                      - component: f7-card-header
                        slots:
                          default:
                            - component: Label
                              config:
                                text: Saugkraft
                                style:
                                  - fontWeight: 100
                                  - color: rgb(136, 136, 136)
                      - component: f7-card-content
                        slots:
                          default:
                            - component: oh-button
                              config:
                                style:
                                  height: 2.5em
                                  line-height: 2.5em
                                  font-size: 2em
                                text: =items[props.itemPrefix+"_ControlFanLevel"].displayState
                                large: true
                                action: options
                                actionItem: =props.itemPrefix+"_ControlFanLevel"
                                item: =props.itemPrefix+"_ControlFanLevel"
    - component: oh-repeater
      config:
        sourceType: range
        for: i
        rangeStart: 0
        rangeStop: =JSON.parse(props.rooms).length / props.chunkSize
        fragment: true
        visible: =items[props.itemPrefix+"_ControlVacuum"].state !== "vacuum"
      slots:
        default:
          - component: f7-row
            config: {}
            slots:
              default:
                - component: oh-repeater
                  config:
                    for: roomChunk
                    in: =JSON.parse(props.rooms).slice(loop.i * props.chunkSize, props.chunkSize * (loop.i + 1))
                    fragment: true
                  slots:
                    default:
                      - component: f7-col
                        slots:
                          default:
                            - component: f7-card
                              config: 
                                style:
                                  height: 3rem
                                  line-height: 3rem
                              slots:
                                default:
                                  - component: f7-card-content
                                    config:
                                      style:
                                        padding: 0
                                        marging: 0
                                        height: 3rem
                                    slots:
                                      default:
                                        - component: oh-button
                                          config:
                                            iconF7: =loop.roomChunk.icon
                                            iconSize: 1.2em
                                            active: '=vars["clean" + loop.roomChunk.roomId] ? true : false'
                                            text: =loop.roomChunk.label
                                            large: true
                                            action: variable
                                            actionVariable: ="clean" + loop.roomChunk.roomId
                                            actionVariableValue: '=undefined === vars["clean" + loop.roomChunk.roomId] ? true : !vars["clean" + loop.roomChunk.roomId]'
                                            style:
                                              height: 3rem
                                              line-height: 3rem
                                              text-align: center
                                              font-size: 1.1em
    - component: f7-row
      config: {}
      slots:
        default:
          - component: f7-col
            slots:
              default:
                - component: f7-card
                  slots:
                    default:
                      - component: f7-card-content
                        config:
                          style:
                            padding: 0
                        slots:
                          default:
                            - component: oh-button
                              config:
                                visible: =items[props.itemPrefix+"_ControlVacuum"].state !== "vacuum"
                                iconF7: rocket
                                iconSize: 1.2em
                                #text: '=items[props.itemPrefix+"_ControlVacuum"].state === "vacuum" ? "Wird ausgeführt" : "Ausführen"'
                                text: "='set_mode_withroom[0,1,'+ ((vars.clean16 ? 1: 0)+ (vars.clean17 ? 1:0) + (vars.clean18 ? 1:0) + (vars.clean19 ? 1:0) + (vars.clean20 ? 1:0) + (vars.clean21 ? 1:0) + (vars.clean22 ?  1:0) + (vars.clean23 ?  1:0) + (vars.clean24 ?  1:0))+','+ ((vars.clean16 ? '16,': '') + (vars.clean17 ? '17,': '') + (vars.clean18 ? '18,': '') + (vars.clean19 ? '19,': '') + (vars.clean20 ? '20,': '') + (vars.clean21 ? '21,': '') + (vars.clean22 ? '22,': '') + (vars.clean23 ? '23,': '') + (vars.clean24 ? '24,': '')).slice(0, -1) + ']'"
                                large: true
                                action: command
                                actionItem: =props.itemPrefix+"_ExecuteCommand"
                                actionCommand: "='set_mode_withroom[0,1,'+ ((vars.clean16 ? 1: 0)+ (vars.clean17 ? 1:0) + (vars.clean18 ? 1:0) + (vars.clean19 ? 1:0) + (vars.clean20 ? 1:0) + (vars.clean21 ? 1:0) + (vars.clean22 ?  1:0) + (vars.clean23 ?  1:0) + (vars.clean24 ?  1:0))+','+ ((vars.clean16 ? '16,': '') + (vars.clean17 ? '17,': '') + (vars.clean18 ? '18,': '') + (vars.clean19 ? '19,': '') + (vars.clean20 ? '20,': '') + (vars.clean21 ? '21,': '') + (vars.clean22 ? '22,': '') + (vars.clean23 ? '23,': '') + (vars.clean24 ? '24,': '')).slice(0, -1) + ']'"
                                style:
                                  height: 2.5em
                                  line-height: 2.5em
                                  text-align: center
                                  font-size: 2em
                            - component: oh-button
                              config:
                                visible: =items[props.itemPrefix+"_ControlVacuum"].state === "vacuum"
                                iconF7: stop_circle
                                iconSize: 1.2em
                                text: Zurück zum Dock
                                large: true
                                action: command
                                actionItem: =props.itemPrefix+"_ExecuteCommand"
                                actionCommand: ='app_charge'
                                style:
                                  height: 2.5em
                                  line-height: 2.5em
                                  text-align: center
                                  font-size: 2em

But be warned, the room numbers are hardcoded, so rooms with numbers 11, 12 and so on won’t work currently.

Hope this starting point helps you to achieve your goal.

Thank you very much . It’s working perfect. If I don’t choose a room and click to clean it’s start to clean probably all the house, I didn’t let it run but I can live with this.
Again thanks a lot and I wish you a happy new year.

Nikos

1 Like

hi guys ,i am trying to set up the widget,i managed to setup my prefix and item names as for me they r slightly different,plus i translate it from German to Greek.I am struggling with the room function cleaning…thing.My rooms a 2,16,17,18 and 19.I have a Roborock s5. I sent via executecommand channel “set_mode_withroom [0,1,0,17,18]” and i got

2022-01-07 21:54:46.917 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'MiRobotVacuumV2_Actions_ExecuteCommand' changed from set_mode_withroom [0,1,0,17,18] to {"result":"unknown_method","id":9948}

so i think my vacuum does not support this command?

Hi guys, I really like this widget and want to use it. Can you tell me which binding you are using for the Xiaomi roborock integration into openhab? Is it the Xiaomi MI OI binding? I read in an older manual that I have to use the Xiaomi Home app, still correct? Currently my s7 is connected to the roborock app (which I really like). In the instructions of the Xiaomi Home app its explained that I have to reset the wifi of device to couple it. Does this mean that I am not able to use roborock app anymore? How did you extract the token?
A lot of questions, sorry :slight_smile:

Yes, the Miio binding (have a look in it’s dedicated post). You get the token during Discovery locally but yes, there was/is (?) the need to have it in the Xiaomi app, in the past you had to use an old version of the app to get the token. (Maybe you can try first without the app)

@Tetsuo thnx for ur hard work mate, so…i managed to understand the concept and i was able to set up the widget and everything is working great!I have a question though…when the roborock starts to vacuum the “Actions”,“Fan Speed” and all the room tabs are gone and only the “returned to dock” button is available.How can i stop that?

Hi @Constantinos_Contis - glad you like it. Sounds like your previous question is not open any more, right?

Your last question is quite simple to answer, but you need to figure out what you want otherwise for yourself.

The buttons or the elements have one attribute “visible” with some expression like this example for the execution button:

visible: =items[props.itemPrefix+"_ControlVacuum"].state !== "vacuum"

So the visibility is depending on the state of the _ControlVacuum state.

Does it help you to solve the problem?

oh i got it now ,so if i want an element visible all the time i just remove the “visible” attribute.Thx mate.
An other question not so much about widget but for the “_ExecuteCommand” command,i want to use the bottom button Not to stop and send to the dock but for pausing and resuming cleaning or room_cleaning.Do you know if there is a command for this ?Where can i found out the roborock’s “_ExecuteCommand” commands???
thnx again

Thank you for your answer!
I switched to the Xiaomi Home App today and connected the roborock. All maps and configurations were carried over automatically. After this the connection to the binding did also work without any problems. Token was discovered automatically! :slight_smile:

1 Like

Your can find a list of possible commands here GitHub - marcelrv/XiaomiRobotVacuumProtocol: Attempt to describe the Xiaomi Robot Vacuum Protocol

1 Like

thnx mate now i have the perfect widget for my needs

1 Like