forked from urbas/ha-philips-dimmer-switch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdimmable-bulb.yaml
104 lines (100 loc) · 2.82 KB
/
dimmable-bulb.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
blueprint:
name: "Philips Hue Dimmer Switch: Dimmable Bulb v1"
description: "Control a single dimmable bulb."
domain: automation
source_url: https://github.com/mkarimv/ha-philips-dimmer-switch/blob/master/dimmable-bulb.yaml
input:
remote:
name: Philips Hue Dimmer Switch
description: Pick either RWL020 (US) or RWL021 (EU)
selector:
device:
integration: zha
manufacturer: Philips
entity:
domain: sensor
device_class: battery
multiple: false
lights:
name: lights
description: The light(s) to control
selector:
target:
entity:
- domain:
- all
mode: restart
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input remote
action:
# https://www.home-assistant.io/docs/scripts/#variables
# https://www.home-assistant.io/docs/blueprint/schema/#blueprint-inputs-in-templates
- variables:
command: "{{ trigger.event.data.command }}"
# bulb.device_id
bulb: !input lights
- choose:
# turn bulb on
- conditions:
- "{{ command == 'on_press' }}"
sequence:
- action: light.turn_on
target: !input lights
data:
brightness_pct: 100
transition: 1
# turn bulb on to minimum brightness
- conditions:
- "{{ command == 'on_hold' }}"
sequence:
- service: light.turn_on
target: !input lights
data:
brightness_pct: 1
transition: 1
# bulb brightness up
- conditions:
- "{{ command == 'up_hold' }}"
sequence:
- service: light.turn_on
target: !input lights
data:
brightness_step_pct: 20
transition: 1
- conditions:
- "{{ command == 'up_short_release' }}"
sequence:
- service: light.turn_on
target: !input lights
data:
brightness_step_pct: 5
transition: 0
# bulb brightness down
- conditions:
- "{{ command == 'down_hold' }}"
sequence:
- service: light.turn_on
target: !input lights
data:
brightness_step_pct: -20
transition: 1
- conditions:
- "{{ command == 'down_short_release' }}"
sequence:
- service: light.turn_on
target: !input lights
data:
brightness_step_pct: -5
transition: 0
# turn bulb off
- conditions:
- "{{ command == 'off_press' }}"
sequence:
- service: homeassistant.turn_off
target: !input lights
data:
transition: 0