I want to make a LUA time script that turns-On a Zwave smartplug for 20secons, and plays one alarm sound twice
But it does not work as expected.
If I leave the smartplug = 'On' and exceute the scritp, it plays well the sound twice every minute
Only leaving the (commandArray['Powerplug'] = "On FOR 20 SECONDS', it works well, plug ON 20secons every minute
And If I put all together, the plug turns ON (but more than 20 seconds) but it does not play any sound. However I can see in the log, that the output of the .mp3 (bitrate, etc) has been printed.
for information: I use the assert+read+close, to be sure the execution of the io.popen is finished before playing the second sound.
Does anyone knows whats happening? another way around?
Code: Select all
commandArray = {}
commandArray['Powerplug'] = "On FOR 20 SECONDS"
local file = assert(io.popen('omxplayer --vol -1500 /home/pi/MyHDD/AlarmSounds/GarageOpen.mp3'))
local output = file:read('*all')
file:close()
print(output)
local file2 = assert(io.popen('omxplayer --vol -1500 /home/pi/MyHDD/AlarmSounds/GarageOpen.mp3'))
local output2 = file2:read('*all')
file2:close()
print(output2)
return commandArray