[PYTHON] Fully integrate Ecovacs deebot 901 with Alexa

2021/1/15 When I send a command from sucks, not only does it not respond, but it seems that deebot goes offline until the router is restarted. It seems that the private key has changed.

wrap up

・ I bought a robot vacuum cleaner deebot901, but Alexa cooperation is not good. ・ RasPi Zero was sandwiched in the middle and recognized as a device. -It can now be used in standard actions!

A robot vacuum cleaner has arrived at my house.

Suddenly, I bought a robot vacuum cleaner the other day. Ecovacs deebot 901 with nickname Pochi

(The photo below is a great guy who can wipe the mop with the successor deebot ozmo 901. At the time of sale, you can buy it for 20,000 yen. It's not Affi) image.png deebot ozmo 901 - Amazon

To be honest, I didn't like the robot vacuum cleaner, but it's very convenient and amazing (vocabulary) I couldn't vacuum it every day, but if it's a pocket, it can be cleaned with a single touch from my smartphone.

Isn't it rumba?

If you're not a robot vacuum cleaner enthusiast, you might think of Roomba first when you hear it as a robot vacuum cleaner. If you buy a robot vacuum, we recommend one with a LIDAR or laser sensor! The reason is that the floor plan of the room recognizes where you are and cleans it nicely. Conversely, sensorless robot vacuums are just moving randomly.

And only the high-end models of Roomba have this function, and the price is inevitably very high. With deebot, you can get a laser for 20,000 yen, for example, you can instruct to clean only the living room from the app.

Alexa cooperation is not good (main subject)

It's such a cheap and laser-equipped pot, but I'm dissatisfied. The only things you can do while proclaiming Alexa official support are:

"Alexa, clean with a deebot." "Alexa finishes cleaning with Deebot." "Alexa, use Deebot to bring it back to the home base."

You can't clean only the specific room mentioned above, and it's not smart because you have to keep in mind "using a deebot". It is a specification that is not recognized as a device even if it is incorporated into a fixed action. (Around here, it seems that Rumba can handle it?)

Thing you want to do

The dining table in my living room is not a run bubble, so ① Launch the app ② Have them clean the area other than the living room ③ Stop the pot that is about to return to the charging station with the button on the main unit. ④ Move the chair of the dining table to the cleaning end point ⑤ Launch the app ⑥ Have the living room cleaned

That

① Talk to "Alexa, clean" → Automatically pause after cleaning other than the living room ② Move the chair of the dining table to the cleaning end point ③ Talk to "Alexa, clean the living room"

To

Things necessary

Raspberry Pi Zero W I chose Zero because I wanted to keep the initial cost and running cost as low as possible. No pin header is required. However, there is a slight lag in starting cleaning after talking to them because of their low performance. There is no problem because it is left unattended after the order, but Pi 4 or 3 may be more comfortable. Don't forget the microSD and power supply.

__Ecovacs account __ As will be described later, please prepare an account different from the one you normally use for the ECOVACS HOME app (main account). Install the HOME app on your spare smartphone → After new registration, link the account from Robot Sharing with the main account.

procedure

① Install Raspberry Pi OS

If you google here, you can get as many as you want, so I'll leave it to you. I wasn't sure, so I installed the full version of Raspberry Pi OS with desktop and recommended software. Since it is heavy to download the image from the official, we recommend the mirror. Raspbian Mirrors

② Switch to Python3

Immediately after installing Raspberry Pi OS, Python2 is the default. Since Python3 is used this time, switch by referring to the following. Change Python default from Python 2.7 to Python 3 on Raspberry Pi-So memorandum

③ Install the deebot 901 compatible version of sucks

There is a program called sucks that runs deebot with Python made by volunteers from overseas, so I will use it (great name ...) Since the original one does not support MQTT models such as 901, I will use the fork version of bmartin5692 Github - bmartin5692/sucks

④ Make modifications corresponding to the temporary suspension of deebot 901

There is a command called stop in sucks, but this does not correspond to 901. Add a command called pause instead Please refer to the commit below and modify the file. Github - bmartin5692/sucks Added pause, resume, fixed stop

⑤ sucks operation test

After remodeling, execute the following command from the terminal

% sucks login

You will be asked for your email address and password, so log in with the Ecovacs you have prepared. You will be asked a few, but it is OK if you enter the presented one and enter. It seems that sucks pretends to be a smartphone app and logs in to the Ecovacs server, but since the information passed to the server at the time of login is old, if you log in with the main account, the app will be launched with a regular smartphone after that. You will be prompted to update when you do. It's a hassle, so let's use another account prepared in advance.

% sucks login
    Ecovacs app email: [Ecovacs account email address]
    Ecovacs app password: [password]
    your two-letter country code: jp
    your two-letter continent code: as
    Config saved.

When config saved. Is displayed, type the following command.

% sucks clean

It is OK if normal cleaning of all rooms starts.

⑥ Confirm room allocation

I think that the room layout is displayed in the Ecovacs home app, but check the correspondence

% sucks clean area 0

The place where it is 0 is the room number. Probably 0 is the room with the charging station. In our environment, the corridor adjacent to 0 is 1, the room beyond it is 2, and so on.

% sucks clean area 1,2,3

You can also specify multiple rooms as in. Make a note of the correspondence.

⑦ Install node-red-contrib-amazon-echo for Alexa of node-red

First, install node-red-contrib-amazon-echo to make Alexa recognize it as a smart device. It seems to make Alexa recognize it under the guise of Belkin's Wemo. I referred to the following. Alexa integration with NodeRed --by K.I For some reason, the port forwarding destination did not work well with 8111 in my environment, so replace all the numbers 8111 in the article with 1880 and install it.

⑧ Install node-red-contrib-alexa-remote2 for Alexa of node-red

Next, install the node node-red-contrib-alexa-remote2 to make Alexa speak from node-red. I put it in because I wanted you to tell me after cleaning, but it is unnecessary if it is unnecessary. I referred to the following. How to make Alexa speak freely using Node-red (alexa-cookie2 v3.4.1) -Childcare x Housework x IoT Please note that it seems to be slightly different depending on the Ver.

⑨ Create a node with node-red

Create a node with node-red-contrib-amazon-echo. The Name at this time will be the name recognized by Alexa. English is safe because the characters are garbled in Japanese. It is recognized as lighting by Alexa and can only be turned ON/OFF, so it is divided for each operation. At home, we divided it into cleaning other than the living room, cleaning the living room, returning to the charging station, and pausing. Put sucks (command name) in the argument of the exec node and deploy. image.png Don't forget to log in if you want to speak.

⑩ Search from the Alexa app

After that, just like when recognizing a normal smart device, search for the device of the application → add device → other. If that doesn't work, please wait a while or check if port ⑦, Echo and Raspberry Pi are in the same network (even if they are separated by 2.4Ghz and 5Ghz).

⑪ Register as a fixed action

Since it is recognized as a smart device, you can register for standard actions! In my case, I assign [Pochi_excpet_Living] to "Alexa, clean up".

Bug

Occasionally, the pause will not work and you will return to the charging station.

What I wanted to do but couldn't

Implemented on ESP32

I gave up because I couldn't understand Get and MQTT on Https. If it can be done with ESP32, it will be strong in terms of power consumption and cost ... Also, it seems to be faster than Python.

Use ecovacs-deebot.js

From the beginning, there is a Node.js version sucks-like one that supports deebot901. Github - mrbungle64/ecovacs-deebot.js Since it is node-red, I wonder if Node.js is more compatible. I tried to build an environment according to usage, but it didn't work so I gave up.

Implemented on Amazon AWS

Theoretically, you should be able to do it on Lambda, and there is something that seems to be done Github - EtienneMD/Alexa-Ecovacs Github - bamminger/ecovacs-aws

It doesn't require any initial or running costs for the Raspberry Pi, and I think it's probably faster than Zero. Perhaps I can do it with Lambda's free tier, but I gave up because I was not confident.

Recommended Posts

Fully integrate Ecovacs deebot 901 with Alexa
Integrate with Python
Integrate PDF files with Python