Support for Eufy RoboVac or Smart Bulbs?

I’ve got a proof-of-concept Python library for direct integration built out over this weekend. I’m hoping to work on it more and get an initial release in the next few weeks, then follow that up with Home Assistant integration.

2 Likes

This looks great - I’ll have a play with it later tonight!
Do you think support could be built for Hassio given the Open SSL requirements? Not sure that’s built in…

Home Assistant already requires the cryptography library which is why I picked it, but there are alternative options if openssl is a problem. Not hard to switch it out now the usage is figured out.

That demo works with my robovac 30C. Thanks for your work!

1 Like

Hi, Could you tell me where you find DEVICE_ID & LOCAL_KEY for the Robovac? Thanks!

I basically followed mitchellrj’s advice and used adb logcat on an android phone while using the eufy home app.

1 Like

Following up to my previous “workaround” for those who are interested in a way to make this work until official support is implemented, here are my configs:

In configuration.yam I’ve added:

notify:    
  - name: Google Assistant Command
    platform: rest
    resource: http://[hass_server_ip]:5000/command

and:

#Vacuum Entity Placeholders
vacuum:
  - platform: mqtt
    name: "Entryway Vacuum"
  - platform: mqtt
    name: "Hallway Vacuum"
  - platform: mqtt
    name: "Master Bedroom Vacuum"
  - platform: mqtt
    name: "Basement Vacuum"

And in ui-lovelace.yaml I’ve added:

# View tab title.
  - title: Vacuums
    icon: mdi:robot-vacuum-variant
    panel: true
    cards:
      - type: vertical-stack
        cards:
          - type: horizontal-stack
            cards:
              - type: entities
                title: Entryway
                entities:
                  - entity: vacuum.entryway_vacuum
              - type: entity-button
                icon: mdi:robot-vacuum
                entity: vacuum.entryway_vacuum
                name: Start
                tap_action:
                  action: call-service
                  service: notify.google_assistant_command
                  service_data:
                    message: "ask robovac ben to start cleaning"

I think I copied all the related config entries, if I missed anything let me know. I also haven’t messed at all with anything formatting wise for multiple buttons/multiple units, controls other than starting cleaning for that one vacuum, etc. as I haven’t had time, but that’s the gist and it does work in case this helps anyone else.

I’ve pushed an update to the Python library now to allow it to be used as an extremely beta custom component in Home Assistant. There’s some brief instructions in the README. It’s all based on my Robovac 30C (T2118), so other variants may not work.

Discovery and finding the local key more easily is something I’ve been looking into, but it is not something I’m going to be able to achieve in the short term. For now, the adb logcat approach is the easiest way :frowning:

2 Likes

@mitchellrj I’m probably doing something wrong, but I’m still having trouble finding the local key…did an ADB logcat and piped it out to a text file, then searched eufy, the name of one of my robovacs, etc. after messing around in the eufy app for a few seconds, and found the device_id easily enough…but the local key is still eluding me. Is there an exact string I should be searching for? Or is there something specific I should be doing in the Eufy app while capturing the logcat? The logcat quickly becomes rather huge lol. Thanks again for this!

the strings where called the following:

  • uuid or devid for for the device id

  • localKey for the local key…

you should find these in a JSON-string. I didn’t do anything special but browsing the app and sending some commands to the vacuum.

Gotcha…first time I did it I was on a remote network, maybe you have to be local? Otherwise maybe I just missed something. I believe I found those keys you’re referring to near some text mentioning “tuya” several times. Thanks!

@Knapoc
The JSON I discovered seemed to have something different (given the different model I guess); ‘device_key’ & ‘local_code’ (both different) were present - assuming one of these is the local key. Both are 16 chars.

‘device_id’ was a hex string in 5 blocks.

@mitchellrj
I know you said it this is built for the 30C, my 11C is getting this:

ConnectionRefusedError: [Errno 111] Connection refused

Thanks all for the input and contributions so far! :smile:

@xt16johnny In my case the device id consists of 20 characters and the localkey of 16 characters. Don’t know if that’s the reason for your connection issues.

I’ve found that intermittently there are connection problems. Is it failing consistently for you, @xt16johnny? It might be the older models use a different API. Can you check if port 6668 is open using nmap, netcat or similar?

More detailed steps on using logcat:

  1. Close the app on your mobile device
  2. Connect the device to your computer and enable USB debugging
  3. Run adb logcat -e 'tuya.m.my.group.device.list' (assumes you have already installed the Android debug tools)
  4. Launch the Eufy Home app
  5. The output lines contain JSON, you’re looking for the values of localKey (16 character hex string) and devId (20 character hex string).
1 Like

Port Scan has started…
Port Scanning host: 192.168.0.142
Open TCP Port: 55556
Port Scan has completed…

I changed the port number in tuya.py but still having the same results.

My outputs from the Android logs are definitely different from the Robo 30 models too.
I have tried different combinations of 16 char keys and any of the device ID’s I can find in there.
I make the assumption that ‘name’ on the configuration is only for HA, it’s not required to be the same name as the vacuum as named in the Eufy app?

The full error I get every restart of HA;

eufy_vacuum: Error on device update!
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py”, line 261, in _async_add_entity
await entity.async_device_update(warning=False)
File “/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py”, line 377, in async_device_update
await self.async_update()
File “/config/custom_components/eufy_vacuum/vacuum.py”, line 75, in async_update
await self.robovac.async_get()
File “/config/custom_components/eufy_vacuum/tuya.py”, line 489, in async_get
return await message.async_send(self, callback)
File “/config/custom_components/eufy_vacuum/tuya.py”, line 327, in async_send
await device._async_send(self)
File “/config/custom_components/eufy_vacuum/tuya.py”, line 553, in _async_send
await self.async_connect()
File “/config/custom_components/eufy_vacuum/tuya.py”, line 466, in async_connect
sock.connect((self.host, self.port))
ConnectionRefusedError: [Errno 111] Connection refused

Thanks

OK, it looks like these older models do use the same type of API as the switches and bulbs in that case. That’d be best implemented in the existing lakeside project:

I can try to help reverse engineer the protocol, but without an 11C to test against, it’s going to be hard to validate. Selfishly I’m going to focus on the 30C support for now.

I’ve documented what I’ve found so far for local key discovery here: https://github.com/mitchellrj/eufy_robovac/issues/1

I don’t think I’m going to get any further on this by myself, without some reverse-engineering / crypto expertise from someone else.

Maybe it’s just me, but I’ve started noticing that the moment I enable the experimental add-on in HA, I get all sorts of other component errors in my log upon restarting HA. Usually along the lines of “error setting up platform…” or the “taking longer than 10 seconds” error. Which components it happens to on an individual reboot vary, but it’s consistently 2-3+ items and it’s everything from Hue, to Eufy, to Wink, and more…it’s seemingly random.

I wouldn’t think it’s this add-on, except that the moment I disable it I can reboot multiple times with zero errors. Then the moment I re-enable it again they come back at next reboot…any thoughts?

Also - @mitchellrj is your “I don’t think I’m going to get any further on this by myself” comment related solely to being able to discover local keys from login info? Assuming I can get the above issue fixed then will those of us who have 30c’s and local keys still be able to reliably use this component?

I guess my main question is whether you still plan on updating/supporting the experimental component or not going forward. Many thanks for all your hard work!!

I’ve just finished reverse-engineering the RoboVac 11c protocol and implementing it in Python. I’ll see if I can get a custom component on GitHub tonight.

Edit: I’ve thrown together a quick component here: https://github.com/bnmcg/homeassistant-robovac. Just place eufyrobovac into your custom_components/ directory.

I did some quick tests locally and it seems to work OK, it doesn’t support some of the features in the Python library yet, but the key things like start, stop, go home, and locate are there.

Second edit: The required configuration is in the README on the GitHub repository.

1 Like