
I'm trying to play a sound file when Security Panel is set to "Arm Away" using a switch. The following is the code I'm experimenting with:
Code: Select all
commandArray = {}
if (devicechanged['Shed Security'] == 'On') then
commandArray['Shed Security Panel'] = 'Arm Away'
local chord = audio.loadSound( "chord.wav" )
audio.play( chord )
end
if (devicechanged['Shed Security'] == 'Off') then
commandArray['Shed Security Panel'] = 'Disarm'
end
return commandArray
Can anyone help me with how I can get the sound file "found" by the script please? I have tried placing the chord.wav file in a few different locations, including the Domoticz scripts directory, and scripts\lua; I've also tried including file paths with the file name but none of this has worked.Error: EventSystem: in Shed security with switch: [string "commandArray = {} ..."]:4: attempt to index global 'audio' (a nil value)
This script is being created in the Domoticz Events editor.
TIA!