Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
basbruss authored Jun 28, 2022
2 parents e627dc5 + 7630e20 commit 0573e34
Show file tree
Hide file tree
Showing 19 changed files with 684 additions and 111 deletions.
6 changes: 6 additions & 0 deletions custom_cards/custom_card_imswel_person/languages/nl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
ulm_custom_card_imswel_person_language_variables:
variables:
ulm_custom_card_imswel_person_home: "Thuis"
ulm_custom_card_imswel_person_not_home: "Afwezig"
ulm_custom_card_imswel_person_findmy: "Zoek mijn Telefoon"
59 changes: 5 additions & 54 deletions custom_cards/custom_card_nik_clock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,57 +65,8 @@ Initial release
## Template Sensor Code
```yaml
---
custom_card_nik_clock:
template:
- "ulm_language_variables"
variables:
ulm_custom_card_nik_clock_switch: "[[[ return variables.ulm_custom_card_nik_clock_switch ]]]"
ulm_custom_card_nik_clock_switch_enable: false
show_icon: false
show_name: true
show_state: false
show_label: true
name: >
[[[
const time = new Date();
let hour = time.getHours();
let minute = (time.getMinutes()<10?'0':'') + time.getMinutes()
return hour + ":" + minute;
]]]
layout: "vertical"
label: >
[[[
const event = new Date();
const options = {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
var locale = variables.ulm_language;
let formatted_date = event.toLocaleDateString(locale, options);
return formatted_date;
]]]
tap_action:
action: >
[[[
if (variables.ulm_custom_card_nik_clock_switch_enable){
return 'call-service'
}
else{
return 'none'
}
]]]
service: "input_boolean.toggle"
service_data:
entity_id: "[[[ return variables.ulm_custom_card_nik_clock_switch ]]]"
styles:
card:
- background-color: "transparent"
- height: "100px"
- box-shadow: "none"
name:
- font-size: "290%"
- font-weight: "bold"
- justify-self: "center"
label:
- justify-self: "center"
- font-size: "110%"
```
??? note "Template Code"
```yaml title="custom_card_irmajavi_weather.yaml"
--8<-- "custom_cards/custom_card_nik_clock/custom_card_nik_clock.yaml"
```
9 changes: 6 additions & 3 deletions custom_cards/custom_card_nik_clock/custom_card_nik_clock.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
custom_card_nik_clock:
template:
- "ulm_language_variables"
triggers_update: "all"
variables:
ulm_custom_card_nik_clock_switch: "[[[ return variables.ulm_custom_card_nik_clock_switch ]]]"
ulm_custom_card_nik_clock_switch:
ulm_custom_card_nik_clock_switch_enable: false
ulm_language: >
[[[
return hass["language"];
]]]
show_icon: false
show_name: true
show_state: false
Expand Down
1 change: 1 addition & 0 deletions custom_cards/custom_card_nik_tablet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Fix for UI Minimalist v1.0.1.
- To have all the Minimalist Cards and Custom Cards;
- To have installed and configured Kiosk APP on the Tablet (enabled permissions etc...);
- To have the HACS Integration "Fully Kiosk Browser" installed and configured in HomeAssistant;
- Add [Bar Card](https://github.com/custom-cards/bar-card) to HACS frontend

## Usage

Expand Down
135 changes: 135 additions & 0 deletions custom_cards/custom_card_ristou_person/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
title: Custom Card Ristou Person
hide:
- toc
---

<!-- markdownlint-disable MD046 -->

# Custom Card Ristou Person

<table>
<tbody>
<tr>
<td><img src="../../docs/assets/img/custom_card_ristou_person/custom_card_ristou_person_light.png"></td>
<td><img src="../../docs/assets/img/custom_card_ristou_person/custom_card_ristou_person_dark.png"></td>
</tr>
</tbody>
</table>

## Credits

- Author: Ristou - 2022
- Version: 1.0.0

## Changelog

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

## Description

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... ).
Work
Showing driving state is also possible with a binary sensor.

In addition, this card can display a map (either static or using buit in map) in a second row.

## Icon style

As the main icon of this card you can choose the following set up
| Variables | UI |
|---------|----|
| ulm_custom_card_ristou_use_badge: `true` <br> ulm_custom_card_ristou_use_entity_picture: `false`| ![face_icon_badge](../../docs/assets/img/custom_card_ristou_person/custom_card_ristou_person_face_icon_badge.png) |
| ulm_custom_card_ristou_use_badge: `true` <br> ulm_custom_card_ristou_use_entity_picture: `true`| ![picture_badge](../../docs/assets/img/custom_card_ristou_person/custom_card_ristou_person_picture_badge.png) |
| ulm_custom_card_ristou_use_badge: `false` <br> ulm_custom_card_ristou_use_entity_picture: `false` | ![icon_only](../../docs/assets/img/custom_card_ristou_person/custom_card_ristou_person_icon_only.png) |

## map style

| Variables | UI |
|---------|----|
|ulm_custom_card_ristou_camera_entity_light != "" and <br> ulm_custom_card_ristou_camera_entity_dark != "" | ![camera](../../docs/assets/img/custom_card_ristou_person/custom_card_ristou_person_camera.png)|
| ulm_custom_card_ristou_map_enable: `true` | ![map](../../docs/assets/img/custom_card_ristou_person/custom_card_ristou_person_map.png) |
| 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](../../docs/assets/img/custom_card_ristou_person/custom_card_ristou_person_no_map.png) |

## About Static maps

The advantage of static map is that it is easy to custom and non-draggable.
For instance when you scroll down and you accidently press first on map card.

I choose map box for the following reasons:

- Easy to sep it up with [static image API playground](https://docs.mapbox.com/playground/static/)
- Already existing styles (light & dark) to fit to your theme.
- Add many custom markers, I decided to represent my current location , home, and work.
- Possibility to remove attribution and logo.

URL can be direclty used inside a camera entity using dynamic markers as explain [here](https://www.home-assistant.io/examples/google_maps_card/)

below is an example of the url I use for mapbox:

``` yaml
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
```

## Known issues

### map

built in map is not always rendering properly. I observed 2 issues:

- 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)
- In IOS (never tried with other devices) bottom corner radius is not taken into consideration

### Static map

Static map can be blurry if ratio does not fit card width.
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.

## Variables

| Variable | Default | Required | Notes |
|----------|---------|------------------|-------------------|
| entity | | ✔️ | person entity |
| 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. |
| 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) |
| ulm_custom_card_ristou_map_enable |false|| Display built in map as a second row |
| ulm_custom_card_ristou_map_aspect_ratio |16:5|| Display built in map as a second row |
| ulm_custom_card_ristou_map_hours_to_show |24|| Display built in map as a second row |
| ulm_custom_card_ristou_map_default_zoom |9|| Display built in map as a second row |
| ulm_custom_card_ristou_camera_entity_light | || Camera entity picture in light mode |
| ulm_custom_card_ristou_camera_entity_dark | || Camera entity picture in dark mode |
| ulm_custom_card_ristou_zones | || Used to display known zone on badge, icon, label or map |
| ulm_custom_card_ristou_find_device_script | || Show a button to find your device |

## Usage

```yaml
- type: "custom:button-card"
template: custom_card_ristou_person
entity: person.mathieu
variables:
ulm_custom_card_ristou_use_entity_picture: true
ulm_custom_card_ristou_find_device_script: script.find_phone_mathieu
ulm_custom_card_ristou_person_driving_entity: binary_sensor.mathieu_driving
ulm_custom_card_ristou_camera_entity_light: "camera.mapbox_mathieu_light"
ulm_custom_card_ristou_camera_entity_dark: "camera.mapbox_mathieu_dark"
ulm_custom_card_ristou_zones:
- person.isabelle
- person.mathieu
- zone.work
- zone.judo
- zone.doctor
- zone.nounou
- zone.work_isabelle
```
## Template code
??? note "Template Code"
```yaml title="custom_card_ristou_person.yaml"
--8<-- "custom_cards/custom_card_ristou_person/custom_card_ristou_person.yaml"
```
Loading

0 comments on commit 0573e34

Please sign in to comment.