Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/PiotrMachowski/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.
https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Local-Conditional-card
home-assistant lovelace-card
Last synced: 5 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Local-Conditional-card
- Owner: PiotrMachowski
- License: mit
- Created: 2019-10-29T01:30:36.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-07T02:53:33.000Z (over 1 year ago)
- Last Synced: 2024-08-02T16:12:25.240Z (3 months ago)
- Topics: home-assistant, lovelace-card
- Language: TypeScript
- Homepage:
- Size: 209 KB
- Stars: 61
- Watchers: 3
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[![HACS Default][hacs_shield]][hacs]
[![GitHub Latest Release][releases_shield]][latest_release]
[![GitHub All Releases][downloads_total_shield]][releases]
[![Community Forum][community_forum_shield]][community_forum]
[![Ko-Fi][ko_fi_shield]][ko_fi]
[![buycoffee.to][buycoffee_to_shield]][buycoffee_to]
[![PayPal.Me][paypal_me_shield]][paypal_me]
[![Revolut.Me][revolut_me_shield]][revolut_me][hacs_shield]: https://img.shields.io/static/v1.svg?label=HACS&message=Default&style=popout&color=green&labelColor=41bdf5&logo=HomeAssistantCommunityStore&logoColor=white
[hacs]: https://hacs.xyz/docs/default_repositories[latest_release]: https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Local-Conditional-card/releases/latest
[releases_shield]: https://img.shields.io/github/release/PiotrMachowski/Home-Assistant-Lovelace-Local-Conditional-card.svg?style=popout[releases]: https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Local-Conditional-card/releases
[downloads_total_shield]: https://img.shields.io/github/downloads/PiotrMachowski/Home-Assistant-Lovelace-Local-Conditional-card/total[community_forum_shield]: https://img.shields.io/static/v1.svg?label=%20&message=Forum&style=popout&color=41bdf5&logo=HomeAssistant&logoColor=white
[community_forum]: https://community.home-assistant.io/t/lovelace-local-conditional-card/145145# 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.
## Installation
### HACS (recommended)
- Open HACS
- Go to "Frontend" section
- Click button with "+" icon
- Search for "Local conditional card"
- Install repository in HACS
- Make sure you have added this card to [Lovelace resources](https://my.home-assistant.io/redirect/lovelace_resources/)
```yaml
url: /hacsfiles/local-conditional-card/local-conditional-card.js
type: module
```
- Refresh your browser### Manual
- Download `local-conditional-card.js` file from the [latest release](https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Local-Conditional-card/releases/latest)
- Save downloaded file somewhere in `/www/` directory, e.g. `/config/www/custom_lovelace/local-conditional-card.js`
- Add saved file to [Lovelace resources](https://my.home-assistant.io/redirect/lovelace_resources/)
```yaml
url: /local/custom_lovelace/local-conditional-card.js
type: module
```
- Restart HA if you had to create `www` directory
- Refresh your browser## Configuration options
| Key | Type | Required | Default | Description |
|-----------------|-----------|----------|---------|---------------------------------------------------------------------------------|
| `id` | `string` | `true` | - | Identifier of a card, used in service calls. **Must be unique!** |
| `card` | `card` | `true` | - | Configuration of a nested card |
| `default` | `string` | `false` | `hide` | Default card behaviour. Possible values: [`show`, `hide`]. |
| `persist_state` | `boolean` | `false` | `false` | Enables storing card's state in local storage to restore it after page refresh. |## Usage
This card utilises `fire-dom-event` actions to change its state:
```yaml
tap_action:
action: fire-dom-event
local_conditional_card:
action: show
ids:
- id_1
```There are 4 available actions
- `show` - shows specified cards
- `hide` - hides specified cards
- `toggle` - changes visibility of specified cards
- `set` - sets visibility of specified cards
Each of these services requires a parameter `ids` that should contain a list:
```yaml
tap_action:
action: fire-dom-event
local_conditional_card:
action: show
ids:
- id_1
- id_2
```
```yaml
tap_action:
action: fire-dom-event
local_conditional_card:
action: hide
ids:
- id_1
- id_2
```
```yaml
tap_action:
action: fire-dom-event
local_conditional_card:
action: toggle
ids:
- id_1
- id_2
```
```yaml
tap_action:
action: fire-dom-event
local_conditional_card:
action: set
ids:
- id_1: show
- id_2: hide
- id_3: toggle
```## Example configuration
![Example](https://github.com/PiotrMachowski/Home-Assistant-Lovelace-Local-Conditional-card/raw/master/s1.gif)
```yaml
views:
- name: Example
cards:
- type: 'custom:local-conditional-card'
default: show
id: sun1
card:
entities:
- sun.sun
title: Sun 1
type: entities
- type: 'custom:local-conditional-card'
id: sun2
card:
entities:
- sun.sun
title: Sun 2
type: entities
- title: Click test
type: entities
entities:
- action_name: Toggle
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: toggle
ids:
- sun1
type: button
- action_name: Show
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: show
ids:
- sun1
type: button
- action_name: Hide
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: hide
ids:
- sun1
type: button
- action_name: Hide All
icon: mdi:power
name: Suns
tap_action:
action: fire-dom-event
local_conditional_card:
action: hide
ids:
- sun1
- sun2
type: button
- action_name: Toggle
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: toggle
ids:
- sun2
type: button
- action_name: Show
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: show
ids:
- sun2
type: button
- action_name: Hide
icon: mdi:power
name: Sun1
tap_action:
action: fire-dom-event
local_conditional_card:
action: hide
ids:
- sun2
type: button
```## Support
If you want to support my work with a donation you can use one of the following platforms:
Platform
Payment methods
Link
Comment
Ko-fi
buycoffee.to
PayPal
Revolut
[ko_fi_shield]: https://img.shields.io/static/v1.svg?label=%20&message=Ko-Fi&color=F16061&logo=ko-fi&logoColor=white
[ko_fi]: https://ko-fi.com/piotrmachowski
[buycoffee_to_shield]: https://shields.io/badge/buycoffee.to-white?style=flat&labelColor=white&logo=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MI9nMFe0BkFzVOYrYqycyQgQJLwTC2cDZCPeF8V5Y7jGb8BUpRicy7OU5MAAAAASUVORK5CYII=
[buycoffee_to]: https://buycoffee.to/piotrmachowski
[buy_me_a_coffee_shield]: https://img.shields.io/static/v1.svg?label=%20&message=Buy%20me%20a%20coffee&color=6f4e37&logo=buy%20me%20a%20coffee&logoColor=white
[buy_me_a_coffee]: https://www.buymeacoffee.com/PiotrMachowski
[paypal_me_shield]: https://img.shields.io/static/v1.svg?label=%20&message=PayPal.Me&logo=paypal
[paypal_me]: https://paypal.me/PiMachowski
[revolut_me_shield]: https://img.shields.io/static/v1.svg?label=%20&message=Revolut&logo=revolut
[revolut_me]: https://revolut.me/314ma