Page 2 of 2
Re: Trying to run LUA Script got error 'popen' not supported-osx
Posted: Thursday 29 December 2016 14:41
by trixwood
Can i suggest using Domoticz internal Weatherunderground and patch your script to use that.. and remove all other weatherunderground from the script...
(I can not see why it is in the script anyway, since the hardware was already available, it kinda double if you have both this script & weatherunderground as hardware... but anyway..)...
Check out:
http://domoticz.com/forum/viewtopic.php ... 100#p94028
http://domoticz.com/forum/viewtopic.php ... 100#p94042 and the surrounding posts...
Re: Trying to run LUA Script got error 'popen' not supported-osx
Posted: Thursday 29 December 2016 18:21
by DrMacabre
You read my mind

Re: Trying to run LUA Script got error 'popen' not supported-osx
Posted: Friday 30 December 2016 11:52
by DrMacabre
Hello,
What is the "r" for in your exemple ?
local config = io.open(tmpfile, "r")
Re: Trying to run LUA Script got error 'popen' not supported-osx
Posted: Friday 30 December 2016 13:36
by trixwood
Re: Trying to run LUA Script got error 'popen' not supported-osx
Posted: Friday 30 December 2016 13:39
by DrMacabre
Thank you. I start to feel im even understanding what i'm reading
still getting a nil value with this.
Code: Select all
tmpfile = os.tmpname()
cmd = 'curl "http://www.ogimet.com/cgi-bin/getsynop?block='..WMOID..'&begin='..UTC..'"' .. ' > ' .. tmpfile
if( DEBUG == 1) then print(cmd) end
os.execute(cmd)
local ogimet = io.open(tmpfile, "r")
local synop = ogimet:read('*all')
ogimet:close()
if( DEBUG == 1) then print('ogimet:'..synop) end
trying my best to understand each line with the correct syntax but still...
Re: Trying to run LUA Script got error 'popen' not supported-osx
Posted: Friday 30 December 2016 15:04
by trixwood
Well the idea is to execute curl, save its output in a temporary file, and read it back.
You can try to executing the command you printed with debug in the terminal to see if its correct...
I do not know where os.tmpname stores its file, and if you have rights there (it should be, but who knows) so you can also hardcode the tempfile
instead of using os.tmpname().
as example for my pi to my home folder:
tmpfile = /home/pi/sun.tmp
You should remove the temp files with
if you are done with it, or else it will fill up your storage. and you should check your the temp folder printed with the debug, for the already existing temp files you created and delete those...
https://www.lua.org/manual/5.1/manual.h ... -os.remove
Re: Trying to run LUA Script got error 'popen' not supported-osx
Posted: Friday 30 December 2016 17:20
by DrMacabre
Dank u wel, i was so lost. It works fine with a hardcoded temp file. Dunno why not with a generated one.
Re: Trying to run LUA Script got error 'popen' not supported-osx
Posted: Friday 30 December 2016 17:42
by trixwood
it probably wanted to write were it has no rights. Who knows... i should have opted for the hardcoded to begin with... anyway.
About the whole lux sensor. the thing is inaccurate as f anyway... especially if you ogmet station is not really close and you have clear skies and the station has not..,... better point a lux sensor to the sky yourself

Re: Trying to run LUA Script got error 'popen' not supported-osx
Posted: Friday 30 December 2016 17:51
by DrMacabre
Still better than nothing, the station is a few KM away. I will see how it works for a few days. Thanks again.