Skip to content

Commit 7630e20

Browse files
authored
Merge pull request #804 from UI-Lovelace-Minimalist/automated_custom_card_docs
[Action] Update custom_cards docs
2 parents 2e7964d + 05d1efe commit 7630e20

File tree

1 file changed

+135
-0
lines changed

1 file changed

+135
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
title: Custom Card Ristou Person
3+
hide:
4+
- toc
5+
---
6+
7+
<!-- markdownlint-disable MD046 -->
8+
9+
# Custom Card Ristou Person
10+
11+
<table>
12+
<tbody>
13+
<tr>
14+
<td><img src="../../assets/img/custom_card_ristou_person/custom_card_ristou_person_light.png"></td>
15+
<td><img src="../../assets/img/custom_card_ristou_person/custom_card_ristou_person_dark.png"></td>
16+
</tr>
17+
</tbody>
18+
</table>
19+
20+
## Credits
21+
22+
- Author: Ristou - 2022
23+
- Version: 1.0.0
24+
25+
## Changelog
26+
27+
<details>
28+
<summary>1.0.0</summary>
29+
Initial release
30+
</details>
31+
32+
## Description
33+
34+
The `custom_card_ristou_person` shows if a person is `home` or `not_home`. If you have setup other zones, it will show these as well (e.g `work`, `school`, `doctor`, etc... ).
35+
Work
36+
Showing driving state is also possible with a binary sensor.
37+
38+
In addition, this card can display a map (either static or using buit in map) in a second row.
39+
40+
## Icon style
41+
42+
As the main icon of this card you can choose the following set up
43+
| Variables | UI |
44+
|---------|----|
45+
| ulm_custom_card_ristou_use_badge: `true` <br> ulm_custom_card_ristou_use_entity_picture: `false`| ![face_icon_badge](../../assets/img/custom_card_ristou_person/custom_card_ristou_person_face_icon_badge.png) |
46+
| ulm_custom_card_ristou_use_badge: `true` <br> ulm_custom_card_ristou_use_entity_picture: `true`| ![picture_badge](../../assets/img/custom_card_ristou_person/custom_card_ristou_person_picture_badge.png) |
47+
| ulm_custom_card_ristou_use_badge: `false` <br> ulm_custom_card_ristou_use_entity_picture: `false` | ![icon_only](../../assets/img/custom_card_ristou_person/custom_card_ristou_person_icon_only.png) |
48+
49+
## map style
50+
51+
| Variables | UI |
52+
|---------|----|
53+
|ulm_custom_card_ristou_camera_entity_light != "" and <br> ulm_custom_card_ristou_camera_entity_dark != "" | ![camera](../../assets/img/custom_card_ristou_person/custom_card_ristou_person_camera.png)|
54+
| ulm_custom_card_ristou_map_enable: `true` | ![map](../../assets/img/custom_card_ristou_person/custom_card_ristou_person_map.png) |
55+
| ulm_custom_card_ristou_camera_entity_light = "" and <br>ulm_custom_card_ristou_camera_entity_dark = "" and <br>ulm_custom_card_ristou_map_enable = `false` | ![no_map](../../assets/img/custom_card_ristou_person/custom_card_ristou_person_no_map.png) |
56+
57+
## About Static maps
58+
59+
The advantage of static map is that it is easy to custom and non-draggable.
60+
For instance when you scroll down and you accidently press first on map card.
61+
62+
I choose map box for the following reasons:
63+
64+
- Easy to sep it up with [static image API playground](https://docs.mapbox.com/playground/static/)
65+
- Already existing styles (light & dark) to fit to your theme.
66+
- Add many custom markers, I decided to represent my current location , home, and work.
67+
- Possibility to remove attribution and logo.
68+
69+
URL can be direclty used inside a camera entity using dynamic markers as explain [here](https://www.home-assistant.io/examples/google_maps_card/)
70+
71+
below is an example of the url I use for mapbox:
72+
73+
``` yaml
74+
https://api.mapbox.com/styles/v1/mapbox/light-v10/static/pin-l-suitcase+f88927({{ state_attr('zone.work', 'longitude') }},{{ state_attr('zone.work', 'latitude') }}),pin-l-home+01C852({{ state_attr('zone.home', 'longitude') }},{{ state_attr('zone.home', 'latitude') }}),pin-l-m+3D5AFE({{ state_attr('device_tracker.mathieu_phone', 'longitude') }},{{ state_attr('device_tracker.mathieu_phone', 'latitude') }})/auto/466x200?attribution=false&logo=false&&access_token=YOUR_TOKEN
75+
```
76+
77+
## Known issues
78+
79+
### map
80+
81+
built in map is not always rendering properly. I observed 2 issues:
82+
83+
- Not displaying if under sub stack like `horizontal stack` or `vertical stack`. another map has to be added somewhere else in the page. [Github issue](https://github.com/home-assistant/frontend/issues/12023)
84+
- In IOS (never tried with other devices) bottom corner radius is not taken into consideration
85+
86+
### Static map
87+
88+
Static map can be blurry if ratio does not fit card width.
89+
In my case I used developper tool to find out exact width of the card (which is 466px) and then I ajusted the heigh to my needs.
90+
91+
## Variables
92+
93+
| Variable | Default | Required | Notes |
94+
|----------|---------|------------------|-------------------|
95+
| entity | | ✔️ | person entity |
96+
| ulm_custom_card_ristou_use_entity_picture | false || If you set this to true, the card shows the entity picture from your user, otherwise (set to false) shows the icon. Default is false. |
97+
| ulm_custom_card_ristou_use_badge | true || Show a notification badge on the icon. if set to false and not sing entity picture, then icon will be dinamically displayed to (Home, Away, Known place, or CAR) |
98+
| ulm_custom_card_ristou_map_enable |false|| Display built in map as a second row |
99+
| ulm_custom_card_ristou_map_aspect_ratio |16:5|| Display built in map as a second row |
100+
| ulm_custom_card_ristou_map_hours_to_show |24|| Display built in map as a second row |
101+
| ulm_custom_card_ristou_map_default_zoom |9|| Display built in map as a second row |
102+
| ulm_custom_card_ristou_camera_entity_light | || Camera entity picture in light mode |
103+
| ulm_custom_card_ristou_camera_entity_dark | || Camera entity picture in dark mode |
104+
| ulm_custom_card_ristou_zones | || Used to display known zone on badge, icon, label or map |
105+
| ulm_custom_card_ristou_find_device_script | || Show a button to find your device |
106+
107+
## Usage
108+
109+
```yaml
110+
- type: "custom:button-card"
111+
template: custom_card_ristou_person
112+
entity: person.mathieu
113+
variables:
114+
ulm_custom_card_ristou_use_entity_picture: true
115+
ulm_custom_card_ristou_find_device_script: script.find_phone_mathieu
116+
ulm_custom_card_ristou_person_driving_entity: binary_sensor.mathieu_driving
117+
ulm_custom_card_ristou_camera_entity_light: "camera.mapbox_mathieu_light"
118+
ulm_custom_card_ristou_camera_entity_dark: "camera.mapbox_mathieu_dark"
119+
ulm_custom_card_ristou_zones:
120+
- person.isabelle
121+
- person.mathieu
122+
- zone.work
123+
- zone.judo
124+
- zone.doctor
125+
- zone.nounou
126+
- zone.work_isabelle
127+
```
128+
129+
## Template code
130+
131+
??? note "Template Code"
132+
133+
```yaml title="custom_card_ristou_person.yaml"
134+
--8<-- "custom_cards/custom_card_ristou_person/custom_card_ristou_person.yaml"
135+
```

0 commit comments

Comments
 (0)