-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsaved_messages_card.yaml
60 lines (55 loc) · 2.04 KB
/
saved_messages_card.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
###############################################################################
## Saved Messages Entities Card
## - card mod plugin required to use styles to center the buttons
## - vertical-stack-in-card required to combine the cards into one
## https://github.com/thomasloven/lovelace-card-mod
## https://github.com/ofekashery/vertical-stack-in-card
###############################################################################
type: custom:vertical-stack-in-card
cards:
- type: entities
title: "Saved Messages"
entities:
- entity: sensor.tts_saved_messages
name: "Saved Messages"
- type: buttons
entities:
- entity: script.tts_play_saved_messages
name: Play Messages
tap_action:
action: call-service
service: script.tts_play_saved_messages
service_data:
skip_none: false
- entity: script.tts_play_last_message
name: Last Message
tap_action:
action: call-service
service: script.tts_play_last_message
- entity: script.tts_clear_saved_messages
name: Clear Messages
tap_action:
action: call-service
service: script.tts_clear_saved_messages
card_mod:
style:
hui-buttons-base $: |
.ha-scrollbar {
justify-content: center;
}
- type: conditional
conditions:
- entity: sensor.tts_saved_messages
state_not: 0
card:
type: markdown
content: |
{%- set msgnum = namespace(value=0) %}
{%- for key,value in states.sensor.tts_saved_messages.attributes.items()
if key not in ['icon','friendly_name'] %}
{%- if loop.index % 2 == 1 %}
{%- set msgnum.value = msgnum.value + 1 %}
- **{{ value }}**
<sup>{{ as_datetime(state_attr('sensor.tts_saved_messages','msg_time' ~ msgnum.value)).strftime('%A, %B %-d at %-I:%M %p') }}</sup>
{% endif %}
{% endfor %}