As getting a basic floorplan is now doable in Lovelace using picture-elements, getting the right % coordinates for items was becoming a problem. Nobody likes to guess and refresh and guess again!
Here is a helper addon (Warning - it only works on Chrome), that lets you just hover your mouse on top of your Floorplan image in Home Assistant and it will show you the coordinates in %.
If you don’t use panel: true you can go minimal setup:
- type: custom:plan-coordinates
Reload your Lovelace tab (no need to restart Home Assistant or other things) and now when you hover your floorplan you should see the coordinates appear on the right.
I have this enabled, but the coordinates are off for me. Does the image have to be certain size for this to work? I also notice if the iframe panel is open or closed it changes the coordinates.
@Mathoosala Coordinates provided by plan-cooridnates are accurate, however there might be a difference when picture-elements renders. If the picture elements uses % to position the center of the element than coordinates might seem a bit off. Image doesn’t have to be a certain size, as everything is in %, so even if it scales differently, the % on that axes stay constant.
Can you make a video of the resize problem? I can’t seem to reproduce. I tried it with left hand menu (if that is what you call iframe panel).
@Mathoosala are you zooming in (ctrl+mouse wheel)? I’ve noticed that the percents are off when you aren’t at 100% zoom on the page. I tend to zoom alot and it bit me once or twice.
@onkytonk Great examples! My project was to get people up and running faster when they keep tweaking to avoid having to swap tools, however there are many quirks to the solution and a setup using and actual image processing software is far more accurate. Thanks for sharing!
@ciotlosm: i also have different coordinates. If i open/close the hamburger menu it changes the coordinates. Same when resizing the chrome browser. Icons don’t map to the correct place either when trying it.
You must be using chrome. You also have to reset any custom zoom level (ctrl+0). Coordinates are relative to the image corner, so things like hamburger menu changes should not influence coordinates.
Using 100% zoom (normal level) and using chrome. Also notice that if you move around the image from the top it jumps a bit downwards too. Perhaps i should test a smaller image (just for testing sake)