PiotrMachowski / Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor

This custom integration provides a way to present a live view of a map for Xiaomi (Roborock/Viomi/Roidmi/Dreame) vacuums without a need for rooting.
MIT License
1.15k stars 122 forks source link

Image instead of robot #174

Closed Stef-90 closed 2 years ago

Stef-90 commented 3 years ago

Since it generates predicted path, I assume, direction of the robot is known property. It would be great visually to have picture of the actual robo instead of colored circle.

PiotrMachowski commented 3 years ago

Maybe I will add it someday ;)

Xitro01 commented 2 years ago

Looking for this as well, I know that someone already managed to do this: https://github.com/matt8707/hass-config/issues/55

rospogrigio commented 2 years ago

I developed this, have a look if you are interested: https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/pull/246 . 😉

axcs commented 2 years ago

I tried to clone the DEV branch, but I don't know why the map didn't appear, it gave errors in functions that had "vacuum_pos.a"

rospogrigio commented 2 years ago

I tried to clone the DEV branch, but I don't know why the map didn't appear, it gave errors in functions that had "vacuum_pos.a"

Mmmm I see, maybe your robot does not provide the orientation. Try replacing a = None with a = 0in xiaomi/map_data_parser.py, line 169

PiotrMachowski commented 2 years ago

I am aware of this issue, it will be addressed 👍

PiotrMachowski commented 2 years ago

Or you (@rospogrigio) can do it if you want to

rospogrigio commented 2 years ago

I'm a bit busy at the moment, so feel free to fix it the way you find the most suitable...

axcs commented 2 years ago

I tried to clone the DEV branch, but I don't know why the map didn't appear, it gave errors in functions that had "vacuum_pos.a"

Mmmm I see, maybe your robot does not provide the orientation. Try replacing a = None with a = 0in xiaomi/map_data_parser.py, line 169

I try this, but it didn't work, I have a Viomi, I don't know if it affects. The error:

image_handler.py", line 204, in draw_func a1 = (vacuum_pos.a + 104) / 180 * math.pi TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'

Nothing is urgent, I was just testing and trying to help, my knowledge is still at the beginning

rospogrigio commented 2 years ago

Then in viomi/map_data_parser.py, line 323, try replacing return Point(x, y) with return Point(x, y, 0) in viomi/map_data_parser.py, line 169

PiotrMachowski commented 2 years ago

@rospogrigio @axcs It should be fixed on dev now: https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/commit/410aaaf21e448495cb27eacffaa579b1124885e9

axcs commented 2 years ago

@rospogrigio @axcs It should be fixed on dev now: 410aaaf

Only with this new fix in DEV it didn't work again. In addition to your fix, it was necessary to change the line that rospogrigio said in viomi/map_data_parser.py didn't you miss implementing the orientation for viomi vacuum cleaners? I just passed the parameter to 0, but is there no way to get the orientation like xiaomi?

PiotrMachowski commented 2 years ago

@axcs does current version work? https://github.com/PiotrMachowski/Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor/commit/d0b1eb3402cbd14b7a5a78b61991ee69cd14e9f7

axcs commented 2 years ago

@axcs does current version work? d0b1eb3

Yeh it works, thanks @PiotrMachowski . There is no way to implement rotation for viomi. I have the viomi STYJ02YM In the Mi Home application, the rotation works, the image of the vacuum cleaner rotates to the position it is on. And from the little I understand from the code, is there a way to rotate this for xiaomi devices, can't you replicate it for viomi?

PiotrMachowski commented 2 years ago

It might be possible, I need to take a look at raw map data

axcs commented 2 years ago

Ok thanks,, I will try to understand the code to try to help in some way. However if you can help with tests just answer that I help. I believe it is not difficult to do something the same way as it was done for the xaiomi files

PiotrMachowski commented 2 years ago

@axcs it's really easy if data is there. Unfortunately right now I don't have much free time

PiotrMachowski commented 2 years ago

@axcs I have added this feature to viomi 👍

PiotrMachowski commented 2 years ago

Added in v2.2.0

Xitro01 commented 2 years ago

Added in v2.2.0

It works just by updating and it's bloody awesome! Thanks a lot.