All Projects → Savjee → button-text-card

Savjee / button-text-card

Licence: MIT license
Custom, "neumorphism" Lovelace card

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to button-text-card

Home-Assistant-Lovelace-HTML-Jinja2-Template-card
This card displays provided Jinja2 template as an HTML content of a card. It uses exactly the same engine as Home Assistant in Developer tools.
Stars: ✭ 27 (-71.58%)
Mutual labels:  home-assistant, lovelace-card
ioBroker.lovelace
Visualization with Lovelace-UI
Stars: ✭ 41 (-56.84%)
Mutual labels:  home-assistant, lovelace-card
compass-card
A Lovelace card that shows a directional indicator on a compass for Home Assistant
Stars: ✭ 64 (-32.63%)
Mutual labels:  home-assistant, lovelace-card
Home-Assistant-Lovelace-Local-Conditional-card
This card can show and hide a specific card on current device while not affecting other windows. It does not require any integration to run.
Stars: ✭ 30 (-68.42%)
Mutual labels:  home-assistant, lovelace-card
numberbox-card
Replace input_number sliders with plus and minus buttons
Stars: ✭ 61 (-35.79%)
Mutual labels:  home-assistant, lovelace-card
integration blueprint
Blueprint for custom_component developers.
Stars: ✭ 151 (+58.95%)
Mutual labels:  home-assistant
HomeAssistant-Tapo-Control
Control for Tapo cameras as a Home Assistant component
Stars: ✭ 327 (+244.21%)
Mutual labels:  home-assistant
leven
😋 Make your own blog!
Stars: ✭ 54 (-43.16%)
Mutual labels:  templating
home-assistant-opentherm-thermostat
Home Assistant OpenTherm Thermostat
Stars: ✭ 26 (-72.63%)
Mutual labels:  home-assistant
wienerlinien
A sensor that give you information about next departure from spesified stop.
Stars: ✭ 20 (-78.95%)
Mutual labels:  home-assistant
ha-gismeteo
Gismeteo Weather Provider for Home Assistant
Stars: ✭ 84 (-11.58%)
Mutual labels:  home-assistant
homeassistant
Home Assistant Config
Stars: ✭ 50 (-47.37%)
Mutual labels:  home-assistant
esphome-phsensor
ESP8266 with analog pH sensor
Stars: ✭ 45 (-52.63%)
Mutual labels:  home-assistant
xfinity-usage
Home Assistant custom component for retrieving Xfinity data usage
Stars: ✭ 48 (-49.47%)
Mutual labels:  home-assistant
hass-pandora-cas
Home Assistant custom component for Pandora Car Alarm System
Stars: ✭ 15 (-84.21%)
Mutual labels:  home-assistant
gigaset-elements-proxy
a simple web and MQTT bridge with gigaset-elements APIs (no more maintained)
Stars: ✭ 19 (-80%)
Mutual labels:  home-assistant
Home-AssistantConfig---OLD
AtomicPapa's Amazing Home Assistant Config
Stars: ✭ 15 (-84.21%)
Mutual labels:  home-assistant
lennoxs30
Home Assistant Lennox S30 / E30 / M30 integration
Stars: ✭ 31 (-67.37%)
Mutual labels:  home-assistant
homeassistant-cli
Control your smart home from the terminal
Stars: ✭ 12 (-87.37%)
Mutual labels:  home-assistant
linak-desk-card
Home Assistant Lovelace Card for controlling desks based on linak bluetooth controller.
Stars: ✭ 26 (-72.63%)
Mutual labels:  home-assistant

Project logo

Button Text Card

hacs_badge Build Status GitHub Issues GitHub Pull Requests License


Custom, "neumorphism" card for Home Assistant with support for templating.

Table of contents


Installation instructions

  1. Open HACS
  2. Go to Plugins > Search for "Button Text Card"
  3. Install it
  4. Add to your Lovelace config:
  - url: /hacsfiles/button-text-card/button-text-card.js
    type: module

Configuration options

Name Type Requirement Description Default Template support?
type string required custom:button-text-card n/a No
entity string optional Which entity state you want to use in your card (templating) No
icon string optional Custom icon for the card mdi:alert-circle Yes
title string optional Yes
subtitle string optional Yes
large boolean optional Large cards have a full-width container false Yes
font_color string optional CSS colorcode for the text Defined by theme Yes
icon_color string optional CSS colorcode or "auto" if you want it to change based on your entity state Defined by theme Yes
icon_size number optional Height of the icon (in pixels) Defined by HA (24px) Yes
background_color string optional CSS color for the background of the badge Defined by theme Yes
hide_condition string optional Javascript template that defines if card should be hidden false Yes
icon_animation string optional Possible values: 'spin' Yes

Examples

Basic card with static title, subtitle and custom icon

type: 'custom:button-text-card'
title: Title
subtitle: Subtitle
icon: 'mdi:lightbulb-outline'

Only title

type: 'custom:button-text-card'
title: Only title
icon: 'mdi:format-title'

Large card

type: 'custom:button-text-card'
title: Large version
subtitle: Ideal for important messages
icon: 'mdi:battery-high'
large: true

Custom background & font colors

type: 'custom:button-text-card'
title: Warning!
subtitle: Draw attention with custom colors
icon: 'mdi:comment-alert'
large: true
font_color: '#fff'
background_color: '#A81419'

Templating

For templating, we do NOT support Jinja2. Instead we opted to use Javascript as templating language (like button-card).

Templating is supported in most fields (see options for more details). Since these templates are executed in the front-end, there is no impact on the performance of your Home Assistant installation. It does, however, mean that you have to learn some Javascript.

Templates are enclosed by tripple brackets and can contain any valid Javascript: [[[ return "Hello from Javascript!" ]]]

Example: counting people home

type: 'custom:button-text-card'
icon: >
  [[[
    const count = Object.entries(states).filter(e => e[0].indexOf('person.') === 0 && e[1].state === "home").length;

    if(count === 0){
      return "mdi:home-export-outline";
    }else{
      return "mdi:home-import-outline";
    }
  ]]]
title: |
  [[[
    const count = Object.entries(states).filter(e => e[0].indexOf('person.') === 0 && e[1].state === "home").length;
    return "People home: " + count;
  ]]]
subtitle: Support for templating!

Conditional hiding

You can use a Javascript template to dynamically hide a card. This can be useful to create contextual cards (eg: only show when the front door is open, when there are lights on, ...).

To do so, write a Javascript template in the hide_condition attribute and return true if the card should be hidden.

Example: Only show card when music is playing

type: 'custom:button-text-card'
title: There is music playing
icon: 'mdi:music-circle'
hide_condition: |
  [[[
    const active_players = Object.entries(states).filter(e => e[0].indexOf('media_player.')===0 && e[1].state === 'playing');
    return active_players.length === 0;
  ]]]

Cool feature: when you go into edit mode, all hidden cards will appear with an opacity of 50%. That way you can easily manage all your cards.

Example: Only show card when the front door is open

type: 'custom:button-text-card'
large: true
entity: binary_sensor.voordeur
title: Front door open!
background_color: '#A81419'
font_color: '#fff'
icon: 'mdi:door-open'
hide_condition: |
  [[[ return entity.state === "off" ]]]

TODO

  • Document tap_action support

License & contributions

See LICENSE

Feel free to suggest improvements, flag issues, open pull requests, ...

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].