-
Notifications
You must be signed in to change notification settings - Fork 7
/
discovery-tuya_diffuser_fan_and_error_sensor.yaml
73 lines (64 loc) · 2.96 KB
/
discovery-tuya_diffuser_fan_and_error_sensor.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
blueprint:
name: 'Tasmota Discovery: Aroma Diffuser'
description: |
Set up a Tasmota TuyaMCU aroma diffuser as a fan entity and binary sensor for error.
Diffuser fan should be on `Power1` and diffuser modes on `TuyaEnum1`.
Requires some rules configured in Tasmota. See your 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)
- [BlitzWolf 400ml Aroma Diffuser(BW-FUN3)](https://templates.blakadder.com/blitzwolf_BW-FUN3.html)
- [Essential Oil 400ml Aroma Diffuser (XD80XW)](https://templates.blakadder.com/XD80xW.html)
domain: automation
input:
name:
name: Sensor name
description: Name of the sensor to be 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_error: >-
{{ '{"name":"' ~ name ~ ' Error","state_topic":"stat/' ~ topic ~ '/error","value_template":"{{ \'ON\' if value != \'0X00\' else \'OFF\' }}","device_class":"problem","avty_t":"tele/' ~ topic ~ '/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"' ~ macaddr ~ '_error","device":{"cns":[["mac","' ~ macaddr ~ '"]]}}' }}
payload_fan: >-
{{ '{"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/binary_sensor/{{ macaddr }}/error/config"
retain: true
payload: "{{ payload_error }}"
- service: mqtt.publish
data:
topic: "homeassistant/fan/{{ macaddr }}/fan/config"
retain: true
payload: "{{ payload_fan }}"
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: mqtt.publish
data:
topic: "cmnd/{{ topic }}/tuyasend8"
payload: ""