CodeFoodPixels / robovac

Add a Eufy RoboVac easily to Home Assistant
Other
139 stars 31 forks source link

Support for L60 SE #85

Open meanandpinchy opened 5 months ago

meanandpinchy commented 5 months ago

The unit is detected, but has no entities except for battery, which is "unavailable". Please add support for the L60 SE.

mumpers68 commented 5 months ago

I second the support for the L60 SES!

stoozak commented 4 months ago

yes, please!

Harm-Veraa commented 4 months ago

I was looking into this, seems the TUYA_CODES are incorrect for this robovac. Yet to firgure out any of the codes, except for battery life, which is 163. Is there any documentation about these codes available?

For reference, this is a response when the device is doing nothing: {'151': True, '156': True, '158': 'Turbo', '159': aTrue, '160': False, '161': 41, '163': 99}

stoozak commented 4 months ago

,

Where do we plug these in? Happy to test and feedback.

Harm-Veraa commented 4 months ago

Depends if you have main branch or better-dps branch. For main branch they are at the top of the 'vacuum' file, if I am not mistaken (currently on the other branch). On better-dps branch they are at the specific file for your vacuum. In our case this is T2278 (or at least for me, I have the hybrid, not sure if it's different but otherwise I expect T2277).

In both cases, before it will even load, you need to add your vacuum. In the better-dps branch you copy the specific model file and add it to the list of vacs in init. In the main you can check the robovac file and add it to the list of 'L' models.

If you are on better-dps branch, also make sure to make a comment for extra features (as they crash currently, possible because code is incorrect, not sure).

robovac_features = 0; # RoboVacEntityFeature.CLEANING_TIME | RoboVacEntityFeature.CLEANING_AREA | RoboVacEntityFeature.DO_NOT_DISTURB | RoboVacEntityFeature.AUTO_RETURN | RoboVacEntityFeature.ROOM | RoboVacEntityFeature.ZONE | RoboVacEntityFeature.BOOST_IQ | RoboVacEntityFeature.MAP | RoboVacEntityFeature.CONSUMABLES

After all of this, a logger can be added to log everything. If you change the code of the battery to 161, you'll see that one works in the home panel.

Harm-Veraa commented 4 months ago

It's curious, if I start the robot or do something with it, the status does not change according to the Logger. Perhaps another api call is required?

Harm-Veraa commented 4 months ago

Should the developer read this, and willing to look into it. Some more messages from the device, when I start it via the Eufy app. It looks like it's encrypted. I noticed that '179' has 4 values which would match potential states the device is in. (positioning, cleaning, heading home, charging). These only reported after a first run tho.

{'151': True, '156': True, '158': 'Turbo', '159': True, '160': False, '161': 41, '163': 99, '177': 'DAjZhNCLlIztzgFSAA==', '153': 'BBADGgA=', '178': 'DQiuzqvylIztzgESAR8=', '152': 'AggG', '179': 'FhIUEhIIEBABIGMozsPsswYwgcTsswY=', '173': 'GAoSMgoKAggBEgQIARgPOgQKAggBEgIIAQ==', '176': 'JgoAGgBSCBoAIgIIASoAWDBiFAoSCghOcjE4X0lvVBoGEKnC7LMG', '169': 'xxx'}

stoozak commented 4 months ago

Righto, so using the DPS branch I copied the 2273 config and renamed it to 2277 and added the reference to the model number in init.

Using 161 the battery shows as 0%, and log shows the following:


2024-06-25 21:10:21.757 ERROR (MainThread) [homeassistant.components.vacuum] Error adding entity vacuum.fred for domain vacuum with platform robovac
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/locks.py", line 386, in acquire
    await fut
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/config/custom_components/robovac/tuyalocalapi.py", line 911, in async_recieve
    await self._recieve_task
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1354, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/config/custom_components/robovac/vacuum.py", line 297, in async_added_to_hass
    await self.async_forced_update()
  File "/config/custom_components/robovac/vacuum.py", line 326, in async_forced_update
    await self.async_update_vacuum()
  File "/config/custom_components/robovac/vacuum.py", line 322, in async_update_vacuum
    await self.vacuum.async_get()
  File "/config/custom_components/robovac/tuyalocalapi.py", line 763, in async_get
    response = await self.async_recieve(message)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/robovac/tuyalocalapi.py", line 923, in async_recieve
    raise ResponseTimeoutException(
custom_components.robovac.tuyalocalapi.ResponseTimeoutException: Timed out waiting for response to sequence number 818946
2024-06-25 21:10:26.827 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bfb2df8ed89ef1ee85zulu] Processing queue. Current length: 1
2024-06-25 21:10:26.827 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bfb2df8ed89ef1ee85zulu] Sending to bfb2df8ed89ef1ee85zulu (192.168.10.18:6668): Message(0x9, b'', 0, <Device bfb2df8ed89ef1ee85zulu (192.168.10.18:6668)>)
2024-06-25 21:10:26.828 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bfb2df8ed89ef1ee85zulu] Connecting to bfb2df8ed89ef1ee85zulu (192.168.10.18:6668)
2024-06-25 21:10:26.836 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bfb2df8ed89ef1ee85zulu] Received message from bfb2df8ed89ef1ee85zulu (192.168.10.18:6668): Message(0x9, b'', 0, None)
Harm-Veraa commented 4 months ago

I also get this error sometimes, seems to be when I clicked a button and then the sequence number goes haywire.. Not sure tho. In any case, the last 3 messages show it is working. At least the communication part is.. Can you try 163 for battery? That is what I have currently.

Harm-Veraa commented 4 months ago

One thing to add. Battery wont show in a default card (when the device is so-called offline). Go to the device info itself under settings -> devices. Should show there.

stoozak commented 4 months ago

Hmmm, no luck. It still shows 0%. I also don't seem to get the log state with the encrypted numbers that you got.

Harm-Veraa commented 4 months ago

Did you enable debug logging?

stoozak commented 4 months ago

Afraid so :(

Harm-Veraa commented 4 months ago

Mhh okay odd. I don't know why it won't work for you.. when I have more time I might look into it further. Should I find a proper solution I'll see if I can create a PR

stoozak commented 4 months ago

Some of these codes may be helpful: https://github.com/CodeFoodPixels/robovac/issues/42#issuecomment-1873242870

JohnD76 commented 4 months ago
JohnD76 commented 4 months ago

I am having similar issues, my L60SES replaces a 15C MAX. I have removed the Eufy integration from HACS and rebooted. Amended the robots file to include the T2277 model number and when adding a device for some reason it identifies the L60SES and the name of the robot, burt gives it the MAC address of the old robot (15C MAX), even though this is removed from the Eufy app.....

I can't control the robot or see the battery status sadly via HA.

maximoei commented 3 months ago

Hi all! Good news: I've been able to get my L60 SES to work in Home assistant!

Ugly-but-working code is here https://github.com/maximoei/robovac/tree/L60-support This version very much breaks supports for all other Robovacs, so quite some work is still needed to get it integrated back into the repo - any help is appreciated! I added config files for T2267 (L60), T2277 (L60 SES), T2278 (L60 SES Hybrid). I own the T2277 (L60 SES), so other are fully untested.

So:

What is the integration able to do:

Very much not supported:

I'll try to work this back into the better-dps branch, but any help here is appreciated. Happy to hear your feedback as well! image image

Harm-Veraa commented 3 months ago

Nice! How did you find out the codes?

IainPHay commented 3 months ago

This is great to see, I have cleaned out the old integration and installed this but I still only see just the battery entity. I just have the L60

maximoei commented 3 months ago

Nice! How did you find out the codes?

Via the other work I referenced. Some of the error codes by seeing what is being logged in the integration

This is great to see, I have cleaned out the old integration and installed this but I still only see just the battery entity. I just have the L60

Sometimes it only starts reporting detailed state after I start (and stop) a cleaning cycle from the app. After that, session seems to 'stick'. Also, if you have errors in your log, please share

IainPHay commented 3 months ago

Thanks for the feedback, must admit I'd not thought of triggering it via the app. I'll give that a try and see if it grabs the info

Harm-Veraa commented 3 months ago

Nice! How did you find out the codes?

Via the other work I referenced. Some of the error codes by seeing what is being logged in the integration

This is great to see, I have cleaned out the old integration and installed this but I still only see just the battery entity. I just have the L60

Sometimes it only starts reporting detailed state after I start (and stop) a cleaning cycle from the app. After that, session seems to 'stick'. Also, if you have errors in your log, please share

Interesting! I also tried this but for me every response seemed encrypted or something.. glad you figured it out !

asportnoy commented 3 months ago

Was able to get my L60 SES (T2277) working on your fork. Nice work! Will test a full run later tonight.

Had to make 2 minor changes to get it running:

[!IMPORTANT] The fork was updated to fix these issues in this commit. These changes are no longer necessary.

IainPHay commented 3 months ago

Was able to get my L60 SES (T2277) working on your fork. Nice work! Will test a full run later tonight.

Had to make 2 minor changes to get it running:

  • Add the model to vacuums/__init__.py, was previously missing
  • vaccuums/T2267.py had the wrong class name causing an import error - updated it to match the file name

That second bit helped me out, thanks! I have it running now but it always shows error despite being controllable but it's a massive improvement on just having the battery status :)

jb123567 commented 3 months ago

Was able to get my L60 SES (T2277) working on your fork. Nice work! Will test a full run later tonight.

Had to make 2 minor changes to get it running:

  • Add the model to vacuums/__init__.py, was previously missing

  • vaccuums/T2267.py had the wrong class name causing an import error - updated it to match the file name

That second bit helped me out, thanks! I have it running now but it always shows error despite being controllable but it's a massive improvement on just having the battery status :)

I'm having the L60 remaining unavailable, what exactly did you change in the file?

asportnoy commented 3 months ago

The latest commit on that fork includes fixes for the issues I mentioned, so you shouldn't have to manually change anything anymore. Make sure that you have the correct fork/branch checked out and you pulled the latest commit. If so, check the logs in home assistant.

jb123567 commented 3 months ago

The latest commit on that fork includes fixes for the issues I mentioned, so you shouldn't have to manually change anything anymore. Make sure that you have the correct fork/branch checked out and you pulled the latest commit. If so, check the logs in home assistant.

Yep, realised just after posting, HA had done something weird with the files. Started again completely and now working happily. Did have to start the device in the app to get it to register.

asportnoy commented 3 months ago

Full test run was mostly successful! I did notice one issue though: when I checked the logs afterwords, it looks like it was intermittently unavailable while it was running. Based on the timings, my guess is that this was when it returned to the base to empty at cut hair, but I was not actually there so I can't confirm. Nothing in the logs. Not a huge deal but definitely worth making a note of at least.

image

asportnoy commented 3 months ago

Hi all, a few updates from my continued testing (on my L60 SES) over the last week or so:

Besides those issues, it seems to work fine! Might be good to clean up a bit as needed and create a PR now, and then come back for whatever other issues there are since this is definitely a huge improvement over what's currently available.

* This was all done on commit fc1d0f5. I just noticed there are some new commits, so I will pull and test those later.

blablazzz commented 2 months ago

how can i start using it? With latest integration version i still dont see my L60 vac.

maximoei commented 2 months ago

It is not in the latest integration, you need to use this fork for now

DesertNomadBear commented 2 months ago

Edit: updated model info

I have an L60 hybrid, added the latest repository, started and stopped the vacuum from the Eufy app, but I’m still only seeing the battery sensor (with no battery value), and I’m getting this error:

Error while setting up robovac platform for vacuum Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 364, in _async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/robovac/vacuum.py", line 116, in async_setup_entry entity = RoboVacEntity(item) ^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/robovac/vacuum.py", line 284, in init self._attr_supported_features = self.vacuum.getHomeAssistantFeatures() ^^^^^^^^^^^ AttributeError: 'RoboVacEntity' object has no attribute 'vacuum'

jeffmccann commented 2 months ago

Same errors with the x8 pro ses. 😢

plainmad commented 2 months ago

Ive got an l60 hybrid and I've tried the new fork but it doesn't seem to be working? Looking at the comments above we seek to have the models of l60, l60 se, l60 se hybrid but not just the l60 hybrid so I assume this is why my one isn't working.

If it is able to be added that would be great and I'm happy to helping with any logs etc needed

Yorin1 commented 2 months ago

It is not in the latest integration, you need to use this fork for now

I am a little lost on how to install this modified integration for the L60 SES. From the page linked above I used "https://github.com/maximoei/robovac.git" as a custom repository on HACS and then I follow the normal steps for setting up the integration. This doesn't work. In Home Assistant the folder "vacuums" is not created under "custom_components/robovac". The log wil show an error setting up the Robovac platform and the integration will show 1 device with an unavailable battery entity.

I'm a little out of my depth here. What are the steps to follow in order to install a fork or a certain commit? Can this be done from the HACS UI or do I need to SSH into my HA instance? Thanks to whoever can point me in the right direction. I will not rest until I can control my L60 SES vacuum from within HA :-)

asportnoy commented 2 months ago

You need to check out the L60-support branch, which I don't think you can do from HACS.

In my case, I cloned it and installed it in the custom components folder manually (via terminal).

Yorin1 commented 2 months ago

You need to check out the L60-support branch, which I don't think you can do from HACS.

In my case, I cloned it and installed it in the custom components folder manually (via terminal).

I started in "https://github.com/maximoei/robovac/tree/L60-support" and hit the green "code" button. I now have the files on my HD (using Git desktop). I copied the contents from "custom_components/robovac" into the HA "custom_components/robovac" folder (using the "file editor" add-on) and rebooted HA. However after adding the integration it is again the same issue (error in the log and just the not available battery entity). The error message is identical to what DesertNomadBear posted last week.

When you say you installed it in custom components manually, do you mean you copied the files to that folder or is there more to it? Also besides the folder "custom_components" there are other files and folders that come with the clone. Do you have to do anything with those or does only the folder "custom_components" matter?

asportnoy commented 2 months ago

Check the custom_components/robovac/vacuums folder and look for a T2277.py file. If it's not there, it means you're not actually on the correct branch.

If you are actually on the correct branch, I need to see the file tree to understand how you did it. Also make sure you uninstalled the prior version first to make sure they're not conflicting and still using the old version somehow.

Yorin1 commented 2 months ago

Check the custom_components/robovac/vacuums folder and look for a T2277.py file. If it's not there, it means you're not actually on the correct branch.

If you are actually on the correct branch, I need to see the file tree to understand how you did it. Also make sure you uninstalled the prior version first to make sure they're not conflicting and still using the old version somehow.

Thanks a lot! You pointed me to where I got it wrong with your comments.

For anybody who might be struggling with this as well. I used GitHub Desktop to open the Robovac repository, then selected the right branch (this is where I went wrong before). If you then hit "show in explorer" you are taken to all the files. Copy everything under "custom_components" to the same directory in your HA instance and reboot (I used the file editor add-on in HA to copy files from my HD to the RPi 4 that runs my HA). After rebooting you search for the Robovac integration and once it's added you need to start a cleaning run from the Eufy app to have the device become active in HA.

Not really that hard once you figure out what to do. Copying all the files one-by-one was a bit tedious, but this only needs to be done once. I suppose that using the terminal there are easier ways to copy the files at once.

pnm1977 commented 2 months ago

It is not in the latest integration, you need to use this fork for now

@maximoei - Any idea if it's possible to send the do not disturb command for on and off on this fork and have you managed to work out how it's done? The entity seems stable when controlling the on/off via the app and the string is unique based on the set schedule in the app.

Casper9228 commented 2 months ago

@maximoei Hoi! I was wondering if you could give me a push into the right direction, although hijacking this issue a little bit. I have a X8 Pro SES (T2276G11) that I was hoping to set up with your L60 branch. Unfortunately, after two days of tinkering, I just don't seem to be able to set it up.... This is my error log:

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/robovac/tuyalocalapi.py", line 911, in async_recieve
    await self._recieve_task
  File "/usr/local/lib/python3.12/asyncio/tasks.py", line 519, in wait_for
    async with timeouts.timeout(timeout):
  File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 595, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 909, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1365, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/config/custom_components/robovac/vacuum.py", line 366, in async_added_to_hass
    await self.async_forced_update()
  File "/config/custom_components/robovac/vacuum.py", line 395, in async_forced_update
    await self.async_update_vacuum()
  File "/config/custom_components/robovac/vacuum.py", line 391, in async_update_vacuum
    await self.vacuum.async_get()
  File "/config/custom_components/robovac/tuyalocalapi.py", line 763, in async_get
    response = await self.async_recieve(message)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/robovac/tuyalocalapi.py", line 923, in async_recieve
    raise ResponseTimeoutException(
custom_components.robovac.tuyalocalapi.ResponseTimeoutException: Timed out waiting for response to sequence number 384152823
2024-09-10 19:52:44.997 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bf176e865fc470ad656htu] Disconnected from bf176e865fc470ad656htu (192.168.1.225:6668)
2024-09-10 19:52:45.000 DEBUG (MainThread) [custom_components.robovac.vacuum] ['Quiet', 'Standard', 'Turbo', 'Max']
2024-09-10 19:52:45.002 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bf176e865fc470ad656htu] Processing queue. Current length: 1
2024-09-10 19:52:45.003 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bf176e865fc470ad656htu] Sending to bf176e865fc470ad656htu (192.168.1.225:6668): Message(0xa, {'gwId': 'bf176e865fc470ad656htu', 'devId': 'bf176e865fc470ad656htu'}, 384186211, <Device bf176e865fc470ad656htu (192.168.1.225:6668)>)
2024-09-10 19:52:45.003 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bf176e865fc470ad656htu] Connecting to bf176e865fc470ad656htu (192.168.1.225:6668)
2024-09-10 19:52:45.112 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bf176e865fc470ad656htu] Processing queue. Current length: 1
2024-09-10 19:52:45.112 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bf176e865fc470ad656htu] Sending to bf176e865fc470ad656htu (192.168.1.225:6668): Message(0x9, b'', 0, <Device bf176e865fc470ad656htu (192.168.1.225:6668)>)
2024-09-10 19:52:45.130 DEBUG (MainThread) [custom_components.robovac.tuyalocalapi.bf176e865fc470ad656htu] Incomplete read

If you have some spare time, could you please have a look? :)

Many thanks!

maximoei commented 1 month ago

https://github.com/CodeFoodPixels/robovac/issues/46 - @Casper9228 , I don't know what Incomplete read means, but I think the issue is closer to the tuya module, rather than the handling of the messages.

avidricaire commented 1 month ago

I followed the instructions and the device is detected and it can read its states (charging, cleaning, docked), but I have no controls in HA and it just says the entity is unavailable. Any ideas? When added to Alexa through HA cloud I can control it

asportnoy commented 1 month ago

I followed the instructions and the device is detected and it can read its states (charging, cleaning, docked), but I have no controls in HA and it just says the entity is unavailable. Any ideas? When added to Alexa through HA cloud I can control it

I think there is a bug where the initial state is always unavailable when you first set it up. Try using the official app to start a cleaning cycle, then see if the controls in HA start working.

avidricaire commented 1 month ago

I followed the instructions and the device is detected and it can read its states (charging, cleaning, docked), but I have no controls in HA and it just says the entity is unavailable. Any ideas? When added to Alexa through HA cloud I can control it

I think there is a bug where the initial state is always unavailable when you first set it up. Try using the official app to start a cleaning cycle, then see if the controls in HA start working.

Took a little bit but that solved it, thank you!

maximoei commented 1 month ago

I followed the instructions and the device is detected and it can read its states (charging, cleaning, docked), but I have no controls in HA and it just says the entity is unavailable. Any ideas? When added to Alexa through HA cloud I can control it

I think there is a bug where the initial state is always unavailable when you first set it up. Try using the official app to start a cleaning cycle, then see if the controls in HA start working.

Yes, this is because the vaccuum only starts reporting it's detailed state after start/stop of a cleaning cycle from the app, before that, no data is available and therefore the entity is also unavailable. After that initial use of the app the 'session' sticks, also in HA.

asportnoy commented 1 month ago

I'm not sure if that's the case. When you open the Eufy app, it knows it's connected and available right away and is able to load all that detailed information. Maybe some other API you need to implement?

Regardless, I think it might be a better UX to assume it's available when the device is set up initially. The UI controls are disabled if it's unavailable, which gives a poor experience as shown above. Especially if the user just set up the device, that would almost certainly mean it's available.

valkaholic commented 1 month ago

Got this to work for my L60, thank you!! I also have an L50 which seems nearly identical but it is not recognized. Any advice on how to port this over to the L50?

ddakotac commented 1 month ago

Amazing, thanks so much! Just go it working. Cheers maximoei!