Hi guys,
I wanted to integrate my Deebot D900 into OpenHab2 in order to control it, unfortunately there seems to be no binding and also the existing “sucks” library that is references everywhere does not work anymore on the newer deebots.
In the end I got it working now and I wanted to share in case someone wants todo the same (and also to have some sort of documentation for myself haha)
I am no expert in python and I am pretty sure you can make things better, but it works for me.
I run OpenHab2 on a headless Ubuntu.
1. Install python library
The “sucks” library is not working anymore with the new deebot robots, there seems to be some new version out somewhere but I was not able to find it. However I found the “ozmo” library which seems to be a fork of it which supports the new versions.
You need to have python 3 installed and then you can instal it with “pip3 install ozmo”
2. Setup ozmo with the command “ozmo login”.
3. Install the Exec Binding in OpenHab2 if you don’t already have it
4. Create two files like below and fill out the parameters.
Set the rights so that the openhab user can access it.
You can get the deviceid and passwordhash from the ozmo config file, mine was stored in: “/home/username/.config/ozmo.conf”
deebot_clean.py
from ozmo import *
api = EcoVacsAPI('<deviceid>', '<email>', '<passhash>', '<country>', '<region>')
my_vac = api.devices()[0]
vacbot = VacBot(api.uid, api.REALM, api.resource, api.user_access_token, my_vac, 'eu')
vacbot.connect_and_wait_until_ready()
vacbot.run(Clean())
deebot_charge.py
from ozmo import *
api = EcoVacsAPI('<deviceid>', '<email>', '<passhash>', '<country>', '<region>')
my_vac = api.devices()[0]
vacbot = VacBot(api.uid, api.REALM, api.resource, api.user_access_token, my_vac, 'eu')
vacbot.connect_and_wait_until_ready()
vacbot.run(Charge())
5. A things file for running the commands:
Change the paths to the paths where your *.py files are located.
deebotexec.things
Thing exec:command:deebot_clean [command="python3 /etc/openhab2/deebotpython/deebot_clean.py", interval=0, timeout=8, autorun=false]
Thing exec:command:deebot_charge [command="python3 /etc/openhab2/deebotpython/deebot_charge.py", interval=0, timeout=8, autorun=false]
6. An items file:
Optional I expose “deebot_trigger” to Alexa with the hueemulation binding.
deebot.items
Switch deebot_trigger "Deebot" ["Switchable"]
Switch Deebot_clean "Clean" <deebot_clean> {channel="exec:command:deebot_clean:run"}
Switch Deebot_charge "Charge" <deebot_charge> {channel="exec:command:deebot_charge:run"}
7. A rules file:
deebot.rules
rule "deebot1 clean rule"
when
Item deebot_trigger changed
then
if(deebot_trigger.state == ON) {
sendCommand(Deebot_clean, ON)
logInfo( "FILE", "Deebot_clean ON")
} else {
sendCommand(Deebot_charge, ON)
logInfo( "FILE", "Deebot_charge ON")
}
end
8. Integrate it in the sitemap:
deebot.rules
Text label="Deebot D900 Vacuum" icon="deebot" {
Frame label="Deebot D900" {
Switch item=Deebot_clean mappings=[ON="Clean"]
Switch item=Deebot_charge mappings=[ON="Charge"]
}
}
9. Make it nice
Find yourself some nice icons and you can also add other commands like STOP, PAUSE, RESUME, etc. with this method.