Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Zones? #10

Open
MarcE85 opened this issue Apr 11, 2018 · 8 comments
Open

Implement Zones? #10

MarcE85 opened this issue Apr 11, 2018 · 8 comments

Comments

@MarcE85
Copy link

MarcE85 commented Apr 11, 2018

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

@acca84
Copy link

acca84 commented Jul 26, 2018

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 !

@arjannv
Copy link

arjannv commented Sep 14, 2018

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
Copy link

arjannv commented Oct 22, 2018

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

@MarcE85
Copy link
Author

MarcE85 commented Nov 14, 2018

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??

@arjannv
Copy link

arjannv commented Nov 15, 2018

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',

@mpadwick
Copy link

mpadwick commented Feb 7, 2022

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.

@arjannv
Copy link

arjannv commented Feb 7, 2022

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.

@mpadwick
Copy link

mpadwick commented Feb 7, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants