-
Notifications
You must be signed in to change notification settings - Fork 2
/
Z2M-IKEA-STYRBAR-remote.yaml
137 lines (136 loc) · 4.19 KB
/
Z2M-IKEA-STYRBAR-remote.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
blueprint:
name: Ikea Styrbar Remote
description: Control your lights with the IKEA STYRBAR remote. You can also set actions for the left and right button.
domain: automation
input:
transition_time:
name: Transition time
description: Transition time for the target lights in seconds
selector:
number:
min: 1.0
max: 60.0
mode: slider
step: 0.1
unit_of_measurement: 'sec'
remote:
name: Remote
description: The action entity of your Styrbar remote
selector:
entity:
domain: sensor
target_light:
name: Lights
description: The lights you want to control with the remote
selector:
target:
entity:
domain: light
button_left:
name: Left button
description: Action to run on left button press
default: []
selector:
action: {}
button_right:
name: right button
description: Action to run on right button press
default: []
selector:
action: {}
brightness:
name: Brightness
description: The brightness you want your lights to be when turning them on
default: 100
selector:
number:
min: 0.0
max: 100.0
mode: slider
step: 1.0
unit_of_measurement: '%'
force_brightness:
name: Force Brightness
description: Force the above set brightness when turning on the lamps?
default: false
selector:
boolean: {}
source_url: https://raw.githubusercontent.com/Computerfreak14/Z2M-Styrbar-remote-blueprint/main/Z2M-IKEA-STYRBAR-remote.yaml
trigger:
- platform: state
entity_id: !input 'remote'
attribute: action
condition: []
action:
- variables:
command: '{{ trigger.to_state.state }}'
- choose:
- conditions:
- condition: template
value_template: '{{ command == ''on'' }}'
sequence:
- choose:
- conditions: '{{ force_brightness }}'
sequence:
- service: light.turn_on
target: !input 'target_light'
data:
transition: !input transition_time
brightness_pct: !input 'brightness'
color_name: white
default:
- service: light.turn_on
target: !input 'target_light'
data:
transition: !input transition_time
color_name: white
- conditions:
- condition: template
value_template: '{{ command == ''off'' }}'
sequence:
- service: light.turn_off
target: !input 'target_light'
data:
transition: !input transition_time
- conditions:
- condition: template
value_template: '{{ command == ''brightness_move_down'' }}'
sequence:
- repeat:
until:
- condition: state
entity_id: !input 'remote'
state: brightness_stop
attribute: action
sequence:
- service: light.turn_on
data:
brightness_step_pct: -10
transition: !input transition_time
target: !input 'target_light'
- delay: '1'
- conditions:
- condition: template
value_template: '{{ command == ''brightness_move_up'' }}'
sequence:
- repeat:
until:
- condition: state
entity_id: !input 'remote'
state: brightness_stop
attribute: action
sequence:
- service: light.turn_on
data:
brightness_step_pct: +10
transition: !input transition_time
target: !input 'target_light'
- delay: '1'
- conditions:
- '{{ command == ''arrow_left_click'' }}'
sequence: !input 'button_left'
- conditions:
- '{{ command == ''arrow_right_click'' }}'
sequence: !input 'button_right'
mode: restart
max_exceeded: silent