Picture-elements grid and relative size of state-badge and state-icon

Hi

I created a picture-elements “grid system”:

  • the background is a picture of A4-size (210x297mm x 300dpi = 3481 x 3509 pxl)
  • I created a “grid” in a way that you can easily position your icons
    • horizontal: starting at 5% with increment of 15% [5, 20, 35, 50, 65, 80, 95]
    • vertical: starting at 10% with increment of 10% [10, 20, 30, 40, 50, 60, 70, 80, 90]

Awaiting for a GUI to position your icons, this makes it a little bit more easy to work with the yaml file

In example, this becomes

  - title: x
    path: x
    badges: []
    cards:
      - type: picture-elements
        image: /local/floorplan/plans/pvo4/AR-1___.png?version=2022-08-08
        elements:
          - type: state-badge
            entity: light.my_l07
            tap_action:
              action: toggle
            double_tap_action:
              action: more-info
            style:
              top: 10%
              left: 5%
              height: 9%
              overflow: hidden
          - type: state-badge
            entity: light.my_l31
            tap_action:
              action: toggle
            double_tap_action:
              action: more-info
            style:
              top: 10%
              left: 20%
              height: 9%
              overflow: hidden
          - type: state-badge
            entity: light.my_l28
            tap_action:
              action: toggle
            double_tap_action:
              action: more-info
            style:
              top: 10%
              left: 35%
              height: 9%
              overflow: hidden

and the result could be:

So you have a grid of 7 x 9 = 63 entities to show.
This could be useful to have a dashboard to show a lot of states…

You can use more, u can use less entities, but this configuration has some advantages:

  • “round” numbers to position your icons
  • works on browser but also on mobile view / app (tested on an old iPhone SE with 4inch screen…)
  • you can position exactly in the middle (50%,50%)
  • uses A4 paper format, so easily to convert a PDF (floorplan of your house i.e.) to this format.
    This is how I work: If there are some modifications in my home, I generate a new floorplan to PDF, export it as png and update this picture on HA. I u are consistent with scale and position of the image, the icons will stay correct positioned )

Now I have following questions:

kind regards,
Bart

ps: here is the native grid:

1 Like

Let me quote myself:

A possible solution is using two different views for a PC & mobile.

Hi @Ildar_Gabdullin
I know, but with the above mentioned settings, it “works” on “most” devices. Feel free to use other settings, but for my environment it works on laptop, iPad, iPhone etc…

Remains the question how to “relative scale” state-icon and state-badge…

grtz
B

Nobody says “it does not work”.
The problem in the topic above was with scaling/placing - isn’t it same as yours?