Tasshack / dreame-vacuum

Home Assistant integration for Dreame robot vacuums with map support
https://community.home-assistant.io/t/custom-component-dreame-vacuum
MIT License
879 stars 110 forks source link

goto is not working (with Dreame D9) #737

Open jlssmt opened 1 month ago

jlssmt commented 1 month ago

Hello,

Describe the bug I have installed latest Beta v2.0.0B16. The goto feature is not working with my Dreame D9. I send following command to my device:

action: dreame_vacuum.vacuum_goto
target:
  device_id: XXXXXXXXXXXXXXXXXXXXXXX
data:
  x: 2468
  y: -4428

Vacuum is answering me the following:

"start zone cleaning"
"unable to reach the specified area"
"please try to clear obstacles in the path"
"returning to the dock to charge"
"paused"

the button of the service is green: image

To Reproduce

Expected behavior The vacuum should go to a specific coordinate and stop there until further commands.    

Screenshots no    

Additional Information (please complete the following information)

Tasshack commented 1 month ago

Your vacuum does not internally have a go to feature like the vacuums has streaming capability. Integration sends a 5cm² cleaning area and stop command to make go to possible for these vacuums. This method has been tested on Z10/L10 and works without an issue. The beaviour you are describing is the same when you try to use area coordinates that the vacuum cannot reach.

So there are two options;

Problem is I cannot reproduce the issue and I cannot test any modification, what is your suggestion about this?

jlssmt commented 1 month ago

Since I don't think that it's because I send wrong coordinates (see cause above): Can you tell me how to test a bigger area with my setup, please? 😊

Tasshack commented 1 month ago

You need to edit this line; https://github.com/Tasshack/dreame-vacuum/blob/dev/custom_components/dreame_vacuum/dreame/device.py#L4000

Like this; size = 100

50 is the minimum can be set and also the max resolution of the map coordinate system. 50 / 10 = 5.0 cm

So 100x100 px map image represents 5 square meters of area.

jlssmt commented 1 month ago

I changed to 100. Then restarted HASS. Didn't work. Same voice responds like before.

I also tried 75, 150 and 500. But without restart. Do I need to restart after every change? (BTW: my HASS runs in Docker Container)

jlssmt commented 1 month ago

forget my previous message. i set only the else part. it's working with 100 if line 4000 is like this: size = 100

Tasshack commented 1 month ago

If it works with 100 then I can update the integration, it is not much difference between 5cm and 10cm for operation of the go to feature. Your device firmware probably uses < symbol for checking the area coordinates instead of <= like mine so it cannot find valid a point when coordinates are set to 50x50 because that means 0x0 square cm area for it.

Tasshack commented 1 month ago

You should also be seeing a marker on the map image generated by the integration (for a brief period of time). You can confirm your coordinates from the image like that too.

jlssmt commented 1 month ago

yes. i can see the marker on map. i updated my message above. i accidentially wrote 50.

it works if line 4000 is: size = 100  

it's not (!!!!!) working if line 4000 is: size = self.status.current_map.dimensions.grid_size if self.status.current_map else 100

Tasshack commented 1 month ago

it's not (!!!!!) working if line 4000 is:

Yes because if statement returns left side of the argument.

It should be like this because 50 is the grid_size and 100 is grid_size * 2 size = (self.status.current_map.dimensions.grid_size * 2) if self.status.current_map else 100

100 is for fallback in case of the integration does not have the current map data for some reason.

Tasshack commented 1 month ago

Can you also try values between 50 and 100 like 55 or 80?

Like;

size = 55
size = 80
jlssmt commented 1 month ago

size = 55 also works

Tasshack commented 1 month ago

There are several other places that needs to be edited for handling virtual go to markers like cleaning history maps so I have made the changes according to your results. I have also used 56 instead of 55 to prevent floating points when dividing it to half.

You can update this file and rest of it should work properly. device.zip

jlssmt commented 1 month ago

the goto service is working with your zip file. anything else I should test?

Tasshack commented 1 month ago

Thanks for your help. I will close the issue when a new Beta version has been released.

jlssmt commented 1 month ago

Thank you very much for your work! This custom_component is the best innovation for my smart home in a few months!

I also posted an idea how to improve this even more: https://github.com/Tasshack/dreame-vacuum/issues/739