Modified localtuya for Liectroux ZK901 and Alfawise V10 vacuums

This is a unfinished integration for Liectroux ZK901 and his white label cousins. It branched from the open PR for vacuum implementation that localtuya guys should release soon. Comparing to the original PR, this one has to take status updates from DP 102 base 64 encoded data.

Sample YAML configuration:

  - host: <ip address>
    device_id: <device id>
    local_key: <local key>
    friendly_name: Maradona
    protocol_version: "3.3"
      - platform: vacuum
        friendly_name: Maradona
        id: 1
        commands_set: "smart,stop,chargego"
        commands_dp: 3
        idle_status_value: "dormant,idle,pause,fault"
        returning_status_value: "backcharge"
        docked_status_value: "fullcharge, charge"
        battery_dp: 5
        cleaning_mode_dp: 3
        cleaning_modes: "smart,random,spiral,wall_follow"
        fan_speed_dp: 3
        fan_speeds: "quiet,auto,strong"

To Do

  • Fix heartbeat code. While I don’t know why vacuum don’t answer sometimes, the reconnect interval was reduced and device status is kept constantly online.
  • Implement additional commands (zone cleaning, spot cleaning, fan control…). Please note that only “total cleaning” and “return to base” commands on DP 3 are working at this moment. I’m not sure, but maybe other commands should be sent to a different DP, probably encoded on base 64.
  • Not related to this integration, but looking to update the vacuum position in the floorplan based on its X,Y position.

ps:LocalKey and device ID from your vacuum is needed. There are many tutorials on how to get such info on the web. I recommend to install “Laser Robot” app on Bluestacks, start an ADB shell and run “logcat | grep localKey” while opening the app. Please note that Laser Robot app can work simultaneously with this this integration.

Big thanks for it.
Can you help with integration?
I have tried HA from 2021.8.0 to the last.
I tried get Key from logcat, dev account tuya and tuya smart app (it changed and I updated config every time). But every time I get this error.

I have newly installed HA Core and copy your fork to custom_components.
On start I have this error.

2021-09-26 22:20:55 ERROR (MainThread) [custom_components.localtuya.common] [bfd...abi] Connect to addr: failed
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/localtuya/", line 139, in _make_connection
    self._interface = await pytuya.connect(
  File "/home/homeassistant/.homeassistant/custom_components/localtuya/pytuya/", line 637, in connect
    _, protocol = await loop.create_connection(
  File "/usr/local/opt/python-3.8.7/lib/python3.8/asyncio/", line 986, in create_connection
    infos = await self._ensure_resolved(
  File "/usr/local/opt/python-3.8.7/lib/python3.8/asyncio/", line 1365, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "/usr/local/opt/python-3.8.7/lib/python3.8/asyncio/", line 825, in getaddrinfo
    return await self.run_in_executor(
  File "/usr/local/opt/python-3.8.7/lib/python3.8/concurrent/futures/", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/opt/python-3.8.7/lib/python3.8/", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

I found some error.
I don’t know why but there is wrong address set. If i change it in VSCode debuging time all begins work well.
My config the same as yours

  - host:
    device_id: <>
    local_key: <>
    friendly_name: Sweepe
    protocol_version: "3.3"

Where “addr:” was added? =(

Hi all, I have a Liectroux c30b, wich uses navigation by gyroscope.
I was able to get these codes:

Switch code: "1"
Fault alarm code: "11"
Battery power code: "14"
Cleaning switch code: "25"
Cleaning direction code: "26"
Operating mode code: "27"
Working status code: "28"
Positioning of robot code: "29"
Cleaning strength code: "30"
Mute code: "31"
CleaningArea code: "32"
CleaningTime code: "33"
Cleaning record code: "34"
Register / Log code: "102"

But, there is a way I can get the map from it?
The code “102” corresponde a string like: ‘1636,3,0,C,4,126, 2, 0, 3, 3,0,0,22725,-148, 0, 0,2, 0’

But I don’t know what it means, or if it has some information about location. x,y…
Do you have some idea about how I can extract the map from the vacuum and what information has in the “102”.
Thank you!!

Here is the full log:

{"dps":{"1":true,"11":0,"14":100,"25":false,"26":"foward","27":"standby","28":"chargecompleted","30":"normal","31":false,"32":46,"33":41,"34":"04104600078","102":"1636,3,0,C,4,126,  2,  0,  3,  3,0,0,22725,-148, 0, 0,2,  0"}}

Were you able to get the map from your vacuum cleaner? I have a liectroux xr500