Custom card: Room Card

Is there any way to override the state that is when 0.0 state should be idle
image

          type: custom:room-card
title: Laundry Room
card_styles:
  '--ha-card-header-font-size': 15px;
entity: switch.hallway
icon: mdi:washing-machine
show_icon: true
state_color: true
tap_action:
  action: toggle
entities:
  - entity: input_number.washer_value
    name: Washer
    show_icon: true
    show_state: true
    icon:
      conditions:
        - condition: equals
          value: '0.0'
          icon: mdi:dishwasher-off
          styles:
            color: blue
        - condition: equals
          value: '10.0'
          icon: mdi:dishwasher
          styles:
            color: orange
        - condition: equals
          value: '20.0'
          state: Cycle Done
          icon: mdi:dishwasher
          styles:
            color: red
  - entity: input_number.dryer_value
    name: Dryer
    show_icon: true
    show_state: true
    icon:
      conditions:
        - condition: equals
          value: '0.0'
          icon: mdi:tumble-dryer-off
          styles:
            color: blue
        - condition: equals
          value: '10.0'
          state: Drying
          icon: mdi:tumble-dryer
          styles:
            color: orange
        - condition: equals
          value: '20.0'
          state: Cycle Done
          icon: mdi:tumble-dryer
          styles:
            color: red
  - entity: binary_sensor.washer_door_2
    show_icon: true
    show_state: true
    name: washer Door
    icon: mdi:door-closed
    state_color: true
  - entity: binary_sensor.dryer_door
    show_icon: true
    show_state: true
    name: washer Door
    icon: mdi:door-closed
    state_color: true
  - entity: sensor.washer_vibration_pulse_rate_2
    show_icon: true
    show_state: true
    name: Vibration
    icon: mdi:vibrate
    state_color: true

Amy chance to get dimmers working on this card?
I only can toogle on/off. Setting the lights to any value bewteen 0 % - 100 % would be great.

Same behavior for covers would be nice.

Any help would be appreciated I am rather new to this. I have a room-card that I want to conditional change color from green when Charging to blue when not. Here is my current code.

type: custom:room-card
title: ‎‎Olen's iPhone  
icon: mdi:cellphone
show_icon: true
content_alignment: center
tap_action:
  action: toggle
entities:
  - entity: sensor.pyro187_battery_level
    name: Battery
    show_state: true
    state_color: true
  - entity: sensor.pyro187_battery_state
    name: Battery State
    show_state: true
    state_color: true
  - entity: sensor.pyro187_connection_type
    name: Connection
    show_state: true
    state_color: true
  - entity: binary_sensor.pyro187_focus
    name: Focus
    show_state: true
    state_color: true
  - entity: sensor.pyro187_steps
    name: Steps
    state_color: true
    show_state: true

I’m really liking the room card and learning along the way. How do I move the info entity closer to the corner of the card or at least align it with the title?

Card

type: custom:room-card
title: Office
card_styles:
  '--ha-card-header-font-size': 20px
color: default
entity: light.office_group
icon: mdi:lightbulb-group
show_icon: true
entities:
  - entity: light.game_room_l
    name: Hue R
    show_icon: true
  - entity: light.game_room_r
    name: Hue L
    show_icon: true
  - entity: light.signe_gradient_floor_1
    name: Signe
    icon: mdi:floor-lamp
    show_icon: true
  - entity: light.elgato_bw21k1a03291
    name: Elgato
    icon: mdi:light-flood-down
    show_icon: true
info_entities:
  - entity: light.office_group
    name: Light Group
    icon: mdi:lightbulb-group
    show_icon: true
    tap_action:
      action: toggle

Hi.
How to change the color of text in info entities depending on its value (e.g. temperature or humidity)
I try this, but not work.

info_entities:
  - entity: sensor.0x00158d000913e52e_humidity
    template:
      styles: >
        if (entity.state <= 55) return 'color: green';  if (entity.state <=
        45) return 'color:blue'; else return 'color: red';

Ok.
I find solution: chichi1976

That’s how I create the value dependent colors for humidity and temps. You need to keed the correct order of the >= statements from biggest to smallest value!

- entity: sensor.az_hygro_humidity
    format: precision0
    styles:
      template: >
        if (entity.state < 40) return 'color: orange'; if (entity.state >=
        70) return 'color: red'; if (entity.state >= 55) return 'color:
        orange'; if (entity.state >= 40) return 'color: green';
  - entity: sensor.az_hygro_temperature
    format: precision1
    styles:
      template: >
        if (entity.state < 20) return 'color: blue'; if (entity.state >= 24)
        return 'color: red'; if (entity.state >= 22) return 'color: orange';
        if (entity.state >= 20) return 'color: green';

@marcokreeft87 . I would like to change the state of sensors that report open and closed instead of on and off as you can see in the screenshot:
image
I did change the device class but still show as off or on.
here is the code for the card:

type: custom:room-card
title: Garage
entity: switch.garage
icon: mdi:garage-variant
show_icon: true
entities:
  - entity: switch.garage
    name: Ceiling
    show_icon: true
    show_state: true
    icon:
      conditions:
        - condition: equals
          value: 'on'
          icon: mdi:ceiling-light
          styles:
            color: yellow
            animation: blink 0.75s ease infinite
        - condition: equals
          value: 'off'
          icon: mdi:ceiling-light
          styles:
            color: default
    tap_action:
      action: toggle
  - entity: switch.zooz_zen15_power_cord_freezer
    name: Freezer
    show_icon: true
    show_state: true
    icon:
      conditions:
        - condition: equals
          value: 'on'
          icon: mdi:fridge-industrial
          styles:
            color: green
        - condition: equals
          value: 'off'
          icon: mdi:fridge-industrial-alert
          styles:
            color: red
  - entity: switch.unifyplug_switch
    name: UnifySwitch
    show_state: true
    show_icon: true
    icon:
      conditions:
        - condition: equals
          value: 'on'
          icon: mdi:wifi-check
          styles:
            color: green
        - condition: equals
          value: 'off'
          icon: mdi:wifi-alert
          styles:
            color: red
  - entity: binary_sensor.garagedoor_sensor_iaszone
    name: Door
    show_icon: true
    show_state: true
    icon:
      conditions:
        - condition: equals
          value: 'on'
          icon: mdi:garage-open
          styles:
            color: red
        - condition: equals
          value: 'off'
          icon: mdi:garage-lock
          styles:
            color: green
  - entity: light.foscamgarage_light
    icon: mdi:ev-plug-ccs1
    show_icon: true
    show_state: true
    name: CamPlug
    tap_action:
      action: toggle
  - entity: binary_sensor.freezerdoor_iaszone
    name: DoorFreez
    show_icon: true
    show_state: true
    icon:
      conditions:
        - condition: equals
          value: 'off'
          icon: mdi:fridge-industrial
          styles:
            color: green
        - condition: equals
          value: 'on'
          icon: mdi:fridge-industrial-alert
          styles:
            color: red
cards:
  - type: custom:mini-media-player
    entity: media_player.garage_echo_show
    info: scroll
    artwork: material
    show_states:
      - playing
info_entities:
  - entity: sensor.garagedoor_sensor_battery
    name: Battery
    show_state: true
  - entity: binary_sensor.garagedoor_sensor_iaszone
    show_state: true
  - entity: sensor.garagedoor_sensor_temperature
    show_state: true

And here is a screenshot of the entity card by itself:
image

Are you sure thats the same sensor?
I mean the card gets the value of off apparently from HA.

Hello, I apologize for my confusion, but how can you change the font size of the entity name? I was able to figure out how to change the style of the card title and the info-entities, but for some reason I have been having difficulty figuring out the entity name. The default font sizes are just a little too small for my eyes, so if there are other solutions to increasing them a little I’d be happy to look into them. Thank you!

@marcokreeft87 . Sorry for the confusion. I minimized the card and here is the yaml code for it:

type: custom:room-card
title: Garage
entity: switch.garage
icon: mdi:garage-variant
show_icon: true
entities:
  - entity: switch.garage
    name: Ceiling
    show_icon: true
    show_state: true
    icon:
      conditions:
        - condition: equals
          value: 'on'
          icon: mdi:ceiling-light
          styles:
            color: yellow
            animation: blink 0.75s ease infinite
        - condition: equals
          value: 'off'
          icon: mdi:ceiling-light
          styles:
            color: default
    tap_action:
      action: toggle
  - entity: switch.zooz_zen15_power_cord_freezer
    name: Freezer
    show_icon: true
    show_state: true
    icon:
      conditions:
        - condition: equals
          value: 'on'
          icon: mdi:fridge-industrial
          styles:
            color: green
        - condition: equals
          value: 'off'
          icon: mdi:fridge-industrial-alert
          styles:
            color: red
  - entity: switch.unifyplug_switch
    name: UnifySwitch
    show_state: true
    show_icon: true
    icon:
      conditions:
        - condition: equals
          value: 'on'
          icon: mdi:wifi-check
          styles:
            color: green
        - condition: equals
          value: 'off'
          icon: mdi:wifi-alert
          styles:
            color: red
  - entity: binary_sensor.garagedoor_sensor_2_opening
    name: Door
    show_icon: true
    show_state: true
    icon:
      conditions:
        - condition: equals
          value: 'on'
          icon: mdi:garage-open
          styles:
            color: red
        - condition: equals
          value: 'off'
          icon: mdi:garage-lock
          styles:
            color: green
  - entity: light.foscamgarage_light
    icon: mdi:ev-plug-ccs1
    show_icon: true
    show_state: true
    name: CamPlug
    tap_action:
      action: toggle

Screenshot for the room card:
image

Entity card for the sensor by itself:

type: entities
entities:
  - binary_sensor.garagedoor_sensor_2_opening

screenshot of the entity card:
image

I added the sensor to device class using customize
image

sensor info:

I tried to use a template in the room card to show the state of the sensor but did not work:

{{ 'Open' if is_state('binary_sensor.garagedoor_sensor_2_opening','on') else 'Closed' }}

I have noticed that in Home Assistant Android app (v2023.10.2-full) when I open a view with custom:room-card on it, it scrolls the view to the top on every entity update. Steps to reproduce:

  • Add a few cards to some view so that the content needs to be scrolled on your mobile.
  • Scroll to the bottom. After a short pause the content is scrolled to the top :sleepy:

Hello!
Can some help me out? I would like to remove borders from a card which is placed inside a room-card.
Here is a short config:

type: custom:room-card
title: Bathroom
entity: light.bathroom_lights
icon: mdi:shower
show_icon: true
tap_action:
  action: toggle
entities:
  - entity: light.bathroom_light
    icon: mdi:lightbulb-outline
    show_icon: true
    state_color: true
    name: Lamp
    tap_action:
      action: toggle
    hold_action:
      action: more-info
cards:
  - type: custom:shutter-row
    entity: cover.bathroom_shutter
    name: Shutter

In this config shutter-row card has border inside the whole room-card.

Thank you!

Hi again,

I’m trying to make the info entities icons closer with below card-mod:

card_mod:
  style: |
    ha-card {
      background: none !important;
      box-shadow: 1px 0px 3px 1px #65cbe9 !important;
      .card-header {
      font-size: 20px;
      .entities-info-row {
      padding: 0px;
      right: 20px;
      div {margin: 0px 0px 0px 6px; padding-top: 0px}
    }

The problem is it works on PC’s Chrome browser and on phone’s HA Companion app, but not on Fully Kiosk Browser. Has anyone experience card-mod effects not being displayed on FKB with a solution? Thanks.

Here’s what I’m using to tweak the spacing on some things. Specifically take a look at the .entities-info-row .entity section. Changing the left margin will squeeze them together a bit. I’ve never tried Fully Kiosk Browser, but the CSS I have works in Chrome, Firefox, and Safari on MacOS and iOS. I’d like to believe that’s a pretty good indication it would work for you.

card_mod:
  style: |
    .entities-row .icon-small {
      top: -6px;
    }
    .entities-row .entity {
      margin-left: -10px;
    }
    .entities-row {
      margin-left: 10px;
    }
    .entities-info-row {
      margin-right: -25px;
    }
    .entities-info-row .entity {
      margin-left: -15px;
    }
    .entities-info-row .icon-small {
      top: -2px;
    }
    .main-state {
      margin-top: -3px;
      width: 30px;
    }

Love the Card - thank you!

but I still don’t know how to style the Name of the entities (like Ceiling, Desk)

the info row is working with

.entities-info-row .entity {
  font-size: 18px;
}

example

as a workaround it works with
.content-left .entity {
font-size-adjust:0.8

Thank you for this amazing card! I’ve created a whole new dashboard around it and am very happy.
I do have at least one question as to the functionality that I am unsure how to implement: I have configured the main entity behind every one of my room cards to be a sensor that tracks the number of lights turned on in that room. This works well and appears to be easily maintained through HA templates. What I would love to do, is to have this number show up as a tiny little badge in the overall room icon (the icon that comes from the main entity)
How is this possible? I know 0 about css, but am a professional developer… I think I was just able to control the style/spacing with the ‘styles’ customization, right? Is it possible for me to inject the value of the state from the main entity into the overall on top of the icon of the main entity?

TIA!

Hello, it’s possible to format entities with show_state: false to match their names? I want to have this four names in “same row” but I didn’t figure out how to do that, I tried to use some negative margins, but with no success.

And I also tried to change state name for the Thermostat battery. It has two states (off/on), but I would like to “map” this values to (Normal/Low). I was able to change the icon color according to state of the value, but not the text itself.

I tried this, which does not work, but I guess the return statement is wrong:

       styles: 
          template: >
            if (entity.state == 'off') return entity.state == 'Normal'; 
            if (entity.state == 'on') return entity.state == 'Low';

Thank you for your feedback. Unfortunately, it doesn’t work on FKB. Probably it’s the problem with FKB itself.

I’m having the exact same issue, did you ever find a solution?

Hi guys, since the 2024.2.0 update all my battery level entities changed icons:
image
If I tell it to use the battery icon, the state color still works, but the icon doesn’t change its filled state. Does anyone know why the default icons changed?