Skip to content

Bubble Card is a minimalist card collection for Home Assistant with a nice pop-up touch.

License

Notifications You must be signed in to change notification settings

Saikatssd/Bubble-Card

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bubble Card

Bubble Card is a minimalist and customizable card collection for Home Assistant with a nice pop-up touch.

Stars Last commit Reddit Profile Home Assistant Community Forum Buy me a beer PayPal

Table of contents

Installation | Configuration | Pop-up | Horizontal buttons stack | Button | Custom button | Cover | Separator | Empty column | Actions | Full example | Styling | Conflicts | Help

Screenshots and features

Bubble Card Cover Bubble Card 1 Bubble Card 2 Bubble Card 3 Bubble Card 4 Bubble Card 5 Bubble Card Video Preview

Installation

Home Assistant lowest supported version: 2023.9.0

Without HACS

  1. Download this file: bubble-card.js
  2. Add this file into your <config>/www folder
  3. On your dashboard click on the icon at the right top corner then on Edit dashboard
  4. Click again on that icon and then on Manage resources
  5. Click on Add resource
  6. Copy and paste this: /local/bubble-card.js?v=1
  7. Click on JavaScript Module then Create
  8. Go back and refresh your page
  9. You can now click on Add card in the bottom right corner and search for Bubble Card
  10. After any update of the file you will have to edit /local/bubble-card.js?v=1 and change the version to any higher number

With HACS

This method allows you to get updates directly in the HACS main page

  1. Download HACS following the instructions on https://hacs.xyz/docs/setup/download
  2. Proceed to the initial configuration following the instructions on https://hacs.xyz/docs/configuration/basic
  3. On your sidebar go to HACS > Integrations
  4. click on the icon at the right top corner then on Custom repositories
  5. For the repository add this: https://github.com/Clooos/Bubble-Card
  6. For the category select Lovelace then click Add
  7. Now click on Bubble Card then on the Download button
  8. Go back on your dashboard and click on the icon at the right top corner then on Edit dashboard
  9. You can now click on Add card in the bottom right corner and search for Bubble Card

Coming soon in the HACS default repo (still waiting for validation).

With HACS - Video

There is also a detailed setup video from BeardedTinker, thanks a lot to him!
YouTube - Pop-up cards with Bubble Card in Home Assistant

Configuration

Most options can be configured in the GUI editor, except for custom styles, custom buttons and tap actions.

Main options

Name Type Requirement Supported options Description
type string Required custom:bubble-card Type of the card
card_type string Required button, cover, empty-column, horizontal-buttons-stack, pop-up or separator Type of the Bubble Card, see below
styles object list Optional Any CSS stylesheets Allows you to customize your cards, see styling

Pop-up

This card allows you to convert any vertical-stack card into a pop-up. Each pop-up must have an unique hash (e.g. '#kitchen'), you can open them with any card that allows navigation_path or with the horizontal-buttons-stack that is included. This card come with an header for your pop-up, if you add an entity to this card you will have a button to toggle this entity in that header, you can also display the state of an entity (e.g. the temperature of a room).

  1. To add a pop-up you first need to add a vertical-stack card to your dashboard
  2. This vertical-stack must be after all your other cards and before your horizontal-buttons-stack if you have one
  3. Now add a Bubble Card with the type pop-up in it
  4. Just fill in the required inputs and the ones you need

Options

Name Type Requirement Supported options Description
hash string Required Any unique hash (e.g. '#kitchen') with ' ' This is how you will open your pop-up
name string Optional Any string A name for your pop-up header
icon string Optional Any mdi: icon or a link to a square image An icon for your pop-up header, if not defined it will display the entity icon or the entity-picture
entity string Optional Any switchable entity Display a button to toggle this entity
state string Optional Any entity Display its state in your pop-up header
auto_close string Optional A timeout in milliseconds (e.g. 10000 for 10s) Auto close the pop-up after a timeout
back_open boolean Optional true or false (default) Enable the back button/event, this allows you to navigate through your pop-ups when you press the back button of your browser (true was the initial behavior in the beta)
text string Optional Any string An additional text to show next to your name
width_desktop string Optional Any CSS value Width on desktop (100% by default on mobile)
is_sidebar_hidden boolean Optional true or false (default) Fix the pop-up position if the sidebar is hidden on desktop (only if you have made a modification to hide it yourself)
margin string Optional Any CSS value Use this only if your pop-up is not well centered on mobile (e.g. 13px)
margin_top_mobile string Optional Any CSS value Top margin on mobile (e.g. -56px if your header is hidden)
margin_top_desktop string Optional Any CSS value Top margin on desktop (e.g. 50% for an half sized pop-up)
bg_color string Optional Any hex, rgb or rgba value The background color of your pop-up (e.g. #ffffff for a white background)
bg_opacity string Optional Any value from 0 to 100 The background opacity of your pop-up (e.g. 100 for no transparency)
bg_blur string Optional Any value from 0 to 100 The background blur effect of your pop-up, this only work if bg_opacity is not set to 100 (e.g. 0 for no blur)
shadow_opacity string Optional Any value from 0 to 100 The shadow opacity of your pop-up (e.g. 0 to hide it)
trigger_entity string Optional Any entity Open this pop-up based on the state of any entity
trigger_state string Optional (Required if trigger_entity is defined) Any entity state Entity state to open the pop-up
trigger_close boolean Optional true or false (default) Close the pop-up when trigger_state is different
tap_action object Optional See actions Define the type of action on icon click, if undefined, more-info will be used.
double_tap_action object Optional See actions Define the type of action on icon double click, if undefined, toggle will be used.
hold_action object Optional See actions Define the type of action on icon hold, if undefined, more-info will be used.

Example

A pop-up

type: vertical-stack
cards:
  - type: custom:bubble-card
    card_type: pop-up
    hash: '#kitchen'
    name: Kitchen
    icon: mdi:fridge
    entity: light.kitchen
    state: sensor.kitchen_temperature
    back_open: true

A button to open the pop-up (not a Bubble Card one)

type: button
tap_action:
  action: navigate
  navigation_path: '#kitchen'
name: Kitchen
icon: mdi:fridge

Pop-ups trigger

This feature allows you to open a pop-up based on the state of any entity, for example you can open a "Security" pop-up with a camera when a person is in front of your house. You can also create a toggle helper (input_boolean) and trigger its opening/closing in an automation.

Example

type: custom:bubble-card
card_type: pop-up
hash: '#kitchen'
name: Security
icon: mdi:video
trigger_entity: binary_sensor.front_door_motion
trigger_state: 'on'
trigger_close: true

Horizontal buttons stack

This card is the companion to the pop-up card, allowing you to open the corresponding pop-ups. It also allows you to open any page of your dashboard. In addition, you can add your motion sensors so that the order of the buttons adapts according to the room you just entered. This card is scrollable, remains visible and acts as a footer. This card will have more features in the future.

⚠️ Important: This card have to be the last one in your view (after every cards and pop-ups). It can't be inside any stack.

Options

Name Type Requirement Supported options Description
1_link string Required The pop-up hash (e.g. '#kitchen') with ' ' or any link A link to open
1_name string Optional Any string A name for your button
1_icon string Optional Any mdi: icon An icon for your button
1_entity string Optional Any light or light group Display the color of that light in background
1_pir_sensor string Optional Any binary sensor At least one pir sensor or more for auto_order
auto_order boolean Optional true or false (default) Change the order of the buttons according to the room you just entered, it need to be false if you don't have any _pir_sensor in your code
margin string Optional Any CSS value Use this only if your horizontal-buttons-stack is not well centered on mobile (e.g. 13px)
width_desktop string Optional Any CSS value Width on desktop (100% by default on mobile)
rise_animation boolean Optional true (default) or false Set this to false to disable the animation that activates once the page has loaded

The variables starting with a number defines your buttons, just change this number to add more buttons (see example below).

Example

type: custom:bubble-card
card_type: horizontal-buttons-stack
auto_order: true
1_name: Living room
1_icon: mdi:sofa
1_link: '#living-room'
1_entity: light.living_room
1_pir_sensor: binary_sensor.living_room_motion
2_name: Kitchen
2_icon: mdi:fridge
2_link: '#kitchen'
2_entity: light.kitchen
2_pir_sensor: binary_sensor.kitchen_motion
3_name: Dining room
3_icon: mdi:silverware-fork-knife
3_link: '#dining-room'
3_entity: light.dining_room
3_pir_sensor: binary_sensor.dining_room_motion

Button

This card can be a slider or a button, allowing you to toggle your entities or automations, control the brightness of your lights and the volume of your media players. To access color / control of an entity, simply tap on the icon.

Options

Name Type Requirement Supported options Description
entity string Required Any switchable entity, any media player or any light An entity to control
button_type string Optional switch (default) or slider The behavior of your button
name string Optional Any string A name for your button, if not defined it will display the entity name
icon string Optional Any mdi: icon or a link to a square image An icon for your button, if not defined it will display the entity icon or the entity-picture
show_state boolean Optional true or false (default) Show the state of your entity below its name
tap_action object Optional See actions Define the type of action on icon click, if undefined, more-info will be used.
double_tap_action object Optional See actions Define the type of action on icon double click, if undefined, toggle will be used.
hold_action object Optional See actions Define the type of action on icon hold, if undefined, more-info will be used.

Example

type: custom:bubble-card
card_type: button
button_type: slider
entity: light.kitchen_led
name: Kitchen LED
icon: mdi:led-strip-variant

Custom button

This is a customizable button (similar to the switch button) that allows you to use all actions directly on the whole button allowing you to use it for almost everything.

This is still experimental and more customizations are coming.

Options

Name Type Requirement Supported options Description
entity string Required (and soon optional) Any entity that can be on/off or true/false, any media player, cover or light An entity for the state of the button
button_type string Required custom The behavior of your button
name string Optional Any string A name for your button, if not defined it will display the entity name
icon string Optional Any mdi: icon or a link to a square image An icon for your button, if not defined it will display the entity icon or the entity-picture
show_state boolean Optional true or false (default) Show the state of your entity below its name
tap_action object Optional See actions Define the type of action on button click, if undefined, more-info will be used.
double_tap_action object Optional See actions Define the type of action on button double click, if undefined, toggle will be used.
hold_action object Optional See actions Define the type of action on button hold, if undefined, more-info will be used.

Example

Here is an example of a button that toggle all the lights of a room and if you double tap or hold it, it will open a pop-up with all your other lights:

type: custom:bubble-card
card_type: button
button_type: custom
entity: light.kitchen
name: Kitchen
icon: mdi:fridge
tap_action:
  action: toggle
double_tap_action:
  action: navigate
  navigation_path: '#kitchen'
hold_action:
  action: navigate
  navigation_path: '#kitchen'

Cover

This card allows you to control your covers.

Options

Name Type Requirement Supported options Description
entity string Required Any cover A cover to control
name string Optional Any string A name for your cover, if not defined it will display the entity name
icon_open string Optional Any mdi: icon An icon for your open cover, if not defined it will display the default open cover icon
icon_close string Optional Any mdi: icon An icon for your closed cover, if not defined it will display the default closed cover icon
open_service string Optional Any service or script A service to open your cover, default to cover.open_cover
stop_service string Optional Any service or script A service to stop your cover, default to cover.stop_cover
close_service string Optional Any service or script A service to close your cover, default to cover.close_cover
tap_action object Optional See actions Define the type of action on icon click, if undefined, more-info will be used.
double_tap_action object Optional See actions Define the type of action on icon double click, if undefined, toggle will be used.
hold_action object Optional See actions Define the type of action on icon hold, if undefined, more-info will be used.

Example

type: custom:bubble-card
card_type: cover
entity: cover.kitchen
name: Kitchen
icon_open: mdi:roller-shade
icon_close: mdi:roller-shade-closed

Separator

This card is a simple separator for dividing your pop-up into categories / sections. e.g. Lights, Devices, Covers, Settings, Automations...

Options

Name Type Requirement Supported options Description
name string Optional but recommended Any string A name for your separator
icon string Optional but recommended Any mdi: icon An icon for your separator

Example

type: custom:bubble-card
card_type: separator
name: Covers
icon: mdi:window-shutter

Empty column

This card is here to fill an empty column. This is useful if you have an horizontal-stack in your pop-up with only one card. Take a look at the bottom right corner of the second screenshot to (don't) see it.

Options

This card has no options.

Example

type: custom:bubble-card
card_type: empty-column

Tap, double tap and hold actions

You can also use HA default tap actions, double tap actions and hold actions on the icons of the buttons, the pop-ups and the covers. This allows you to display the “more info” window by holding the icon and to turn on/off the lamp of a slider by a single tap for example.

This is still experimental and only available in YAML for now.

Options

Name Type Supported options Description
action string more-info, toggle, call-service, navigate, url, fire-dom-event, none Action to perform
target object Only works with call-service. Follows the home-assistant syntax
navigation_path string Any path of your dashboard Path to navigate to (e.g. '#kitchen' for opening a pop-up) when action defined as navigate
url_path string Any link URL to open on click (e.g. https://www.google.com) when action is url
service string Any service Service to call (e.g. media_player.media_play_pause) when action defined as call-service
data or service_data object Any service data Service data to include (e.g. entity_id: media_player.kitchen) when action defined as call-service
confirmation object See confirmation Display a confirmation popup, overrides the default confirmation object

Example

tap_action: 
  action: toggle 
double_tap_action: 
  action: call-service 
  service: script.dark_scene 
hold_action: 
  action: more-info

Full example

Here is the raw code of my "Cuisine" pop-up (Kitchen in english) as seen in some screenshots :

type: vertical-stack
cards:
  - type: custom:bubble-card
    card_type: pop-up
    entity: light.cuisine
    icon: mdi:fridge-outline
    name: Cuisine
    hash: '#cuisine'
    state: sensor.cuisine_temperature
    width_desktop: 540px
    margin_top_mobile: 18px
    margin_top_desktop: 74px
    styles: |
      #root {
        /* This is a fix for older Safari (for my wall mounted iPad) but it won't work on Firefox, this is optional */
        display: grid !important;
      }
  - type: custom:bubble-card
    card_type: separator
    name: Lampes
    icon: mdi:lightbulb
  - type: horizontal-stack
    cards:
      - type: custom:bubble-card
        card_type: button
        button_type: slider
        entity: light.led_cuisine
        name: LED
      - type: custom:bubble-card
        card_type: button
        button_type: slider
        entity: light.bar_cuisine
        name: Bar
        icon: mdi:light-recessed
  - type: horizontal-stack
    cards:
      - type: custom:bubble-card
        card_type: button
        button_type: slider
        entity: light.spots_cuisine
        name: Plan de travail
      - type: custom:bubble-card
        card_type: button
        button_type: switch
        entity: light.hotte_cuisine
        name: Hotte
  - type: custom:bubble-card
    card_type: separator
    name: Appareils
    icon: mdi:connection
  - type: horizontal-stack
    cards:
      - type: custom:bubble-card
        card_type: button
        button_type: slider
        entity: media_player.google_nest_cuisine
        name: Google Mini
        icon: mdi:speaker
      - type: custom:bubble-card
        card_type: button
        button_type: switch
        entity: fan.hotte_cuisine
        name: Hotte
        icon: mdi:fan
  - type: custom:bubble-card
    card_type: separator
    name: Volets
    icon: mdi:window-shutter
  - type: horizontal-stack
    cards:
      - type: custom:bubble-card
        card_type: cover
        entity: cover.cuisine
        name: Cuisine
        icon_open: mdi:blinds-horizontal
        icon_closed: mdi:blinds-horizontal-closed
      - type: custom:bubble-card
        card_type: empty-column

Styling

You can directly use styles: | in YAML without card-mod which allows you to modify the CSS style of the pop-ups and all the other cards.

Please note that you will have to add !important; to some CSS styles that are already defined (see examples below).

Some cards needs a page refresh to display your CSS modifications (like the pop-ups).

Examples

Here is how to change the pop-up background (you can do it with bg_color, bg_opacity and bg_blur now).

styles: | 
  #root {
    /* You can edit the last value (0.8) to change the opacity, 0 is transparent and 1 is the max value */
    background-color: rgba(79, 69, 87, 0.8) !important;

    /* Add blur on your background.
    backdrop-filter: blur(10px);
  }
  bubble-card::after {
    /* Hide the gradient in the top of the pop-up */
    display: none !important;
  }

To change the font size of any Bubble Card:

styles: |
  ha-card { 
    font-size: 12px;
  }

To change the background color of a single button in an horizontal-buttons-stack:

styles: >
  /* Selector for the '#kitchen' button */
  .kitchen {
    background: darkblue !important;
  }

To change the background color of a button:

styles: | 
  ha-card > div > div > div { 
    background: blue !important; 
  }

Or the color of a slider:

styles: |
  .range-fill { 
    background: rgba(79, 69, 87, 1) !important; 
  }

The Bubble theme (like on the screenshots) can be found here: https://github.com/Clooos/Bubble

Styles template

Advanced users can add templates in JS in their custom styles, here is an example of a button that is red when it's off and blue when it's on.

type: custom:bubble-card
card_type: button
entity: switch.test
name: Test
styles: |
  .switch-button {
    background-color: ${state === 'on' ? 'blue' : 'red'} !important;
  }

More information here : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_operator

For now you have access to these variables in some cards (not all):

state will return the state of your defined entity.
entity will return your entity you defined like switch.test in this example.

But in all cards you can also use this:

hass.states['light.kitchen'].state will return the state of light.kitchen.
hass.states['light.kitchen'].attributes.brightness will return the brightness attribute of light.kitchen.

Custom components conflicts

⚠️ For now there are some features that are not working with:

Help

Feel free to open an issue if something is not working as expected.

And for your questions you can go ask here on the forum to get some help from me or the community :

Home Assistant Community Forum

Donate

If you like my project and want to support me, please consider making a donation. Any amount is welcome and very much appreciated 🍻

Buy me a beer

PayPal

Thank you everyone for your support, you all are my greatest motivation!

  • Contribution guidelines

Welcome to [Bubble-Card]! We're thrilled that you'd like to contribute. Your help is essential for making it better.

Getting Started

Before you start contributing, please make sure you have read and understood our Code of Conduct.

Fork the Repository

First, fork the repository to your own GitHub account. This will create a copy of the project under your account.

Clone the Repository

git clone https://github.com/yourusername/Bubble-Card

Navigate to the project directory 📁

cd Bubble-Card

Create a new branch for your feature or bug fix:

 git checkout -b feature-branch

Make your changes and commit them:

git add .
git commit -m "Description of your changes"

Push your changes to your fork:

git push origin feature-branch

Finally Click on Create Pull request to contribute on this repository.

About

Bubble Card is a minimalist card collection for Home Assistant with a nice pop-up touch.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%