Os.execute from reactor

Probably a dumb question but is it possible to have os.execute called from a Reactor activity? Currently I have a reactor that runs a scene that executes the script…



Oh yeah. It can be in scene Lua, or you can do it directly from a Run Lua action in the activity. Should not be a problem.

If you do it in Run Lua and you’re having trouble, add some print() statements, which will log to the “Events” section of the Logic Summary and may be a little easier to get to than using luup.log() and fetching the Vera log file. There’s also a Reactor.dump() function you can call to “stringify” a table, for example print(Reactor.dump(luup.devices))

For the hard of thinking, how do it in Run Lua?

I tried putting in os.execute etc etc but that’s not happy. I assume there’s something I need to warp it in and have no LUA :frowning:


Hmmm… maybe a little more detail about what’s happening? It should be as simple as going into Activities, and under whichever activity applies, adding a “Run Lua” action, and in the script window typing something like:


or the slightly more verbose:

local st = os.execute("date")
print("The status of the command is " .. tostring(st))

…which should emit a message to logic summary, hopefully “The status of the command is 0” (0 = no errors).

How very odd. I tried that (before I asked the obviously dumb question) and it refused to accept it.

Works fine now!

As ever, thanks!


Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules