šŸ”¹ Card-mod - Add css styles to any lovelace card

I am having trouble getting my senors to data value to change color to red if the humidity is below 30% and above 70% and temperature in red if temps go below 59F and above 70F but the ymal code i put is not working correctly to trigger the color changes this is one of 3 cards i want the trigger done on but its not working correctly i do have bot the card mod and the other card mod resources installed

type: entities
entities:

  • entity: sensor.museum_attic_southeest_humidity_level
    name: Humidity level
    style: |
    :host {
    ā€“paper-item-icon-color:
    {% if states(ā€˜sensor.museum_attic_southeest_humidity_levelā€™) | float < 30 or >70 % > ā€˜redā€™ %}
  • entity: sensor.museum_attic_southeest_temperature
    name: Temperature
    title: Museum - Attic Near Stairwell
    state_color: true

I would suggest you to follow forum rules when posting a code (formatting) and use punctuation marks, do not get me wrong. And use Dev tools ā†’ Template for testing your templates, they are wrong. Docs for templating.

Hi all,

As far a so understood only here are card mod questions allowed. :slight_smile:

Iā€™m trying to get a fully transparant background with a gradient towards the right boxing to grey ish.

card_mod:
  style: |
    ha-card {
      border-width: 0px !important;
      background-image: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,1));
}
    } 

But Iā€™m missing something as on the left there is still clearly ā€œsomethingā€ nor allowing the default dark bg from HA to show :slight_smile:

like this?

works with:

card_mod:
  style: |
    ha-card {
      background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,1));
    }

note the correct indent of the bottom }

also dont use background-image, as there is no image, only a color gradient, so use background

1 Like

How do I make my icons double the size

type: custom:minimalistic-area-card
title: Ripley's Room
area: baby_s_room
hide_unavailable: false
camera_image: camera.ripleys_room
camera_view: live
state_color: true
shadow: true
entities:
  - entity: sensor.ripleys_room_sensor_temperature
  - entity: sensor.ripleys_room_sensor_humidity
  - entity: sensor.ripleys_heater_plug_power
    icon: mdi:solid
    type: markdown

Not using this card, try this:

type: custom:minimalistic-area-card
title: xxxx
entities:
  - entity: sensor.xiaomi_cg_1_temperature
  - entity: sensor.xiaomi_cg_1_humidity
  - entity: sensor.xiaomi_cg_1_co2
    icon: mdi:car
card_mod:
  style: |
    ha-card {
      --mdc-icon-size: 40px;
    }

image
But you need to adjust other things like paddings/margins as well, so this code is merely a starting point.

1 Like

Exactly. Youā€™d better hop over to the dedicated Minimalistic card thread . Minimalistic is rediculously huge when it comes to their yaml config and modifications and needs special details all over
They might even have their own theme variables.

So go check that out

1 Like

It is also possible that some custom cards called ā€œminimalisticā€ are not related to that monstrous Minimalistic theme with tons of yaml settings. No idea about this particular minimalistic-area-card.
(I honestly see no benefits of this minimalistic-area-card in comparison to picture-glance or similar, but I only had a quick look at this custom card & most probably missed smth important)

I stand corrected. Please ignore what I wrote above about Minimalist

you are right this is GitHub - junalmeida/homeassistant-minimalistic-area-card: A minimalistic area card with sensors and buttons. and not to do with Minimalist cards / theme

I did play with this card before, and tried to use it for the exact use case you describe, replacing a picture-glance, but decided it was just not suited for my use case and went for the p-g in the end

2 Likes

Anyone a great idea on the above?

(The code is in the previous post)

This is the feed I get. I want to show only the lower part in the card.

you can not use anchors here.

you might be able to set variables (even per card or element) though and inject the variables into the configuration

a bit like this custom:button-card:

styles:
  custom_fields:
# create a color for the cpu element
    cpu:
      - padding-bottom: 2px
      - justify-self: start
      - --cpu-color: >
          [[[ var state = states['sensor.processor_use'].state;
              if (state < 10) return 'green';
              if (state < 25) return 'darkgreen';
              if (state < 45) return 'orange';
              if (state < 60) return 'maroon';
              return 'var(--alert-color)'; ]]]

and use that in the final makeup:

custom_fields:
  cpu: >
    [[[ return `<ha-icon icon=mdi:server style='width:12px;'> </ha-icon>
                Cpu: <span style='color: var(--cpu-color);'>
                ${helpers.localize(states['sensor.processor_use'])}</span>`; ]]]

aware this is not the same as your card, but the idea should help you check out if this can be done.

Have a little experience with cameras - may be some transformations are possible on a camera integration level?

I use this card because it allows me to put a frigate live camera feed as the background. so that way we can have a dashboard that tells us the temperature thermostat settings for our daughterā€™s bedroom. if thereā€™s an easier way to do it this is just the only way I can find to do it using the minimalistic card

as stated above: why not give the HA card the was designed for this a try: Picture glance card - Home Assistant

I donā€™t see anywhere in that documentation about adding a live video feed for the background unless itā€™s just not documented?

NM I was searching for video not camera i see the options nowā€¦ I will give this a try thank youā€¦ the title of this card is very misleading also :slight_smile: who would have thought that Picture at a glance would support video, duhhh

Are you maybe solving the wrong problem here? In other words, is this some sort of combined feed of two cameras?

to me, the main advantage is the display of the entities, that get colors according to their state, and not are the pale white color picture-glance makes them to be. (still dont get why that design decision was made btw, might be another good WTHā€¦ )
ahum: WTH Why dont entities in the picture-glance use their state-color

It is a camera that has two lenses and they are used simultaneously, (there is no way to cancel one of them) and the produced feed by default is this (again there is no way of changing that)