-
Notifications
You must be signed in to change notification settings - Fork 1
/
vacuum_white.yaml
206 lines (198 loc) · 7.11 KB
/
vacuum_white.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
vacuum:
- platform: template
vacuums:
white_vacuum:
friendly_name: "White Vacuum"
unique_id: white_vacuum_vacuum
value_template: >
{% if states('sensor.whitevacuum_states') == "cleaning" %} cleaning
{% elif states('sensor.whitevacuum_states') == "returning" %} returning
{% elif states('sensor.whitevacuum_states') == "idle" %} idle
{% elif states('sensor.whitevacuum_states') == "docked" %} docked
{% else %} {{ states('vacuum.white_vacuum') }}
{% endif %}
battery_level_template: "{{ states('sensor.whitevacuum_battery') }}"
start:
service: script.whitevacuum_smartcleaning
pause:
service: script.whitevacuum_stop
stop:
service: script.whitevacuum_stop
return_to_base:
service: script.whitevacuum_go_charge
clean_spot:
service: script.whitevacuum_spot_clean
set_fan_speed:
service_template: >
{% if state_attr('vacuum.white_vacuum', 'fan_speed') == "Min" %}
script.whitevacuum_fan_speed_min
{% elif state_attr('vacuum.white_vacuum', 'fan_speed') == "Max" %}
script.whitevacuum_fan_speed_max
{% endif %}
fan_speeds:
- Min
- Max
fan_speed_template: "{{ states('input_select.whitevacuum_fan_speed') }}"
attribute_templates:
status: "{{ states('sensor.whitevacuum_states') }}"
script:
# Stop
whitevacuum_stop:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 26 00 28
# SmartCleaning
whitevacuum_smartcleaning:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 22 02 26
# Go Charge
whitevacuum_go_charge:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 22 03 27
# Spot Clean
whitevacuum_spot_clean:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 22 01 25
# Fan Speed Quiet (Min)
whitevacuum_fan_speed_min:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 24 00 26
# Fan Speed Quiet (Max)
whitevacuum_fan_speed_max:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 24 01 27
# Move Front
whitevacuum_move_front:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 21 00 23 aa 03 02 21 04 27
# Move Back
whitevacuum_move_back:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 21 03 26 aa 03 02 21 04 27
# Move Left
whitevacuum_move_left:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 21 02 25 aa 03 02 21 04 27
# Move Right
whitevacuum_move_right:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 03 02 21 01 24 aa 03 02 21 04 27
# WiFi Connected (in case long pressing the Power // button doens't make any difference)
whitevacuum_wifi_connected:
sequence:
- service: mqtt.publish
data_template:
topic: cmnd/WhiteVacuum/SerialSend5
payload: aa 04 05 00 01 01 07
sensor:
- platform: mqtt
name: "WhiteVacuum Battery"
unique_id: white_vacuum_battery
state_topic: tele/WhiteVacuum/RESULT
unit_of_measurement: "%"
value_template: >
{% if value_json['SerialReceived'][:11] == "AA1C06FF000" %}
{{ value_json['SerialReceived'][-4:][:2] | int(base=16) }}
{% else %}
{{ states('sensor.whitevacuum_battery') }}
{% endif %}
- platform: mqtt
name: "WhiteVacuum States"
unique_id: white_vacuum_states
state_topic: tele/WhiteVacuum/RESULT
value_template: >
{% if value_json['SerialReceived'][:14] == "AA1C06FF000002" %} cleaning
{% elif value_json['SerialReceived'][:14] == "AA1C06FF000004" %} idle
{% elif value_json['SerialReceived'][:14] == "AA1C06FF00000A" %} cleaning
{% elif value_json['SerialReceived'][:14] == "AA1C06FF00010A" %} cleaning
{% elif value_json['SerialReceived'][:14] == "AA1C06FF00020A" %} cleaning
{% elif value_json['SerialReceived'][:14] == "AA1C06FF00030A" %} cleaning
{% elif value_json['SerialReceived'][:14] == "AA1C06FF000401" %} cleaning
{% elif value_json['SerialReceived'][:14] == "AA1C06FF000402" %} cleaning
{% elif value_json['SerialReceived'][:14] == "AA1C06FF000403" %} returning
{% elif value_json['SerialReceived'][:14] == "AA1C06FF000404" %} idle
{% elif value_json['SerialReceived'][:14] == "AA1C06FF000406" %} docked
{% elif value_json['SerialReceived'][:14] == "AA1C06FF000408" %} docked
{% elif value_json['SerialReceived'][:14] == "AA1C06FF000405" %} Hibernating
{% else %} {{ states('sensor.whitevacuum_states') }}
{% endif %}
input_select:
whitevacuum_fan_speed:
name: "whitevacuum_fan_speed"
initial: Min
options:
- Min
- Max
automation:
# Change the vacuum fan speed automaticly when Input_Select is changed
- alias: 'whitevacuum_auto1'
trigger:
- platform: state
entity_id: input_select.whitevacuum_fan_speed
action:
service_template: script.whitevacuum_fan_speed_{{ trigger.to_state.state }}
# If Fan speed is Max when Vacuum stops go back to Min (Vacuum will always start in Min speed this syncs states)
- alias: 'whitevacuum_auto2'
trigger:
- platform: state
entity_id: vacuum.white_vacuum
from: cleaning
condition:
condition: and
conditions:
- condition: state
entity_id: input_select.whitevacuum_fan_speed
state: Max
action:
- service: input_select.select_option
data:
entity_id: input_select.whitevacuum_fan_speed
option: Min
# This will only change the Fan speed to Max if the Vacuum is working (Vacuum doesn't change speed to Max Unless is working)
- alias: 'whitevacuum_auto3'
trigger:
- platform: state
entity_id: input_select.whitevacuum_fan_speed
to: Max
condition:
condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: vacuum.white_vacuum
state: cleaning
action:
- service: input_select.select_option
data:
entity_id: input_select.whitevacuum_fan_speed
option: Min