Then you will need to figure-out the structure of the table so you can extract the data you want. If it was me, I would do it using LuaTest and print(pretty(tempString))
That command will not cause Vera to crash - but - it adds another ongoing activity and may well tip an overloaded system into a deadlock. This can easily happen when there are multiple simultaneous run actions in progress.
Looking at the log for the two minutes before a crash should show you what is happening. Problems will occur if there are plugins using run actions that take longer than a few milliseconds. The run queue is limited and, if Vera is unable to execute actions, it can gridlock and force a restart. Plugin actions that go beyond setting a few variables should use job processing.
Scenes that suspend waiting for I/O just add to the probability of gridlock.
If you want to use [tt]io.popen[/tt], it works like this:
[code]local handle = io.popen(‘ls -l /’)
local result = handle:read("*a")
print (result)
handle:close()[/code]
This will work, freestanding, in a .lua file. In my case, I wrote it in test.lua, and ran it with the command line version of Lua (since it has no Vera dependencies)
This is the snippet of code that fetches the value, just to show you how to use [tt]io.popen()[/tt]. The “result” of that call is put into a variable called result, which is a string value of whatever the OS command returned (in this case, a directory listing, but you’d call [tt]wget[/tt] instead)
It’s written in pure Lua, so it can be run from the command line so you can test/try/understand it independently of Vera. You will need to merge the snippet with the rest of your scene-logic.
Since that’s trivial, I didn’t bother with that part.
The [tt]handle:read()[/tt] call that’s in there is the bit that’s pulling in the output of the command that’s executed. The parameter, [tt]"*a"[/tt], simply tells read to pull in all the data into one [string] response.
These cover every generic topic you can imagine for learning Lua as a language. This is generally a first step before trying to understand the nuances of the Luup extensions that Vera adds.
Best Home Automation shopping experience. Shop at Ezlo!