Re: iRobot Roomba 980 integration
Posted: Sunday 01 March 2020 20:30
Open source Home Automation System
https://forum.domoticz.com/
Hello bewo,bewo wrote: Saturday 18 January 2020 13:50 Hi Vondee,
yes that could be.
If you copied my script 1:1, just add this lines above the "end" of the for loop:Code: Select all
-- Count the working time if otherdevices[Roboter.Name] == 'Saugen' then working_time = tonumber(uservariables[Roboter.Name..'_Laufzeit']) + 1 commandArray[#commandArray+1]={['Variable:'..Roboter.Name..'_Laufzeit'] = tostring(working_time)} end
Code: Select all
-- Count the working time
if otherdevices[Roboter.Name] == 'Saugen' then
counter = 'Zähler '..Roboter.Name..' Laufzeit'
working_time_variable = tonumber(uservariables[Roboter.Name..'_Laufzeit']) + 1
working_time_counter = tonumber(otherdevices_svalues[counter]) + 1
commandArray[#commandArray+1]={['Variable:'..Roboter.Name..'_Laufzeit'] = tostring(working_time_variable)}
commandArray[#commandArray+1]={['UpdateDevice'] = otherdevices_idx[counter]..'|1|'..tonumber(working_time_counter)}
end
Code: Select all
pi@raspberrypi:~/rest980 $ DEBUG=rest980:* npm start
> [email protected] start /home/pi/rest980
> node ./bin/www
/home/pi/rest980/node_modules/dorita980/lib/v2/cloud.js:7
throw new Error('Not implemented.');
^
Error: Not implemented.
at dorita980 (/home/pi/rest980/node_modules/dorita980/lib/v2/cloud.js:7:9)
at new cloud (/home/pi/rest980/node_modules/dorita980/index.js:12:10)
at /home/pi/rest980/routes/api.js:33:46
at handleIP (/home/pi/rest980/routes/api.js:26:68)
at Object.<anonymous> (/home/pi/rest980/routes/api.js:27:1)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/home/pi/rest980/app.js:11:16)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/home/pi/rest980/bin/www:7:11)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Code: Select all
"enableCloud": "no",
Code: Select all
wget http://127.0.0.1:3000/api/local/action/start > /dev/null
Yes you need an instance for each robot. (Don't forget to use an different port. For example 3001 instead if 3000.)bewo wrote: Sunday 05 January 2020 16:16 ...In my house are working two roboters. So i've set up an instance of the restAPI for each robot....
and I did not exactly do with it, so I used the 'old' version of the command script and works well!.dofile("/opt/domoticz/scripts/lua/Eigene_Funktionen.lua")
Hi Bewo,bewo wrote: Sunday 05 January 2020 16:16 Hi guys...
Thank's for the idea's, your scripts and the inspiration... I've did it in a different way.
The Rest API which offered beside dorita980 by koalazak (linked above) is updated and works.
So i thougt this an nicer way...
In my house are working two roboters. So i've set up an instance of the restAPI for each robot. Then i use two lua scripts. One time triggered for status updating and the other one device triggered to control the robots.
My comments are german.So if there's somebody who want to use, or there is a question -> just ask, i will do my best @translating.
![]()
Best regards and a Happy New Year together!![]()
Code: Select all
dofile("/opt/domoticz/scripts/lua/Eigene_Funktionen.lua")Can you share your script with us maybe?Vondee wrote: Sunday 12 April 2020 20:47 Got it working now and the robots are real friends now talking to Domoticz. The 'Status' script works well and I translated to Dutch. The 'Command' script I stumbled uponand I did not exactly do with it, so I used the 'old' version of the command script and works well!.dofile("/opt/domoticz/scripts/lua/Eigene_Funktionen.lua")
Thanks!![]()
This line loads a file with all my functions which i use multiple in several scripts. I think in the Roomba-Script only the timedifference-function ist called. So just replace the line with:Makss39 wrote: Wednesday 06 May 2020 15:46 First point: what the linedoes ?Code: Select all
dofile("/opt/domoticz/scripts/lua/Eigene_Funktionen.lua")
Code: Select all
function timedifference(timestamp)
y, m, d, H, M, S = timestamp:match("(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)")
difference = os.difftime(os.time(), os.time{year=y, month=m, day=d, hour=H, min=M, sec=S})
return difference
end
No it isn't. When the script runs, there must be an entry.Makss39 wrote: Wednesday 06 May 2020 15:46 Second point : the status script seems to run, but my customize var stays empty, is it normal ?
My service was failing and I added the debug parameter. It appears it was because the config.ini was not created yet, so may be you should add a word about it.Start the service with sudo service roomba start
You can check if the service is correctly started with sudo service roomba status (should show active (running))