-
Notifications
You must be signed in to change notification settings - Fork 7
/
discovery-rainpoint.yaml
82 lines (74 loc) · 3.61 KB
/
discovery-rainpoint.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
76
77
78
79
80
81
82
blueprint:
name: 'Tasmota Discovery: RainPoint TTP106W'
description: |
Set up a Tasmota TuyaMCU water timer.
Requires some rules configured in Tasmota. See your device template page for rules:
- [RainPoint TTP106W](https://templates.blakadder.com/rainpoint_TTP106W.html)
domain: automation
input:
name:
name: Device name
description: Name of the device to be used in sensor name creation.
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_duration: >-
{{ '{"name":"' ~ name ~ ' Watering Duration","state_topic":"' ~ topic ~ '/duration","command_topic":"cmnd/' ~ topic ~ '/var2","availability_topic":"tele/' ~ topic ~'/LWT","icon":"mdi:timer-sand","min":6,"max":1800,"payload_available":"Online","payload_not_available":"Offline","unique_id":"' ~ macaddr ~ '_duration","device":{"cns":[["mac","' ~ macaddr ~ '"]]}}' }}
payload_frequency: >-
{{ '{"name":"' ~ name ~ ' Watering Frequency","state_topic":"' ~ topic ~ '/frequency","command_topic":"cmnd/' ~ topic ~ '/var3","availability_topic":"tele/' ~ topic ~ '/LWT","icon":"mdi:timetable","min":1,"max":168,"payload_available":"Online","payload_not_available":"Offline","unique_id":"' ~ macaddr ~ '_frequency","device":{"cns":[["mac","' ~ macaddr ~ '"]]}}' }}
payload_battery: >-
{{ '{"name":"' ~ name ~ ' Power Status","state_topic":"' ~ topic ~ '/battery","value_template":"{% if value == \'0\' %}USB{% elif value == \'1\' %}high{% elif value == \'2\' %}medium{% elif value == \'3\' %}low{% elif value == \'4\' %}USB{% endif %}","icon":"mdi:power-plug-outline","availability_topic":"tele/' ~ topic ~ '/LWT","payload_available":"Online","payload_not_available":"Offline","uniq_id":"' ~ macaddr ~ '_battery","device":{"cns":[["mac","' ~ macaddr ~ '"]]}}' }}
payload_mode: >-
{{ '{"name":"' ~ name ~ ' Mode","state_topic":"' ~ topic ~ '/mode","value_template":"{%set m=value|int%}{%if m==0%}idle{%elif m==1%}auto{%elif m==2%}manual{%else%}Unknown{%endif%}","icon":"mdi:watering-can","availability_topic":"tele/' ~ topic ~ '/LWT","payload_available":"Online","payload_not_available":"Offline","uniq_id":"' ~ macaddr ~ '_mode","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/number/{{ macaddr }}/duration/config"
retain: true
payload: "{{ payload_duration }}"
- service: mqtt.publish
data:
topic: "homeassistant/number/{{ macaddr }}/frequency/config"
retain: true
payload: "{{ payload_frequency }}"
- service: mqtt.publish
data:
topic: "homeassistant/sensor/{{ macaddr }}/battery/config"
retain: true
payload: "{{ payload_battery }}"
- service: mqtt.publish
data:
topic: "homeassistant/sensor/{{ macaddr }}/mode/config"
retain: true
payload: "{{ payload_mode }}"
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: mqtt.publish
data:
topic: "cmnd/{{ topic }}/tuyasend8"
payload: ""