-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdiscovery_diffuser-fan-tuya.yaml
65 lines (55 loc) · 2.21 KB
/
discovery_diffuser-fan-tuya.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
blueprint:
name: 'Tasmota: Tuya Diffuser as Fan'
description: |
Set up an Tasmota Tuya aroma diffuser as fan entity.
Diffuser fan should be on `Power1` and diffuser modes on `TuyaEnum1`.
Requires some rules configured in Tasmota. See the device template page for rules:
- [GD-30W Aroma Diffuser](https://templates.blakadder.com/GD-30W.html)
- [Wood Grain 550ML Aroma Diffuser](https://templates.blakadder.com/oil_diffuser_550ml.html)
domain: automation
input:
name:
name: Device Name in HA
description: Name of the device which is created.
selector:
text:
topic:
name: Tasmota MQTT Topic
description: "Found in Information tab of the webUI."
selector:
text:
mac_address:
name: Tasmota MAC Address
description: "Found in Information tab of the webUI."
mode: single
max_exceeded: silent
variables:
topic: !input topic
name: !input name
mac_address: !input mac_address
macaddr: '{{- mac_address.split(":") | join -}}'
payload: >-
{{ '{"name":"' ~ name ~ '","state_topic":"stat/' ~ topic ~ '/RESULT","state_value_template":"{% if value_json.POWER1 is defined %}{{ value_json.POWER1 }}{% endif %}","command_topic":"cmnd/' ~ topic ~ '/POWER1","preset_modes":["high","low"],"preset_mode_state_topic":"stat/' ~ topic ~ '/fanmode","preset_mode_command_topic":"cmnd/' ~ topic ~ '/tuyaenum1","preset_mode_command_template":"{{ 1 if value == \'high\' else 0 }}","availability_topic":"tele/' ~ topic ~ '/LWT","payload_available":"Online","payload_not_available":"Offline","uniq_id":"' ~ macaddr ~ '_fan","device":{"cns":[["mac","' ~ macaddr ~ '"]]}}' }}
trigger_variables:
topic: !input topic
trigger:
- platform: homeassistant
event: start
- platform: mqtt
topic: '{{ "tele/" ~ topic ~ "/LWT" }}'
payload: "Online"
action:
- service: mqtt.publish
data:
topic: "homeassistant/fan/{{ macaddr }}/fan/config"
retain: true
payload: "{{ payload }}"
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: mqtt.publish
data:
topic: "cmnd/{{ topic }}/tuyasend8"
payload: ""