forked from xAPPO/MQTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
automations.yaml
35 lines (31 loc) · 964 Bytes
/
automations.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
- alias: Control switches via MQTT
trigger:
platform: mqtt
topic: +/switch/+/state/cmd
action:
- service_template: >
homeassistant.turn_{{trigger.payload}}
data_template:
entity_id: >-
{{ trigger.topic.split('/')[-4] }}.{{ trigger.topic.split('/')[-3] }}
- alias: Control lights state via MQTT
trigger:
platform: mqtt
topic: +/light/+/state/cmd
action:
- service_template: >
homeassistant.turn_{{trigger.payload}}
data_template:
entity_id: >-
{{ trigger.topic.split('/')[-4] }}.{{ trigger.topic.split('/')[-3] }}
- alias: Control lights brightness via MQTT
trigger:
platform: mqtt
topic: +/light/+/brightness/cmd
action:
- service_template: >
homeassistant.turn_on
data_template:
brightness: '{{trigger.payload}}'
entity_id: >-
{{ trigger.topic.split('/')[-4] }}.{{ trigger.topic.split('/')[-3] }}