domoticz-mirobot-plugin icon indicating copy to clipboard operation
domoticz-mirobot-plugin copied to clipboard

Implement Zones?

Open MarcE85 opened this issue 6 years ago • 8 comments

Will there be an update that implements the new "Go" and "Zone" Function?

MarcE85 avatar Apr 11 '18 09:04 MarcE85

Hi, just wanted to say that this plugin works very fine with Roborock Vacuum V2. And to say it would be very cool if one can implement those functions Thank you very much !

acca84 avatar Jul 26 '18 19:07 acca84

Hi, I would like to have this as well! Is there a way to send raw commands from Domoticz to the Robot? Then we might be able to figure out the required zone and start the cleaning with Lua.

arjannv avatar Sep 14 '18 09:09 arjannv

Hi! I made a script to start a zoned cleanup from a Domoticz dzVents script. Unfortunately, it is not yet working as it should.. If I start the command from terminal, it works as expected. If I start it with dzVents script below, nothing happens; also no output from print().

EDIT: Got it working:) When I run it as local user, it works. See below for updated (and working) script. Also tweaked the Python script so that it works out the order of coordinates.

In Domoticz: command = "runuser -l arjan -c 'python3 /home/arjan/domoticz/plugins/xiaomi-mirobot/zone.py " .. domoticz.utils.round(x1, 0) .. " " .. domoticz.utils.round(y1, 0) .. " " .. domoticz.utils.round(x2, 0) .. " " .. domoticz.utils.round(y2, 0) .. " " .. domoticz.utils.round(iterations, 0) .. "'" local f = assert(io.popen(command, 'r')) local response = assert(f:read('*a')) f:close() domoticz.log(response, domoticz.LOG_INFO)

The zone.py script: zone.py.txt

arjannv avatar Oct 22 '18 14:10 arjannv

Hi! I made a script to start a zoned cleanup from a Domoticz dzVents script. Unfortunately, it is not yet working as it should.. If I start the command from terminal, it works as expected. If I start it with dzVents script below, nothing happens; also no output from print().

EDIT: Got it working:) When I run it as local user, it works. See below for updated (and working) script. Also tweaked the Python script so that it works out the order of coordinates.

In Domoticz: command = "runuser -l arjan -c 'python3 /home/arjan/domoticz/plugins/xiaomi-mirobot/zone.py " .. domoticz.utils.round(x1, 0) .. " " .. domoticz.utils.round(y1, 0) .. " " .. domoticz.utils.round(x2, 0) .. " " .. domoticz.utils.round(y2, 0) .. " " .. domoticz.utils.round(iterations, 0) .. "'" local f = assert(io.popen(command, 'r')) local response = assert(f:read('*a')) f:close() domoticz.log(response, domoticz.LOG_INFO)

The zone.py script: zone.py.txt

thx for this script. Did you update your python-miio version??

MarcE85 avatar Nov 14 '18 20:11 MarcE85

thx for this script. Did you update your python-miio version??

I've got the latest version, this is needed for the zone and spot function.

Only changed the plugin.py from the domoticz plugin to show the correct Status in Domoticz. plugin.py.txt Added status: 17: 'Zone cleaning',

arjannv avatar Nov 15 '18 08:11 arjannv

Hi I know this is an old thread, but thought I'd through out a hook just in case.

Thanks for a nice addition.

How did you get the coordinates? I'm assuming x1 y1 x2 y2 are the limiting coordinates? I basic "howto use" would be much appreciated.

mpadwick avatar Feb 07 '22 12:02 mpadwick

That is correct, x1, y1, x2, y2 are the limits of the zone. I've created a little goto spot script to find the coordinates. It was just a bit of trial and error. spot.py.txt Easiest is to put this script in the same folder as the files of the domoticz plugin. Just run the script from terminal with python3 spot.py X Y Don't forget to change the IP and TOKEN in both the spot.py and zone.py files.

The numbers are in millimetres. The docking stations is at 25500, 25500. So you can roughly guess where your zone needs to start and stop.

When you issue an command for a goto or zone, you can also see the result in the Xiaomi app.

arjannv avatar Feb 07 '22 12:02 arjannv

Thanks. I'm running Domoticz and the miio-server in separate docker containers. Is the any way I can connect and send the commands via my miio-server? Instead of downloading the modules and establishing a new session from the spot.py file on my laptop.

mpadwick avatar Feb 07 '22 13:02 mpadwick