forked from jesserockz/wizmote-esphome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwizmote-esphome-blueprint.yml
123 lines (120 loc) · 3.65 KB
/
wizmote-esphome-blueprint.yml
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
blueprint:
name: ESPHome Wizmote Receiver
domain: automation
source_url: https://github.com/jesserockz/wizmote-esphome/blob/main/wizmote-esphome-blueprint.yml
input:
remote:
name: WizMote Mac address
description: Mac address of the WizMote can be found by watching for
the 'esphome.wizmote_choose' or 'esphome.wizmote_action' events
as you press a button.
selector:
text:
brightness_dim:
name: Brightness when moon button pressed
selector:
number:
min: 1
max: 100
unit_of_measurement: "%"
brightness_step:
name: Brightness step when pressing or holding dimmer buttons
selector:
number:
min: 1
max: 50
unit_of_measurement: "%"
light_one:
name: Light 1
description: The light to control after pressing 1
selector:
target:
entity:
domain: light
light_two:
name: Light 2
description: The light to control after pressing 2
selector:
target:
entity:
domain: light
light_three:
name: Light 3
description: The light to control after pressing 3
selector:
target:
entity:
domain: light
light_four:
name: Light 4
description: The light to control after pressing 4
selector:
target:
entity:
domain: light
mode: restart
trigger:
platform: event
event_type: esphome.wizmote_choose
event_data:
mac: !input "remote"
action:
- variables:
button: "{{ trigger.event.data.button | int }}"
brightness_step: !input brightness_step
light_one: !input light_one
light_two: !input light_two
light_three: !input light_three
light_four: !input light_four
light: "\n{% if button == 1 %}\n \
\ {{ light_one }}\n \
\ {% elif button == 2 %}\n \
\ {{ light_two }}\n \
\ {% elif button == 3 %}\n \
\ {{ light_three }}\n \
\ {% elif button == 4 %}\n \
\ {{ light_four }}\n \
\ {% endif %}\n"
- repeat:
until:
- "{{ wait.trigger == none }}"
sequence:
- wait_for_trigger:
- platform: event
event_type: esphome.wizmote_action
event_data:
mac: !input "remote"
continue_on_timeout: false
timeout: 00:00:05
- choose:
- conditions:
- "{{ wait.trigger.event.data.button | int == 1 }}"
sequence:
- service: light.turn_on
target: "{{ light }}"
- conditions:
- "{{ wait.trigger.event.data.button | int == 2 }}"
sequence:
- service: light.turn_off
target: "{{ light }}"
- conditions:
- "{{ wait.trigger.event.data.button | int == 3 }}"
sequence:
- service: light.turn_on
target: "{{ light }}"
data:
brightness_pct: !input brightness_dim
- conditions:
- "{{ wait.trigger.event.data.button | int == 8 }}"
sequence:
- service: light.turn_on
target: "{{ light }}"
data:
brightness_step_pct: "-{{ brightness_step }}"
- conditions:
- "{{ wait.trigger.event.data.button | int == 9 }}"
sequence:
- service: light.turn_on
target: "{{ light }}"
data:
brightness_step_pct: "{{ brightness_step }}"