-
Notifications
You must be signed in to change notification settings - Fork 7
/
discovery_proficook-kettle.yaml
183 lines (172 loc) · 6.65 KB
/
discovery_proficook-kettle.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
blueprint:
name: "Tasmota Discovery: ProfiCook PC-WKS 1167 G Kettle"
source_url: 'https://github.com/tasmota/blueprints/blob/main/discovery_proficook-kettle.yaml'
description: |
Set up a ProfiCook PC-WKS 1167 G Tuya Water Kettle running Tasmota in Home Assistant. See device template page for additional information: [ProfiCook PC-WKS 1167 G](https://templates.blakadder.com/proficook_PC-WKS_1167.html).
**Apply template:**
```
template {"NAME":"ProfiCook PC-WKS 1167 G","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54,"CMND":"TuyaMCU 99,1 | TuyaMCU 71,105 | TuyaMCU 72,102 | TempRes 0 | Module 0"}
```
**Requires rules configured in Tasmota!**
```
rule3
on tuyareceived#dptype4id101 do publish %topic%/mode %value% endon
on tuyareceived#dptype2id102 do publish %topic%/tempset %value% endon
on tuyareceived#dptype5id104 do publish %topic%/error %value% endon
on tuyareceived#dptype4id106 do publish %topic%/status %value% endon
on tuyareceived#dptype2id107 do publish %topic%/timer %value% endon
on tuyareceived#dptype4id106==2 do backlog delay 3; publish %topic%/timer 0 endon
```
Blog post explaining this blueprint on [blakadder.com](https://blakadder.com/proficook-kettle-in-home-assistant/).
<small>Built for Home Assistant 2022.8+</small>
domain: automation
input:
tasmota_device:
name: "Tasmota Device"
description: "Select the Tasmota device"
selector:
device:
integration: tasmota
manufacturer: "Tasmota"
topic:
name: Tasmota MQTT Topic
description: |
Found in the web UI "Information" menu under "MQTT Topic" or with `Topic` command
selector:
text:
mode: single
max_exceeded: silent
variables:
device_id: !input tasmota_device
topic: !input topic
connections: "{{ device_attr(device_id, 'connections') }}"
name: "{{ device_attr(device_id, 'name') if device_attr(device_id, 'name_by_user') == None else device_attr(device_id, 'name_by_user') }}"
macaddr: >-
{%- for i in device_attr(device_id, 'connections') -%}
{{ i[1].replace(":", "") }}
{% endfor %}
payload_mode: >-
{{
'{
"name":"' ~ name ~ ' Mode",
"state_topic":"' ~ topic ~ '/mode",
"icon":"hass:kettle-steam",
"options":["Standby","Custom °C","Quick Boil","100°C","85°C","60°C","45°C"],
"value_template":"{%- set val = { \'0\':\'45°C\', \'1\':\'60°C\', \'2\':\'85°C\', \'3\':\'100°C\', \'4\':\'Quick Boil\', \'5\':\'Custom °C\', \'6\':\'Standby\' } -%}{{ val[value] | default(\'\', true) }}",
"command_topic":"cmnd/' ~ topic ~ '/backlog0",
"command_template":"{%- set val = { \'45°C\':\'0\', \'60°C\':\'1\', \'85°C\':\'2\', \'100°C\':\'3\', \'Quick Boil\':\'4\', \'Custom °C\':\'5\', \'Standby\':\'6\' } -%}{%- if states(expand(device_entities(device_id))| selectattr(\'entity_id\', \'search\', \'_kettlestatus\') | map(attribute=\'entity_id\') | list | join(\',\')) != \'Standby\' -%}tuyasend4 101,6; {% endif %}tuyasend4 101,{{ val[value] }}",
"avty_t":"tele/' ~ topic ~ '/LWT",
"pl_avail":"Online",
"pl_not_avail":"Offline",
"uniq_id":"' ~ macaddr ~ 'mode",
"dev":{"cns":[["mac","' ~ macaddr ~ '"]]}
}'
}}
payload_status: >-
{{
'{
"name":"' ~ name ~ ' Status",
"icon":"hass:kettle",
"state_topic":"' ~ topic ~ '/status",
"value_template":"{%- set val = { \'1\':\'Removed from base\', \'2\':\'Standby\', \'3\':\'Heating\', \'4\':\'Cooling down\', \'5\':\'Maintain temperature\' } -%}{{ val[value] | default(\'Standby\', true) }}",
"avty_t":"tele/' ~ topic ~ '/LWT",
"pl_avail":"Online",
"pl_not_avail":"Offline",
"object_id":"' ~ name | slugify ~ '_kettlestatus",
"uniq_id":"' ~ macaddr ~ '_status",
"dev":{"cns":[["mac","' ~ macaddr ~ '"]]}
}'
}}
payload_error: >-
{{
'{
"name":"' ~ name ~ ' Error",
"icon":"hass:kettle-alert",
"entity_category":"diagnostic",
"state_topic":"' ~ topic ~ '/error",
"value_template":"{%- set val = { \'0X00\':\'No Error\', \'0X01\':\'Kettle empty\', \'0X04\':\'Kettle overheated\'} -%}{{ val[value] | default(\'\', true) }}",
"avty_t":"tele/' ~ topic ~ '/LWT",
"pl_avail":"Online",
"pl_not_avail":"Offline",
"uniq_id":"' ~ macaddr ~ '_error",
"dev":{"cns":[["mac","' ~ macaddr ~ '"]]}
}'
}}
payload_tempset: >-
{{
'{
"name":"' ~ name ~ ' Target Temperature",
"icon":"hass:temperature-celsius",
"device_class":"temperature",
"unit_of_measurement":"°C",
"min":35,
"max":100,
"state_topic":"' ~ topic ~ '/tempset",
"command_topic":"cmnd/' ~ topic ~ '/tuyasend2",
"command_template":"102,{{ value }}",
"mode":"box",
"avty_t":"tele/' ~ topic ~ '/LWT",
"pl_avail":"Online",
"pl_not_avail":"Offline",
"uniq_id":"' ~ macaddr ~ '_tempset",
"dev":{"cns":[["mac","' ~ macaddr ~ '"]]}
}'
}}
payload_timer: >-
{{
'{
"name":"' ~ name ~ ' Time Remaining",
"icon":"hass:timer-sand",
"device_class":"duration",
"unit_of_measurement":"min",
"state_topic":"' ~ topic ~ '/timer",
"avty_t":"tele/' ~ topic ~ '/LWT",
"pl_avail":"Online",
"pl_not_avail":"Offline",
"uniq_id":"' ~ macaddr ~ '_timer",
"dev":{"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/select/{{ macaddr }}/mode/config"
retain: true
payload: "{{ payload_mode }}"
- service: mqtt.publish
data:
topic: "homeassistant/sensor/{{ macaddr }}/kettlestatus/config"
retain: true
payload: "{{ payload_status }}"
- service: mqtt.publish
data:
topic: "homeassistant/sensor/{{ macaddr }}/error/config"
retain: true
payload: "{{ payload_error }}"
- service: mqtt.publish
data:
topic: "homeassistant/number/{{ macaddr }}/tempset/config"
retain: true
payload: "{{ payload_tempset }}"
- service: mqtt.publish
data:
topic: "homeassistant/sensor/{{ macaddr }}/timer/config"
retain: true
payload: "{{ payload_timer }}"
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
- service: mqtt.publish
data:
topic: "cmnd/{{ topic }}/tuyasend8"
payload: ""