blob: 9ea8655761136e15e4fa4d871492d8441287729b (
plain)
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
|
blueprint:
name: Light Switch Combo
description: Switch to control another switch, light bulb, or power plug (no sync) and allow another action on double click
domain: automation
input:
switch:
name: switch
description: controller
selector:
entity:
domain: switch
master:
name: master
description: another switch, smart bulb, or power socket
selector:
entity:
dblclick:
name: dblclick
description: Actions to perform on double click
default: []
selector:
action:
on_click:
name: on_click
description: Additional actions to perform while turning on master switch
default: []
selector:
action:
off_click:
name: off_click
description: Additional actions to perform while turning off master switch
default: []
selector:
action:
#variables:
# switch_entity: !input switch
# master_entity: !input master
trigger:
- platform: state
entity_id: !input "switch"
# Can't do 'restart' since it will break wait_for_trigger
mode: single
action:
- wait_for_trigger:
- platform: state
entity_id: !input switch
timeout: '1'
continue_on_timeout: true
- if:
- condition: template
value_template: '{{ wait.trigger == None }}'
then:
- if:
- condition: state
entity_id: !input switch
state: 'on'
then:
- if:
- condition: state
entity_id: !input master
state: 'on'
then:
- parallel:
- service: homeassistant.toggle
target:
entity_id: !input master
- choose: []
default: !input "off_click"
else:
- parallel:
- service: homeassistant.toggle
target:
entity_id: !input master
- choose: []
default: !input "on_click"
else:
- choose: []
default: !input "dblclick"
# - service: switch.turn_off
# target:
# entity_id: switch.all_lights
# - service: input_button.press
# target:
# entity_id: input_button.button_confirm
- service: switch.turn_off
target:
entity_id: !input switch
|