Add image on left of a card and resize

Hi everyone, I wanted to add a photo and resize it, next to the “Raccolta differenziata” card but I can’t.

I tried to upload it but I can’t resize the photo.

Yaml code:

type: vertical-stack
cards:
  - type: custom:digital-clock
  - show_current: true
    show_forecast: true
    type: weather-forecast
    entity: weather.casa
    theme: ios-dark-mode
  - type: entities
    entities:
      - entity: sensor.rifiuti
        name: 'Oggi si esce:'
        icon: mdi:trash-can-outline
    theme: ios-dark-mode
    title: Raccolta Differenziata

Thank you

do you mean resize by putting it in a horizontal-stack?

type: vertical-stack
cards:
  - type: custom:digital-clock
  - show_current: true
    show_forecast: true
    type: weather-forecast
    entity: weather.casa
    theme: ios-dark-mode
  - type: horizontal-stack
    cards:
      - type: # picture here
      - type: entities
        entities:
          - entity: sensor.rifiuti
            name: 'Oggi si esce:'
            icon: mdi:trash-can-outline
        theme: ios-dark-mode
        title: Raccolta Differenziata

Thank you,
is it possible to enlarge the tab next to the image? so it doesn’t read

image

Try using an entity card (rather than an entities card with only one entity).

- type: horizontal-stack
  title: Raccolta Differenziata
    cards:
      - type: # picture here
      - type: entity
        entity: sensor.rifiuti
        name: 'Oggi si esce:'
        icon: mdi:trash-can-outline

It works! but…


How can I make the smallest photo?

[image]

Yep. That is a little large!

If you use custom:button-card, you can specify the size of the icon,

forgive my ignorance. I already have custom-button-card, but I can’t edit the yaml code.

type: vertical-stack
cards:
  - type: markdown
    content: Benvenuto, 
    theme: kibibit
  - type: custom:digital-clock
  - show_current: true
    show_forecast: true
    type: weather-forecast
    entity: weather.casa
    theme: ios-dark-mode
  - type: entities
    entities:
      - entity: sensor.rifiuti
        name: 'Oggi si esce:'
        icon: mdi:trash-can-outline
    theme: ios-dark-mode
  - type: horizontal-stack
    title: Raccolta Differenziata
    cards:
      - type: picture
        image: \local\raccolta-differenziata\cart.png    
      - type: entity
        entity: sensor.rifiuti
        name: 'Oggi si esce:'
        icon: mdi:trash-can-outline

morning here now…

You can, but it is yaml only - if you edit it you should see the yaml on the LHS. Try copy/pasting this:

type: custom:button-card
entity: sensor.rifiuti
name: 'Oggi si esce:'
show_entity_picture: true
entity_picture: \local\raccolta-differenziata\cart.png
size: 20px

Ok it work!

type: custom:button-card
layout: icon_label
theme: ios-dark-mode
show_entity_picture: true
entity_picture: \local\raccolta-differenziata\cart.png
size: 50px
entity: sensor.rifiuti
label: |
  [[[
    return ' ' + states['sensor.rifiuti'].state;
  ]]]
show_label: true
show_name: false

but…

The theme doesn’t apply to me
image

I don’t use themes, but I am pretty sure it doesn’t go inside a card.

Edit your dashboard in the UI and then edit the view you are using. You should see theme there…

Thank you

I’ll try it as soon as I get home. Could you recommend me a guide where to learn yaml? I already know python and C#

YAML is ‘only’ a markup language. The one thing to note is that it is extremely fussy over indents - pay attention to them.

I learned by trial and error playing with homeassistant. The docs always show the yaml equivalent of all their integrations etc (as do HACS etc) so it’s quite easy to get up to speed. The templating engine is Jinja2 (so basically Python) and so hopefully will come easy to you.

Thank you

latest question:

type: custom:button-card
layout: icon_label
theme: ios-dark-mode
show_entity_picture: true
entity_picture: \local\raccolta-differenziata\cart.png
size: 50px
entity: sensor.rifiuti
label: |
  [[[
    return ' ' + states['sensor.rifiuti'].state;
  ]]]
show_label: true
show_name: false

how can i insert a control saying:

if states['sensor.waste'].state == Plastic
 replace image with entity_picture: \local\sorted-collection\PLASTIC.png

???

I’ll need to check when I get home, but it will be something like this:

entity_picture: |
  [[[
   if (states['sensor.waste'].state == 'Plastic') return '\local\sorted-collection\PLASTIC.png'
   else return '\local\raccolta-differenziata\cart.png'
  ]]]

[edit: we were both posting at the same time and you split your post in two so I ended up replying to myself! :rofl:]

btw, that can be put on one line by enclosing in double-quotes:

label: "[[[ return ' ' + states['sensor.rifiuti'].state ]]]"

Ops, sorry!

Thank you but the image doesn’t show:

type: custom:button-card
layout: icon_label
theme: ios-dark-mode
show_entity_picture: true
entity_picture: |
  [[[
   if (states['sensor.rifiuti'].state == '🟢 Vetro') return '\local\raccolta-differenziata\cart.png'
   else return '\local\raccolta-differenziata\cart.png'
  ]]]
size: 50px
entity: sensor.rifiuti
label: '[[[ return '' '' + states[''sensor.rifiuti''].state ]]]'
show_label: true
show_name: false

try 3 equal signs

entity_picture: |
  [[[
   if (states['sensor.rifiuti'].state === '🟢 Vetro') return '\local\raccolta-differenziata\cart.png'
   else return '\local\raccolta-differenziata\cart.png'
  ]]]

Doesn’t work :frowning:


maybe what I wanted to do can’t be done. I read on the internet that it only works for icons. Request: if I use the icon, can I color it?
if state == Plastic
// set the yellow icon…
etc…

yes, you can absolutely set the colour. Have you read the docs though - it’s all laid out there…

…and this is also a way to sent the entity_picture

  state:
    - value: `Plastic'
      entity_picture: /local/...
      styles:
        icon:
          - color: yellow
1 Like