-
Notifications
You must be signed in to change notification settings - Fork 3
/
multinotify_ui.yaml
executable file
·75 lines (72 loc) · 2.5 KB
/
multinotify_ui.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
# -------------------------------------------------------------------------------------------------
# Package Multinotify - Entità in appoggio per UI
# -------------------------------------------------------------------------------------------------
input_text:
multinotify_message:
name: Messagge
icon: mdi:text-box-edit-outline
input_select:
multinotify_dest:
name: Destination
icon: mdi:speaker
options:
- Pian terreno
- Primo piano
- Mansarda
- Ovunque
input_number:
multinotify_volume:
name: Volume
icon: mdi:volume-high
initial: 6
min: 1
max: 10
step: 1
input_boolean:
multinotify_executing:
name: Announce execution
icon: mdi:account-voice
initial: false
script:
multinotify_button:
alias: "Multinotify from UI"
description: "Allows to call multinotify from UI. Uses the input_* called multinotify_*"
variables:
msg: "{{states('input_text.multinotify_message') | default('')}}"
dest: >-
{% set destinazioni =
[
{'text': 'Pian terreno', 'value': 'media_player.pian_terreno'},
{'text': 'Primo piano', 'value': 'media_player.primo_piano'},
{'text': 'Mansarda', 'value': 'media_player.mansarda'},
{'text': 'Ovunque', 'value': 'media_player.ovunque'}
]
%}
{{destinazioni | selectattr('text', 'eq', states('input_select.multinotify_dest') | default('')) | map(attribute='value') | first | default('')}}
sequence:
- alias: "Correct destination?"
condition: template
value_template: "{{ dest != '' }}"
- alias: "Message present?"
condition: template
value_template: "{{ msg != '' }}"
- alias: "In execution"
service: input_boolean.turn_on
data:
entity_id: input_boolean.multinotify_executing
- alias: "Multinotify calling"
service: script.multinotify
data:
message: "{{msg}}"
alexa_target: "{{dest}}"
alexa_volume: "{{(states('input_number.multinotify_volume') | float(60) / 10) | round(1)}}"
alexa_force: true
- alias: "End of execution"
service: input_boolean.turn_off
data:
entity_id: input_boolean.multinotify_executing
- alias: "Message reset"
service: input_text.set_value
data:
entity_id: input_text.multinotify_message
value: ""