Skip to content

lop1505/RoomCard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

52 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

OneLine Room Card

Home Assistant hacs_badge version License: MIT GitHub stars

A clean, performant, and fully visually configurable room card for Home Assistant. Developed with a focus on stability, simple design, and maximum flexibility.

Preview Preview

Collapsed

Preview


โœจ Features

Editor

  • ๐Ÿ–ฑ๏ธ Full visual editor โ€” no YAML required, with live preview
  • ๐Ÿ–ผ๏ธ Built-in image uploader โ€” upload room backgrounds directly in the editor
  • ๐Ÿงญ Quick Add โ€” add buttons from existing entity types in one click, including select / input_select
  • ๐Ÿ  Area-Based Auto-Setup โ€” pick a Home Assistant area and one click auto-populates climate, controls (light/switch/cover/fan/media_player/lock), temperature/humidity/window/battery sensors
  • ๐Ÿ–ฑ๏ธ Drag & drop reordering, bulk expand/collapse, collapsible button entries

Header

  • ๐ŸŒก๏ธ Smart climate integration โ€” temperature, humidity and target temp auto-populated
  • ๐ŸŒ Dynamic unit support โ€” Celsius / Fahrenheit from HA system settings
  • ๐Ÿท๏ธ Custom header badges โ€” any entity with optional label, name toggle and rgba(...) background
  • ๐Ÿ“ Configurable header height โ€” set in px, or 0 to hide completely
  • ๐Ÿšซ Hide background image (show_image: false) โ€” collapses the header to its content height while keeping name, icon, badges and chips visible
  • ๐ŸŒ— Image grayscale by light state (image_entity) โ€” header image fades to grayscale when the chosen light/switch is off
  • ๐Ÿšถ Presence indicator chip (presence_sensor) โ€” green chip when a person / motion / device_tracker is active
  • ๐Ÿšจ Configurable alert sensors โ€” red header chips and red card outline when sensors trip; collapsed mode shows a count badge with click-to-list dialog
  • ๐ŸŽจ Header typography โ€” font size, weight, style and color per element
  • ๐Ÿ“ Header position sliders โ€” drag title and info line left/right with snap points
  • ๐ŸชŸ Window sensor chips โ€” custom colors for open/closed states
  • ๐Ÿ”‹ Battery warning chips โ€” Critical / Low / Empty with card outline
  • ๐Ÿ’ง Humidity warning chip โ€” configurable threshold with card outline
  • ๐Ÿ—‚๏ธ Collapsible card โ€” click header to collapse/expand, state persists

Buttons

  • ๐Ÿ“ Flexible sizing โ€” width (1/3, 1/4, โ€ฆ) and height per button
  • ๐ŸŽ›๏ธ Inline slider โ€” brightness (light), position (cover), temperature (climate), volume (media player)
  • ๐Ÿ”˜ Inline cover buttons โ€” Open / Stop / Close directly on the tile
  • โ–ถ๏ธ Media player controls โ€” transport buttons, volume slider, source/sound-mode chips and optional media title
  • ๐Ÿ”ฝ Select / Input Select buttons โ€” add dropdown-style entities and control options with inline Previous / Next buttons
  • ๐ŸŽจ Color Favorites โ€” tap-to-set RGB swatches on light buttons
  • ๐Ÿ’ก Brightness presets โ€” tap-to-set brightness chips for lights (e.g. 25% / 50% / 75% / 100%)
  • ๐ŸŒก๏ธ Climate presets โ€” tap-to-set temperature presets (fixed, auto, max)
  • ๐Ÿ”ฅ HVAC mode chips (show_hvac_modes) โ€” tappable chips for attributes.hvac_modes with matching MDI icons (off/auto/heat/cool/heat_cool/dry/fan_only)
  • ๐Ÿ’จ Fan speed chips (show_fan_modes) โ€” tappable chips for attributes.fan_modes
  • ๐Ÿ“ˆ Sensor sparklines (show_sparkline) โ€” tiny line charts on sensor buttons; configurable history (sparkline_hours) and refresh cadence (sparkline_refresh)
  • ๐Ÿ“ Cover position presets โ€” tap-to-set position presets (default: 0% / 50% / 100%)
  • ๐ŸŽจ State-dependent colors (color_map) โ€” icon color and background by entity state
  • ๐Ÿ’ก Dynamic state icons โ€” auto icon per state for Light, Switch, Fan, Lock, Cover, Media Player
  • ๐ŸŽจ Custom icon map (icon_map) โ€” per-state icon overrides
  • ๐Ÿ“ Configurable icon size โ€” per button or global default
  • ๐Ÿงผ Show/hide state, label, icon per button
  • ๐Ÿ• Time since last change โ€” show_last_changed: true shows elapsed time on the button (e.g. "2h 15min"), combined with state as "on ยท 2h"
  • โ†•๏ธ Label position โ€” Right / Left / Top / Bottom per button and global default
  • ๐Ÿ‘† Configurable actions โ€” Tap / Hold / Double Tap per button
  • ๐Ÿงฉ Action service payloads โ€” call-service actions now support inline service_data JSON in the visual editor
  • ๐Ÿ“‚ Nested Card Behavior actions โ€” action settings are grouped under Card Behavior and default to collapsed
  • ๐ŸŽฏ Button visibility toggle
  • ๐Ÿ“ด Unavailable / offline handling โ€” dimmed, non-interactive, with indicator

Advanced

  • ๐Ÿ–Œ๏ธ CSS Custom Properties โ€” --rc-btn-bg, --rc-icon-color for card-mod styling
  • ๐Ÿ“ Template buttons โ€” arbitrary HTML content, icon, color and state via Jinja2
  • โšก Vanilla JS, no external dependencies โ€” fast load, no build step

๐Ÿ“ฅ Installation

Via HACS (Recommended)

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Or manually: HACS โ†’ Frontend โ†’ โ‹ฎ โ†’ Custom repositories โ†’ paste URL โ†’ Category: Lovelace.

Manual

  1. Download room-card.js from the latest release
  2. Copy to /config/www/
  3. Add resource: URL /local/room-card.js ยท Type: JavaScript Module

โš™๏ธ Configuration

Add the card via "Add Card" โ†’ select OneLine Room Card. The visual editor covers all settings โ€” no YAML required.

Key YAML options

Card level

Option Default Description
name โ€” Room name
entity โ€” Main entity (drives header icon color)
image โ€” Header background image URL
show_image true Show the header background image. false hides the <img> and dark gradient and lets the header collapse to content height while name / icon / badges / chips remain visible
image_entity โ€” Light / switch / input_boolean / group entity. When this entity is off, the header image fades to grayscale
header_height 120 Header image height in px (0 = hidden, ignored when show_image: false)
collapsible false Enable click-to-collapse on header
default_state expanded expanded ยท collapsed
tap_action โ€” Card tap action (e.g. navigate)
hold_action none Card hold action
double_tap_action none Card double tap action
global_label_position right Default label position for all buttons
global_icon_size 20px Default icon size for all buttons
global_button_background โ€” Default button background (e.g. rgba(0,0,0,0))
show_card_last_activity false Show a header badge with elapsed time since the most recently changed button entity (e.g. 5 min, 2h 15min). Auto-refreshes every 60 s.
sparkline_refresh 300 Auto-refresh cadence for all sparkline buttons in seconds (60โ€“3600)

Sensors & chips

Option Default Description
presence_sensor โ€” Person / binary_sensor / device_tracker entity. Adds a green presence chip when active (on, home, active, detected)
presence_sensor_label โ€” Custom label for the presence chip
temp_sensor โ€” Temperature sensor (overrides climate)
target_temp_sensor โ€” Target temperature sensor
humid_sensor โ€” Humidity sensor (overrides climate)
temp_sensor_label โ€” Custom label prefix for the temperature value
target_temp_sensor_label โ€” Custom label prefix for the target temperature value
humid_sensor_label โ€” Custom label prefix for the humidity value
humidity_warning_threshold 60 Humidity warning threshold (%)
alert_sensors โ€” List of alert configurations: { entity, state, above, below }. Triggers red header chips and a red card outline when active
alert_chip_mode expanded expanded shows one chip per active alert; collapsed shows a count badge that opens a list dialog on click
alert_border_color #d32f2d CSS color for the red card outline when alerts are active (any valid CSS color)
window_sensors โ€” List of window/door sensors (binary_sensor or sensor domain)
window_labels โ€” Per-window custom labels keyed by entity ID, e.g. { binary_sensor.bedroom_window: "Sofia's bedroom window" }
window_always_show false Show chip even when closed
window_open_color #FFA000 Chip color when open
window_closed_color #9E9E9E Chip color when closed
window_solid_background false Use the resolved window color as a solid chip background instead of a translucent tint
window_open_states ["on","open"] List of state values treated as "open" (e.g. ["offen","gekippt"] for custom sensors). on is always included automatically for backward compatibility.
window_state_colors โ€” Per-state color overrides, e.g. { offen: "#FFA000", gekippt: "#FFD740" }
battery_sensors โ€” List of battery sensors
window_sensors:
  - binary_sensor.bedroom_window
window_labels:
  binary_sensor.bedroom_window: "Sofia's bedroom window"
window_solid_background: true

Buttons (controls)

Option Default Description
entity โ€” Entity ID
name โ€” Display label
width 15 Relative width (1โ€“60)
height 60 Height in px
control_mode โ€” slider ยท buttons ยท full (media player full combines volume slider and transport controls)
color_map โ€” Per-state icon color map
icon_map โ€” Per-state icon map
show_media_sources false Show media player source chips from source_list
show_media_sound_modes false Show media player sound-mode chips from sound_mode_list
show_media_title false Show current media title/artist instead of the raw state
show_brightness_presets false Show light brightness preset chips
brightness_presets [25,50,75,100] Brightness preset values in percent
show_cover_presets false Show cover position preset chips
cover_presets [0,50,100] Position preset values
show_climate_presets false Show climate temperature preset chips
climate_presets โ€” Temperature preset values
show_hvac_modes false Show HVAC mode chips for climate entities (uses attributes.hvac_modes, calls climate.set_hvac_mode)
show_fan_modes false Show fan speed chips for climate entities (uses attributes.fan_modes, calls climate.set_fan_mode)
show_sparkline false Show a small history line chart on sensor buttons
sparkline_hours 24 Sparkline history range in hours (1โ€“168)
show_color_favorites false Show light color favorite swatches
color_favorites โ€” List of #hex or r,g,b colors
show_state true Show entity state text on button
show_last_changed false Show elapsed time since last state change (e.g. 2h 15min). Combined with show_state renders as on ยท 2h. Auto-refreshes every 60 s.
tap_action more-info toggle ยท more-info ยท none
hold_action toggle โ€”
double_tap_action none โ€”

๐ŸŽจ Background Settings

The button background can be customized on two levels. The specific per-button setting overrides the global setting, which in turn overrides the default theme background.

# Card-level default for all buttons
global_button_background: rgba(0,0,0,0)       # e.g., fully transparent

# Per-button override
controls:
  - entity: light.living_room
    button_background: rgba(128,128,128,0.18) # e.g., slightly tinted

Priority: button_background (per button) > global_button_background (all buttons) > theme default


๐Ÿ”ง CSS Custom Properties

Override via card-mod for advanced theming:

card_mod:
  style: |
    ha-card {
      --rc-btn-bg: rgba(0,0,0,0);        /* button background */
      --rc-icon-color: white;             /* all icon colors */
    }

Per-button targeting via data-entity attribute (set on each .btn element):

card_mod:
  style: |
    .btn[data-entity="light.living_room"] {
      --rc-btn-bg: rgba(255, 0, 0, 0.5) !important;
      --rc-icon-color: gold !important;
    }

๐Ÿ“‹ Changelog

See CHANGELOG.md for the full release history.


โ˜• Support

If you enjoy this card, consider buying me a coffee!

About

A responsive room card for Home Assistant

Topics

Resources

License

Security policy

Stars

10 stars

Watchers

0 watching

Forks

Sponsor this project

Packages

 
 
 

Contributors