-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscripts.yaml
75 lines (71 loc) · 1.87 KB
/
scripts.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
# Light states (on/off) control
mqtt_light_state:
alias: 'MQTT 2 light state'
fields:
topic:
description: "MQTT topic"
payload:
description: "MQTT payload"
sequence:
- service: "{{ 'light.turn_' + payload }}"
target:
entity_id:
- "{{ 'light.' + topic | replace('home/light/', '') | replace('/state/set', '') }}"
# Light brightness control
mqtt_light_brightness:
alias: 'MQTT 2 light brightness'
fields:
topic:
description: "MQTT topic"
payload:
description: "MQTT payload"
sequence:
- service: light.turn_on
target:
entity_id:
- "{{ 'light.' + topic | replace('home/light/', '') | replace('/brightness/set', '') }}"
data:
brightness: "{{ payload }}"
# Light colour temperature control
mqtt_light_ct:
alias: 'MQTT 2 light colour temperature'
fields:
topic:
description: "MQTT topic"
payload:
description: "MQTT payload"
sequence:
- service: light.turn_on
target:
entity_id:
- "{{ 'light.' + topic | replace('home/light/', '') | replace('/color_temp/set', '') }}"
data:
color_temp: "{{ payload }}"
# Switch state (on/off) control
mqtt_switch_state:
alias: 'MQTT 2 switch state'
fields:
topic:
description: "MQTT topic"
payload:
description: "MQTT payload"
sequence:
- service: "{{ 'switch.turn_' + payload }}"
target:
entity_id:
- "{{ 'switch.' + topic | replace('home/switch/', '') | replace('/state/set', '') }}"
# Cover position control
mqtt_cover_position:
alias: 'MQTT 2 cover position'
fields:
topic:
description: "MQTT topic"
payload:
description: "MQTT payload"
sequence:
- service: cover.set_cover_position
target:
entity_id:
- "{{ 'cover.' + topic | replace('home/cover/', '') | replace('/current_position/set', '') }}"
data:
position: "{{ payload }}"