Show off your picture-elements uses

Hi,
I have a little issue with the alignment of the label elements in my picture-element card. Here is my code:

- type: picture-elements
              image: /local/lovelace/images/top_section.png
              elements:
                - type: state-icon
                  entity: sensor.ha_update_available
                  tap_action:
                    action: navigate
                    navigation_path: /lovelace/0
                  style:
                    top: 5%
                    left: 3%
                    transform: scale(1.5,1.5)
                - type: custom:text-element
                  text: "HASS.io"
                  style:
                    top: 21%
                    left: 11%
                    font-size: 20px
                    font-weight: bold
                - type: state-label
                  entity: sensor.ha_installed_version
                  style:
                    top: 43%
                    left: 11%
                - type: state-label
                  entity: sensor.ha_last_reboot
                  style:
                    top: 64%
                    left: 11%

all labels are aligned from left: 11px, However, on the screen it seems as the elements are aligned as center to each other. ā€¦
align
How can I align all three elements to the left?

Each element has a ā€œcenter pointā€ which is by default at the real center of the element.
And position of each element (top, right) is defined for the center.
That is why all text labels are placed aligned centrally.
To prevent this use:
transform: translate(0,0)
By default transform = translate(-50%,-50%).

Have a look at this:

type: vertical-stack
cards:
  - type: picture-elements
    image: /local/images/blue.jpg
    elements:
      - type: state-icon
        entity: sensor.ha_version_latest_haio
        style:
          top: 5%
          left: 3%
          transform: 'scale(1.5,1.5)'
      - type: state-label
        entity: sensor.ha_version_latest_haio
        style:
          top: 21%
          left: 11%
          font-size: 20px
          font-weight: bold
      - type: state-label
        entity: sensor.rpi_last_boot_formatted
        style:
          top: 64%
          left: 11%
      - type: state-label
        entity: sensor.ha_version_current
        style:
          top: 43%
          left: 11%
      - type: state-label
        entity: sensor.rpi_last_boot_formatted
        style:
          top: 64%
          left: 11%
  - type: picture-elements
    image: /local/images/blue.jpg
    elements:
      - type: state-icon
        entity: sensor.ha_version_latest_haio
        style:
          top: 5%
          left: 3%
          transform: 'translate(0,0) scale(1.5,1.5)'
      - type: state-label
        entity: sensor.ha_version_latest_haio
        style:
          top: 21%
          left: 11%
          font-size: 20px
          font-weight: bold
          transform: 'translate(0,0)'
      - type: state-label
        entity: sensor.ha_version_current
        style:
          top: 43%
          left: 11%
          transform: 'translate(0,0)'
      - type: state-label
        entity: sensor.rpi_last_boot_formatted
        style:
          top: 64%
          left: 11%
          transform: 'translate(0,0)'

2 Likes

perfect. it works! thanks

Almost 2 years and a few hour of smart home hobbying, you might say itā€™s getting (way too) crowded :slight_smile:
Guess I just like a total overview in addition to the room-by-room cards.

2 Likes

Did you ever figure out what was causing the hui-picture-elements-card error?

Iā€™ve been getting the same thing. It works once, then whenever I refresh the page, it causes the error again.

From what I remember itā€™s some kind of cache issue.
I installed a custom component from hacs called ā€œLovelace Card Preloaderā€
And then in my raw configuration I entered which cards I wanted pre loading like it mentions in the documentation.
From what I remember though I had to delete all the cache from the browser and force close etc.
Iā€™ve stopped using it now though as I could never get the avatars changing correctly and my wife wasnā€™t keen on every road and movement being displayed :laughing:

I have been using the Material interface since day one, it completely changed the game for LMS

Now its most definitely the best server/interface combo around, specially with PicorePlayer its fast reliable the sound is incredible too I tweaked the DSD and the sox filters etcā€¦ I have some of the best sounding audio iā€™ve heard in my house plus it looks good!

1 Like

A while ago I showed my floorplan which has now evolved into a more sophisticated user friendly interface. I just made a YouTube video demonstrating this and I hope the reception will be positive in which i can start looking at future videos involving tutorials also.

22 Likes

Please share how you did those sprinkler schedules, they look so awesome!!!

Hi all!
Iā€™m trying to show a blinking warning notification when a binary sensor is active using an image inside a picture elements. I have the code below but it doesnā€™t work. Does anyone know how to do it?

type: picture-elements
image: 'https://demo.home-assistant.io/stub_config/floorplan.png'
elements:
  - type: image
    entity: binary_sensor.alarm
    style:
      top: 35%
      left: 49%
      animation: blink 2s linear infinite

    state_image:
      'on': /local/images/icon-alert.png

Code available on Github

7 Likes

That is AWESOME! I think my head might explode trying to piece it together, but Iā€™m gonna give it my best shot! Thanks!

Using your hints Iā€™m getting closer and closer!
Still have to work on backgrounds and colors etc (currently no access to photoshop)

2 questions, would you know the image got in the grey scale ? config exactly like yours, would it be something in Lovelace ?

second, would you mind sharing what is behind `

sensor.mike_in_bed

motion sensor ? light ? geo ?

appreciate!
thanks

Steve, did you resolve the issue with the Piccture in the grey scale :)?

Not really no.
I gave up on that type of card as I couldnā€™t figure things out in my head :laughing:
I just use a basic non changing avatar picture now with the status zone location underneath.
I think it may have been some kind of state overlay causing it.

1 Like

My old kindle fire 7 doesnā€™t allow any custom cards, so the only way I found to build a decent dashboard with the stock lovelace tools was by creating a picture-elements card that coverered the whole screen and set all the elements on top of that picture. The picture in the botton is just a black screen same size as the kindleā€™s screen. All the elements on top are picture elements.

1 Like

Here is my main dashboard based on picture-elements. I have tried to collect as many information possible but still keeping the look nice and neat. Several conditional elements are also active, for example, when a dimmer is switched an additional icon appear to adjust the level, or when the lights are on consumed power is visualized.
Any feedback is welcome.

1 Like

Somehow, managed to get it working :wink:

card:
  cards:
    - elements:
        - entity: ${'device_tracker.life360_' + vars[0]}
          image: >-
            "${states['sensor.' + vars[0]
            +'_status'].attributes['entity_picture']}"

I replaced entity directly

card:
  cards:
    - elements:
        - entity: device_tracker.life360_your_name
          image: >-
            "${states['sensor.' + vars[0]
            +'_status'].attributes['entity_picture']}"

6 Likes

Can I ask 1 question. What does peopleā€™s cards look like when on a mobile device compared to laptop ?

I tried a basic card but when I checked it on my phone, the card was out of alignment.

All I had was an image background and the version and installed version of HA on it as a test

Thanks

Martyn