Page 1 of 1

Python script to check Neato status every night

Posted: Friday 19 January 2018 14:11
by quack3d
I have a python script (based on https://github.com/stianaske/pybotvac) that checks dock status of my Neato Botvac Connected and returns True if docked. At the moment I have created a custom sensor in Domoticz that gets updated with True or False when script has been run. So I'm thinking the script needs to run at 9 pm, then Domoticz needs to check the custom sensor and send a push if it's set to False. What's the best way to do this?

Re: Python script to check Neato status every night

Posted: Friday 19 January 2018 15:06
by bbqkees
If you only want to run the check once a day, you can use a cron job to execute the script at the time you need.

Other option would be to put the script in the domoticz events editor.
Thenn it will run every minute.

make sure to you set a user variable when the message is sent once, because otherwise you get a message every minute when undocked.
The user value should be reset when docked.

Re: Python script to check Neato status every night

Posted: Friday 19 January 2018 15:11
by quack3d
Forgot to say I'm using Windows, so no cron available. And running it every minute seems excessive when I really just need a check in the evening.

Re: Python script to check Neato status every night

Posted: Wednesday 24 January 2018 9:36
by bbqkees
That a script is called every minute does not mean you have to actually check the status of the robot every minute.
You can just do a check once a day.

Re: Python script to check Neato status every night

Posted: Monday 05 February 2018 15:31
by quack3d
I made this script in LUA that runs the python script that updates the value of a dummy info device in Domoticz. Then the LUA script sends out a Pushbullet notification with the value of the dummy device.

But what's a good way of making the LUA script wait for the result of robotdock.pyw?

Code: Select all

local switch_1 = 'Robot - check dock'
local text_sensor = 'Is robot in dock??'
local title = 'Robot dock status'
local robot_path = 'C:\\Program Files (x86)\\Domoticz\\scripts\\python\\robotdock.pyw'
local push_path = 'C:\\Program Files (x86)\\Domoticz\\scripts\\batch\\pushbullet.bat'

 commandArray = {}
  if (otherdevices[switch_1] == 'On')
  then
    commandArray[switch_1] = 'Off'
    print('"'..robot_path..'"')
    os.execute('"'..robot_path..'"')
    local message = otherdevices[text_sensor]
    local tit_msg = title..'"' .. ' "' ..message
    local combined = '""'..push_path..'" "'..tit_msg..'""'
    print(combined)
    os.execute(combined)
  end
return commandArray