forked from philpownall/ESPHomeRoomba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroomba.yaml
199 lines (171 loc) · 4.6 KB
/
roomba.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
substitutions:
name: "roomba"
# BRC pin, uart_bus, polling interval in milliseconds
init: 'RoombaComponent::instance(19, id(uart_bus), 10000, true);'
uart:
id: uart_bus
tx_pin: 23
rx_pin: 22
baud_rate: 115200
# debug:
# direction: RX
esphome:
name: roomba
friendly_name: roomba
includes:
- ESPHomeRoombaComponent.h
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
hardware_uart: UART1
logs:
component: ERROR
# Enable startup debug info
debug:
# local web server
web_server:
version: 2
include_internal: true
local: true
# Enable Home Assistant API
api:
encryption:
key: "xxx"
ota:
- platform: esphome
password: "yyy"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Roomba Fallback Hotspot"
password: !secret wifi_password
captive_portal:
custom_component:
- lambda: |-
auto r = ${init}
return {r};
id: my_roomba
binary_sensor:
- platform: custom
lambda: |-
auto r = ${init}
return {r->vacuumSensor};
binary_sensors:
- name: "${name} vacuum state"
sensor:
- platform: custom
lambda: |-
auto r = ${init}
return {r->voltageSensor, r->currentSensor, r->batteryChargeSensor, r->batteryCapacitySensor, r->batteryPercentSensor, r->batteryTemperatureSensor, r->driveSpeedSensor, r->mainBrushCurrentSensor, r->sideBrushCurrentSensor};
sensors:
- name: "${name} voltage"
unit_of_measurement: "V"
icon: mdi:sine-wave
accuracy_decimals: 2
- name: "${name} current"
unit_of_measurement: "A"
icon: mdi:lightning-bolt
accuracy_decimals: 3
- name: "${name} charge"
unit_of_measurement: "Ah"
icon: mdi:battery-charging
accuracy_decimals: 2
- name: "${name} capacity"
unit_of_measurement: "Ah"
icon: mdi:battery
accuracy_decimals: 2
- name: "${name} battery"
unit_of_measurement: "%"
state_class: "measurement"
device_class: battery
icon: mdi:battery-outline
accuracy_decimals: 0
- name: "${name} temperature"
unit_of_measurement: "°C"
icon: mdi:thermometer
accuracy_decimals: 0
- name: "${name} drive speed"
unit_of_measurement: "mm/s"
accuracy_decimals: 0
- name: "${name} main brush current"
unit_of_measurement: "A"
icon: mdi:lightning-bolt
accuracy_decimals: 2
- name: "${name} side brush current"
unit_of_measurement: "A"
icon: mdi:lightning-bolt
accuracy_decimals: 2
text_sensor:
- platform: custom
lambda: |-
auto r = ${init}
return {r->chargingSensor, r->activitySensor, r->oiModeSensor};
text_sensors:
- name: "${name} charging state"
- name: "${name} activity"
- name: "${name} OI mode"
- platform: wifi_info
ip_address:
name: IP Address
switch:
- platform: safe_mode
name: "Vacuum Restart (Safe Mode)"
button:
- platform: shutdown
name: shutdown
- platform: restart
name: "reboot"
- platform: template
name: Forward
id: go_forward
on_press:
then:
- lambda: |-
static_cast< RoombaComponent*> (id(my_roomba).get_component(0))->send_command("go_forward");
- platform: template
name: Turn Left
id: go_left
on_press:
then:
- lambda: |-
static_cast< RoombaComponent*> (id(my_roomba).get_component(0))->send_command("go_left");
- platform: template
name: Turn Right
id: go_right
on_press:
then:
- lambda: |-
static_cast< RoombaComponent*> (id(my_roomba).get_component(0))->send_command("go_right");
- platform: template
name: Stop
id: stop
on_press:
then:
- lambda: |-
static_cast< RoombaComponent*> (id(my_roomba).get_component(0))->send_command("stop");
- platform: template
name: Reverse
id: go_reverse
on_press:
then:
- lambda: |-
static_cast< RoombaComponent*> (id(my_roomba).get_component(0))->send_command("go_reverse");
- platform: template
name: Rotate Left
id: rotate_left
on_press:
then:
- lambda: |-
static_cast< RoombaComponent*> (id(my_roomba).get_component(0))->send_command("rotate_left");
- platform: template
name: Rotate Right
id: rotate_right
on_press:
then:
- lambda: |-
static_cast< RoombaComponent*> (id(my_roomba).get_component(0))->send_command("rotate_right");