script_device_radio.lua
Code: Select all
commandArray = {}
if (devicechanged['Radio Channels'] == 'CDNX' and otherdevices['Radio Volume'] == 'Off' ) then
commandArray['Radio Volume'] = 'On'
print('Radio Volume')
newlevel = 10
print(newlevel)
commandArray['Radio Volume'] = 'Set Level' ..newlevel
print("radio on")
print(otherdevices_svalues['Radio Volume'])
end
if (devicechanged['Radio Volume']) then
v = otherdevices_svalues['Radio Volume']
os.execute('mpc volume ' ..v)
print("radio volume " ..v)
end
return commandArray
Code: Select all
2016-07-25 12:19:04.310 User: Admin initiated a switch command
2016-07-25 12:19:04.325 LUA: Radio Volume
2016-07-25 12:19:04.326 LUA: 10
2016-07-25 12:19:04.326 LUA: radio on
2016-07-25 12:19:04.326 LUA: 0
2016-07-25 12:19:04.327 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_radio.lua
2016-07-25 12:19:04.311 (DUMMY) Light/Switch (Radio Channels)
2016-07-25 12:19:04.954 Executing script: /home/pi/domoticz/scripts/mpc_CDNX.sh
2016-07-25 12:19:10.040 LUA: radio volume 0
2016-07-25 12:19:09.998 (DUMMY) Light/Switch (Radio Volume)