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
898 stars 112 forks source link

Allow rendering robot icon only, with no rooms #622

Closed Maudfer closed 4 months ago

Maudfer commented 4 months ago

Hi! This integration is amazing, very well done. I've been playing around with it and my Floorplan in the Picture-elements card recently, to some very interesting results: image

It would be great to have either a way to render only the robot, without the rooms (maybe only the robot and its path). Or maybe having some exposed attributes from where I can get the robot coordinates relative to the map.

I've tried some experiments to make do with what the integration currently exposes, I was trying to subtract pixels between the Saved Map and Current Map entities using CSS, to achieve a similar effect, but wasn't able to.

Anyway, this is not high priority, just something fun I've been playing with, and want to give you the idea, if it's easy to do. Great work on this and thanks!

Maudfer commented 4 months ago

Btw, for those interested, here's how it looks without the vacuum map overlayed, for reference image

Tasshack commented 4 months ago

There is the transparent option in the color scheme configuration options but the problem with that is it will make all of your maps transparent not just the one you put into your floorplan.

Custom card that I am making will support transparent map rendering with only selected objects but it is still work in progress. https://github.com/Tasshack/dreame-vacuum/issues/466

By the way, camera entity already has all of the object coordinates but those are in map coordinates not px values. To convert the coordinates to pixel values you also need to use three point calibration data that is also present in the entity attributes.

Maudfer commented 4 months ago

Ohh, thank you @Tasshack! Those are both useful bits of information, I didn't know about the camera attributes. I think I can work on those. All I need is a percentage value relative to the full map size.

Tasshack commented 4 months ago

All I need is a percentage value relative to the full map size.

Its not that simple.

tungmeister commented 4 months ago

@Maudfer I've done this by customising the integration to create a couple of additional cameras so I can have an overlay camera map (for room names) and a camera map that just shows the robot and path: image He's a screenshot from before I created the second additional cameras for the room overlays: image I can share my modified version with you if you'd like.

Maudfer commented 4 months ago

Whoa, this looks AMAZING. I love what you did with the 3D there as well! Would you share the customized version of the integration, indeed, please?

In the last few days I was experimenting with creating a custom integration that loads the camera entity from @Tasshack 's integration as an input, grabs the vacuum position and calibration data, and then outputs another entity with the calculated position values. But I've yet to get it to work.

But now I'm thinking I like your approach better! @tungmeister

tungmeister commented 4 months ago

@Maudfer dreame_vacuum.zip Just extract and paste over your existing integration folder. you'll then get additional config options in the integration settings where you can pick the objects you want visible on the additional maps, set the color scheme to transparent for the additional maps: image

Maudfer commented 4 months ago

Thank you so much @tungmeister ! I'm gonna try it as soon as I finish work for the day

Don't you wanna put this into a proper fork? Then it would be possible for people to download it from HACS

But thanks anyway, this solves my problem completely.

I was trying to apply an affine transform on the coordinates vacuum coordinates using python and the calibration data, but could never get it to align correctly, since I have the camera entity scaled on my floorplan.

Maudfer commented 4 months ago

@tungmeister Thank you so much dude! This is freaking amazing!

image

A tip if anyone sees this and wanna try it, first download the beta version of Dreame Vacuum (v2.0.0b15) from HACS, then extract @tungmeister's files on top of it.

tungmeister commented 4 months ago

@Maudfer I have a fork, it's just not up to date and I didn't have time yesterday to sort it so uploaded my files directly for you. Glad it's working!

IdiotTryingToFindWay commented 4 months ago

@Maudfer I have a fork, it's just not up to date and I didn't have time yesterday to sort it so uploaded my files directly for you. Glad it's working!

So assume i'm an idiot. if i just copy the files in to the integration does it create a map as above but to my rooms layout? i havent created a floorplan map or anything.

Maudfer commented 4 months ago

@IdiotTryingToFindWay No, what this modified version of the integration does is just expose a separate version of the vacuum map as a new Home Assistant entity, that you can configure to be just the floating robot on a transparent background, for example.

Then if you want to do what I did, you have to create a floorplan of your house (in photoshop, for example), and superimpose the map image on top of the floorplan image. The very first picture I posted on this thread shows how it looks if I put the original vacuum map on top of the floorplan I created, while the last image shows how it looks using @tungmeister's modified version.