-
Notifications
You must be signed in to change notification settings - Fork 9
/
awtrix-simple.yaml
160 lines (137 loc) · 3.73 KB
/
awtrix-simple.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
blueprint:
name: AWTRIX show entity
description: Show entity
domain: automation
input:
app_name:
name: (Required) Application name
description: "Application name"
default: "awtrix_app"
selector:
text:
multiline: false
multiple: false
app_icon:
name: Application Icon
description: "Application icon"
default: ""
selector:
text:
multiline: false
multiple: false
entity:
name: Entity
description: Entity
selector:
entity:
multiple: false
prefix_text:
name: Text prefix
description: "Text prefix"
selector:
object:
default: ""
suffix_text:
name: Text suffix
description: "Text suffix"
selector:
object:
default: ""
extra_triggers:
name: Extra Triggers
description: Additional triggers to actions.
default:
selector:
trigger:
pre_actions:
name: Actions
description: Actions when starting...
selector:
action:
default:
additional_options:
name: Additional options
description: Extra options
selector:
object:
default: {}
user_options:
name: AWTRIX application options
description: AWTRIX application useroptions.
selector:
object:
default:
duration: 5
additional_conditions:
name: Additional conditions
description: |
Extra conditions you may want to add to this automation
(Example: Home occupied, TV on, etc)
default: []
selector:
condition:
awtrix_device:
name: AWTRIX device
description: The AWTRIX device for show app.
default: []
selector:
device:
integration: mqtt
manufacturer: Blueforcer
model: AWTRIX 3
multiple: true
trigger:
- platform: state
entity_id: !input entity
id: update
- platform: homeassistant
event: start
id: update
- platform: event
event_type: automation_reloaded
id: update
- triggers: !input extra_triggers
variables:
entity_id: !input entity
app_name: !input app_name
app_icon: !input app_icon
additional_conditions: !input additional_conditions
condition: []
action:
- choose: []
default: !input pre_actions
- &variable_entity
alias: Variable Entity
variables:
!input additional_options
- variables:
<<: *variable_entity
device_ids: !input awtrix_device
# deprecated !
user_data: !input additional_options
value_template: "{{ user_data.get('value_template', states(entity_id)) }}"
icon_template: "{{ user_data.get('icon_template', app_icon) }}"
prefix_text: !input prefix_text
suffix_text: !input suffix_text
user_options: !input user_options
payload: |-
{
{{('"icon"' if icon_template) ~ (":" if icon_template) ~ ('"' ~ icon_template ~ '"' if icon_template) }}
{{"," if icon_template}} "text":"{{prefix_text~value_template~suffix_text}}"
}
- repeat:
for_each: "{{ device_ids }}"
sequence:
- variables:
awtrix_device_name: "{{ iif( device_attr(repeat.item, 'name_by_user') != none, device_attr(repeat.item, 'name_by_user'), device_attr(repeat.item, 'name') ) }}"
- if: !input additional_conditions
then:
- service: awtrix.{{awtrix_device_name}}_push_app_data
data:
name: "{{app_name}}"
data: "{{ dict(payload, **user_options) }}"
else:
- service: awtrix.{{awtrix_device_name}}_push_app_data
data:
name: "{{app_name}}"
data: {}