PiotrMachowski / lovelace-xiaomi-vacuum-map-card

This card provides a user-friendly way to fully control map-based vacuums in Home Assistant. Supported brands include Xiaomi (Roborock/Viomi/Dreame/Roidmi/Valetudo/Valetudo RE), Neato, Wyze, Roomba, Ecovacs (and probably more).
MIT License
1.41k stars 246 forks source link

Feature Request: Option to rotate the rectangle in the Zone cleanup #134

Open tykarol opened 2 years ago

tykarol commented 2 years ago

Description

The Xiaomi Home app for the Viomi Vacuum V8 (STYJ02YM) has an option to rotate the selected cleanup area. I forked the KrzysztofHajdamowicz/miio2 integration incl. for test a new service that directly uses the 4 points it passes to the cleaning area. The tests show that it works for a rotated rectangle (if it is not a rectangle, then in the mobile application you can see the rectangle in an incorrect position/rotation and I have not yet fully verified whether it will clean properly the area based on points - but probably yes).

Why do I need it? I have a corner apartment with walls and rooms at an angle of 45 degrees. (I can send the map in a PM if necessary).

Here is the service I use for that: https://github.com/tykarol/home-assistant-viomi-vacuum-v8/blob/master/custom_components/viomi_vacuum_v8/services.yaml#L14

And here is how the points ware passed to vacuum service (it is based on the clean zone method): https://github.com/tykarol/home-assistant-viomi-vacuum-v8/blob/master/custom_components/viomi_vacuum_v8/vacuum.py#L505

Solution

Adding option to rotate rectangle - add the rotate icon eg. on the left top corner like resize and close icons if in the platform template this option is enabled. When run then pass the 8 numbers to the template to use in it in the service. Format: [x1,y1,x2,y2,x3,y3,x4,y4].

It would be nice if there was also an option to create any quadrilateral (the option to move each of the 4 corners). Then I could check if the vacuuming is working properly in this case much easier.

Alternatives

No response

Context

No response

PiotrMachowski commented 2 years ago

I will consider adding it in future releases 👍