Skip to content

Commit

Permalink
Merge pull request #1210 from UI-Lovelace-Minimalist/automated_custom…
Browse files Browse the repository at this point in the history
…_card_docs

[Action] Update custom_cards docs
  • Loading branch information
basbruss committed Mar 24, 2023
2 parents 2559e89 + b6a53ac commit 6189c6c
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions docs/usage/custom_cards/custom_chip_group_counter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: Custom Chip Group Counter
hide:
- toc
---

<!-- markdownlint-disable MD046 -->

# Custom Card "Group Counter"

![example-image-light](../../assets/img/custom_card_group_counter_chip_light.png)
![example-image-dark](../../assets/img/custom_card_group_counter_chip_dark.png)

## Credits

- Author: Albin Médoc - 2023
Version: 1.0.0

## Changelog

<details>
<summary>1.0.0</summary>
Initial release
</details>

## Description

This cards show a chip with custom text representing how many entities in a group have a specific state. Pressing on the chip will toggle the entity group, eg turn on/off all lights.

## Variables

| Variable | Default | Required | Notes |
| ------------------------------------------- | ------------------------ | -------- | -------------------------------------------------------------------------------------------------- |
| entity | | Yes | Hide chip if no entities are active. |
| ulm_custom_chip_group_counter_hide_if_zero | false | No | Hide chip if no entities are active. |
| ulm_custom_chip_group_counter_type | light | No | Specify the type of entities, used for translation |
| ulm_custom_chip_group_counter_count_state | on | No | States that should be counted |
| ulm_custom_chip_group_counter_color | yellow | Yes | Color of the icon <br> Can choose between: `blue`, `red`, `green`, `yellow`, `pink`, `purple` <br> |
| ulm_custom_chip_group_counter_icon_zero | mdi:lightbulb-outline | No | Icon when no entity's state is satisfied |
| ulm_custom_chip_group_counter_icon_one | mdi:lightbulb-on-outline | No | Icon when one entity's state is satisfied |
| ulm_custom_chip_group_counter_icon_multiple | mdi:lightbulb-on-outline | No | Icon when multiple entities state is satisfied |

## Usage

### Minimal config 1

The entities active within the group will only go one level down. If you have a group with a group the subgroup will only be treated as a single entity.

```yaml
- type: 'custom:button-card'
template: 'custom_card_group_counter_chip'
entity: 'lights.living_room'
```
### Minimal config 2
This configuration can be used if you have a sensor that should represent the state. This can be good if you have groups within groups and the calculation is happening outside this card. The entity must still be set and should represent all the entities that should be toggled on press.
```yaml
- type: 'custom:button-card'
template: 'custom_card_group_counter_chip'
entity: 'light.all'
variables:
ulm_custom_chip_group_counter_entities_active: 'sensor.lights_on'
```
### Full config 2
```yaml
- type: 'custom:button-card'
template: 'custom_card_group_counter_chip'
entity: 'light.all'
variables:
ulm_custom_card_group_counter_chip_hide_if_zero: true
ulm_custom_card_group_counter_chip_type: speaker
ulm_custom_card_group_counter_chip_count_state:
- 'playing'
- 'buffering'
ulm_custom_card_group_counter_chip_color: green
ulm_custom_card_group_counter_chip_icon_zero: 'mdi:speaker'
ulm_custom_card_group_counter_chip_icon_one: 'mdi:speaker'
ulm_custom_card_group_counter_chip_icon_multiple: 'mdi:speaker-multiple'
```
## Template code
??? note "Template Code"
```yaml title="custom_chip_group_counter.yaml"
--8<-- "custom_cards/custom_chip_group_counter/custom_chip_group_counter.yaml"
```

0 comments on commit 6189c6c

Please sign in to comment.