Gen 1.
Sorry been dealing with the flu. And trying to figure out how docker works. In the meantime, if you’re technical these are the steps at a high level,
- Install Python-miio (https://github.com/rytilahti/python-miio)
- Get your vacuum token (explained in the python-miio docs)
- Install Node.js and the Express web server
- Run the ugly code below, using the IP and token of your vacuum
- Create a simulated switch in the IDE
- Create a WebCoRE piston that makes a web request to the Express server when the switch is turned on (/start) and off (/home).
It’s all pretty rough and ugly at this point, but it does work. If there are any real ST developers who can make this be awesome, that’s our best case scenario.
// https://github.com/rytilahti/python-miio
const express = require(‘express’)
const app = express()
const port = 3000
var exec = require(‘child_process’).execFile;
app.get(’/’, (request, response) => {
response.send(‘Hello from Express!’)
})
app.get(’/start’, (request, response) => {
response.send(‘Sending start command.’)
console.log(“Sending start command.”);
exec(‘C:\Users\Zac\AppData\Local\Programs\Python\Python36-32\Scripts\MIROBO.exe’, [’–ip’, ‘192.168.1.160’, ‘–token’, ‘your token here’, ‘start’], function(err, data) {
console.log(err)
console.log(data.toString());
});
})
app.get(’/home’, (request, response) => {
response.send(‘Sending home command’)
console.log(“Sending home command”);
exec(‘C:\Users\Zac\AppData\Local\Programs\Python\Python36-32\Scripts\MIROBO.exe’, [’–ip’, ‘192.168.1.160’, ‘–token’, ‘your token here’, ‘home’], function(err, data) {
console.log(err)
console.log(data.toString());
});
})
app.listen(port, (err) => {
if (err) {
return console.log(‘something bad happened’, err)
}
console.log(`server is listening on ${port}`)
})