Add wifi to an older roomba

I just got @johnboiles code running on a nodemcuv2 with a buck converter and a 2N3906 PNP transistor:

vacuum/state {"battery_level":95,"cleaning":false,"docked":false,"charging":false,"voltage":14361,"current":-203,"charge":2581}
vacuum/state {"battery_level":95,"cleaning":false,"docked":false,"charging":false,"voltage":14361,"current":-203,"charge":2581}
vacuum/state {"battery_level":95,"cleaning":false,"docked":false,"charging":false,"voltage":14361,"current":-203,"charge":2580}

Sleep override is currently an issue because I am out of PINs fitting into the serial port. :sweat_smile:

I had to make some adjustments for ArduinoJson 6 to get it compiling. PR is open: https://github.com/johnboiles/esp-roomba-mqtt/pull/37

Now I am going to try to get this thing into hass itself. What is the best way to achieve that?

It doesn’t seem this code supports MQTT discovery, right? https://www.home-assistant.io/docs/mqtt/discovery/

More news. My discovery implementation is running quite nice since some days on my Roomba 780.

You can find the code here: https://github.com/Armadill0/esp-roomba-mqtt/tree/mqtt-discovery_support
A second pull request to @johnboiles repository is open to get this upstream. Unfortunately there hasn’t been much activity on that repository during the last year.

I’m also experimenting with the locate support which I implemented by playing a predefined song. This is currently work in progress. Hopefully I can get this sorted in the next days/weeks. :slight_smile:

@johnboiles any chance u could update the diagram on git to show how to wire the wemos and wemos shield to work with your code?

I use https://github.com/mannkind/ESPHomeRoombaComponent on Wemos D1 mini. To which pin on D1 should I connect BRC that will work with this code?

You configure the pin in the ESPHome configuration. In the example roomba.yaml they use pin 4

I figured it out:
https://github.com/mannkind/ESPHomeRoombaComponent

Annotation 2020-04-28 083328
BRC pin needs to be changed to 2 and then you have to connect Wemos D1 mini pin D4 directly with pin 5 on Roomba (no resistors).

And you have to use PNP transistor on RX pin as it is on


in order to get the data.

I am trying to compile this for my Roomba 650 using ESPHome (HASS.IO/Docker running on Synology). I am using the example ESPHome.yaml from https://github.com/mannkind/ESPHomeRoombaComponent, but receiving an error when trying to compile. I am pretty stuck with this, so would greatly appreciate any help.

My yaml is as follows;
esphome:
name: roomba_001
platform: ESP8266
board: d1_mini

libraries:

- Roomba=https://github.com/Apocrathia/Roomba

includes:
- …/esphome/roomba/src/ESPHomeRoombaComponent.h

substitutions:
name: “Roomba”

state topic, command topic, BRC pin, polling interval

init: ‘RoombaComponent::instance(“roomba_001/state”, “roomba_001/command”, 2, 1000);’

wifi:
ssid: “xxxxxx”
password: “xxxx”

mqtt:
broker: 192.168.xxxxx
discovery: true

logger:
baud_rate: 0
level: info

ota:

custom_component:

  • lambda: |-
    auto r = ${init}
    return {r};

sensor:

  • platform: custom
    lambda: |-
    auto r = ${init}
    return {r->distanceSensor, r->voltageSensor, r->currentSensor, r->chargeSensor, r->capacitySensor};

    sensors:

    • name: “${name} distance”
      unit_of_measurement: “mm”
      accuracy_decimals: 0
    • name: “${name} voltage”
      unit_of_measurement: “mV”
      accuracy_decimals: 0
    • name: “${name} current”
      unit_of_measurement: “mA”
      accuracy_decimals: 0
    • name: “${name} charge”
      unit_of_measurement: “mAh”
      accuracy_decimals: 0
    • name: “${name} capacity”
      unit_of_measurement: “mAh”
      accuracy_decimals: 0

binary_sensor:

  • platform: status
    name: “{name} Status”

  • platform: custom
    lambda: |-
    auto r = ${init}
    return {r->chargingBinarySensor, r->dockedBinarySensor, r->cleaningBinarySensor};

    binary_sensors:

    • name: “${name} charging”
    • name: “${name} docked”
    • name: “${name} cleaning”

ESPHome Reports an issue during compiling the binary;

INFO Reading configuration /config/esphome/roomba.yaml…
INFO Generating C++ source…
INFO Compiling app…
INFO Running: platformio run -d /config/esphome/roomba_001
Processing roomba_001 (board: d1_mini; framework: arduino; platform: [email protected])

HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- 1.2.2
| |-- 1.0
|-- 1.0
|-- 1.2
| |-- 1.0
|-- 0.8.4
| |-- 1.2.2
| | |-- 1.0
|-- 5.13.3
Compiling /data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o
Linking /data/roomba_001/.pioenvs/roomba_001/firmware.elf
/data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o:(.text._ZN15RoombaComponent5setupEv[RoombaComponent::setup()]+0x10): undefined reference to Roomba::start()' /data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o: In function RoombaComponent::setup()’:
main.cpp:(.text._ZN15RoombaComponent5setupEv[RoombaComponent::setup()]+0x38): undefined reference to Roomba::start()' /data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o:(.text._ZN15RoombaComponent8instanceERKSsS1_hj[RoombaComponent::instance(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char, unsigned int)]+0xc): undefined reference to Roomba::Roomba(HardwareSerial*, Roomba::Baud)’
/data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o:(.text._ZN15RoombaComponent8instanceERKSsS1_hj[RoombaComponent::instance(std::basic_string<char, std::char_traits, std::allocator > const&, std::basic_string<char, std::char_traits, std::allocator > const&, unsigned char, unsigned int)]+0x59): undefined reference to Roomba::Roomba(HardwareSerial*, Roomba::Baud)' /data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o:(.text._ZN15RoombaComponent10on_messageERKSs[RoombaComponent::on_message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x30): undefined reference to Roomba::playSong(unsigned char)’
/data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o:(.text._ZN15RoombaComponent10on_messageERKSs[RoombaComponent::on_message(std::basic_string<char, std::char_traits, std::allocator > const&)]+0x34): undefined reference to Roomba::cover()' /data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o:(.text._ZN15RoombaComponent10on_messageERKSs[RoombaComponent::on_message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x38): undefined reference to Roomba::dock()’
/data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o:(.text._ZN15RoombaComponent10on_messageERKSs[RoombaComponent::on_message(std::basic_string<char, std::char_traits, std::allocator > const&)]+0x3c): undefined reference to Roomba::spot()' /data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o: In function RoombaComponent::on_message(std::basic_string<char, std::char_traits, std::allocator > const&)’:
main.cpp:(.text._ZN15RoombaComponent10on_messageERKSs[RoombaComponent::on_message(std::basic_string<char, std::char_traits, std::allocator > const&)]+0xc7): undefined reference to Roomba::playSong(unsigned char)' main.cpp:(.text._ZN15RoombaComponent10on_messageERKSs[RoombaComponent::on_message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x103): undefined reference to Roomba::cover()’
main.cpp:(.text._ZN15RoombaComponent10on_messageERKSs[RoombaComponent::on_message(std::basic_string<char, std::char_traits, std::allocator > const&)]+0x12f): undefined reference to Roomba::dock()' main.cpp:(.text._ZN15RoombaComponent10on_messageERKSs[RoombaComponent::on_message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)]+0x168): undefined reference to Roomba::spot()’
/data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o:(.text._ZN15RoombaComponent6updateEv[RoombaComponent::update()]+0x30): undefined reference to Roomba::getSensorsList(unsigned char*, unsigned char, unsigned char*, unsigned char)' /data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o:(.text._ZN15RoombaComponent6updateEv[RoombaComponent::update()]+0x92): undefined reference to Roomba::getSensorsList(unsigned char*, unsigned char, unsigned char*, unsigned char)’
collect2: error: ld returned 1 exit status
*** [/data/roomba_001/.pioenvs/roomba_001/firmware.elf] Error 1
========================= [FAILED] Took 30.41 seconds =========================

I got the following errors when trying to compile the ESPHomeRoombaComponent on ESPHOME 15.1.0:

In file included from src/ESPHomeRoombaComponent.h:2:0,
from src/main.cpp:31:
.piolibdeps/roomba_001/Roomba/Roomba.h:394:21: error: expected ‘)’ before '’ token
Roomba(Serial_
serial = &serial, Baud baud = Baud57600);
^
Compiling .pioenvs/roomba_001/lib70c/ESP8266WiFi/ESP8266WiFiAP.cpp.o
In file included from src/main.cpp:31:0:
src/ESPHomeRoombaComponent.h: In constructor ‘RoombaComponent::RoombaComponent(const string&, const string&, uint8_t, uint32_t)’:
src/ESPHomeRoombaComponent.h:187:77: error: no matching function for call to ‘Roomba::Roomba(HardwareSerial*, Roomba::Baud)’
PollingComponent(updateInterval), roomba(&Serial, Roomba::Baud115200)
^
src/ESPHomeRoombaComponent.h:187:77: note: candidates are:
In file included from src/ESPHomeRoombaComponent.h:2:0,
from src/main.cpp:31:
.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: Roomba::Roomba()
class Roomba
^
.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: candidate expects 0 arguments, 2 provided
.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: constexpr Roomba::Roomba(const Roomba&)
.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: candidate expects 1 argument, 2 provided
.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: constexpr Roomba::Roomba(Roomba&&)
.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: candidate expects 1 argument, 2 provided
*** [.pioenvs/roomba_001/src/main.cpp.o] Error 1
========================= [FAILED] Took 16.69 seconds =========================

I changed the line 394 in the file Roomba.h
from Roomba(Serial_* serial = &serial, Baud baud = Baud57600);
to Roomba(HardwareSerial* serial = &Serial, Baud baud = Baud57600);
аnd the compilation finished without errors.

@sergey732002 You need to pass in a compiler flag manually. I did this with the following modification to the yaml:

esphome:
  name: rosie_roomba
  platform: ESP8266
  board: nodemcuv2
  includes:
    - ../ESPHomeRoombaComponent.h
  libraries:
    - Roomba=https://github.com/Apocrathia/Roomba
  platformio_options:
[u]    build_flags: -D HAVE_HWSERIAL0[/u] 
1 Like

Has anyone done this on an 800 series, specifically an 805?

I found a lot of guide for ones older than mine, but nothing for an 805

Working great on an 800 and 805 here. A small nodemcu or wemos d1 and a regulator even fit in the wheel well under the top cover.

Hi,
I have Roomba 860 and want to connect it to HA and I have two questions:

  1. is this the correct shematic for connecting din connector to Wemos D1 mini (v2.2): Add wifi to an older roomba
    I’m worried about connecting unregulated Roomba battery pin to 5V input on D1? What about those two diods in the picture?
    @monaco @MarkDom

  2. I don’t want to use MQTT, is there “regular” version with sensors exposed?
    Thanks!

This guy has continued the Roomba ESPHome project, no MQTT https://github.com/Ceiku/ESPHomeRoombaComponent

Thanks, I managed to connect everything with homeassistant api, I wrote my own library.

@johnboiles is the git project abandoned? I would adopt it, maintain and also merge @Armadillo PR. It’s pity to leave this project to die.

1 Like

Today I got a better idea how to connect our “dumb” roombas using builtin roomba addon. If we create a esp firmware which will simulate the behavior of wifi enabled roombas we won’t need MQTT or ESPhome running.

I’ve created an issue on roombapy repo, where I summarized what needs to be done. Read it if you like.

What do you think about this?

Hey, it works with SoftwareSerial on Roomba 650.

Adapted as follows

Since it is a 650 it wouldn’t wake up simply pulsing BRC, so at the end I opted for a relay to mimic the push of Clean button


credit for both the image and idea goes to Synthiam

1 Like

I’m migrating from the MQTT version at https://github.com/mannkind/ESPHomeRoombaComponent to your native API version https://github.com/davidecavestro/ESPHomeRoombaComponent and am struggling with what to add to my configuration.yaml in order to create a “vacuum” device. Might you be able to add an example for this to your repository and/or this thread please?

Also when attempting to compile your version I get error: no matching function for call to 'Roomba::Roomba(SoftwareSerial*&, Roomba::Baud&)'; any tips?

EDIT: This was user error on my part; I hadn’t updated the Roomba library declaration to point to davidecavestro/Roomba.git. With that done and build files cleaned, it compiles without issue. Some tips regarding how to create a vacuum with this in Home Assistant would still be very much appreciated though.

Thanks.

Sorry for late reply, I missed notifications.
The device is automatically created in HomeAssistant by the ESPHome integration. Did you install it? If not, please check ESPHome - Home Assistant or Getting Started with ESPHome and Home Assistant — ESPHome.
When the ESPHome integration is enabled in HomeAssistant, ESPHomeRoombaComponent/roomba.yaml at 5dbcdea532e9742d6f94b3dd83b6c567d74912bc · davidecavestro/ESPHomeRoombaComponent · GitHub should make a device with relevant sensors.

1 Like