But what's a good way of making the LUA script wait for the result of the python script robotdock.pyw? The way it is now I have to run the script twice to get the real value of the dummy info device since it doesn't update fast enough for the first run.
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