Re: Lua and Kodi
Posted: Thursday 09 June 2016 22:55
Just did. Hope they're able to find the root cause of this issue 
https://github.com/domoticz/domoticz/issues/693

https://github.com/domoticz/domoticz/issues/693
Code: Select all
commandArray = {}
-- loop through all the changed devices
for deviceName,deviceValue in pairs(devicechanged) do
print ("Device based event fired on '"..deviceName.."', value '"..tostring(deviceValue).."'");
if (deviceName=='Test Trigger') then
commandArray[1] = { ['Lounge Kodi'] = 'Pause' }
commandArray[2] = { ['Lounge Kodi'] = 'Set Volume 50 AFTER 3' }
end
end
return commandArray
Code: Select all
2016-06-12 18:05:23.419 Kodi: (Lounge Kodi) Sent command: 'Input.ExecuteAction pause'.
2016-06-12 18:05:23.903 LUA: Device based event fired on 'Lounge Kodi', value 'Unknown'
2016-06-12 18:05:23.419 (Kodi Servers) Lighting 2 (Lounge Kodi)
2016-06-12 18:05:26.913 Kodi: (Lounge Kodi) Sent command: 'Set Volume'.
2016-06-12 18:05:26.915 Kodi: (Lounge Kodi) Volume changed to 50.00000, Muted: false.
2016-06-12 18:05:26.973 Kodi: (Lounge Kodi) Volume set to 50.
2016-06-12 18:05:27.137 LUA: Device based event fired on 'Lounge Kodi', value 'Unknown'
2016-06-12 18:05:26.913 (Kodi Servers) Lighting 2 (Lounge Kodi)
Code: Select all
commandArray = {}
-- loop through all the devices and find the Kodi Mediaplayers
for deviceName in pairs(otherdevices) do
Name = tostring(deviceName)
name = deviceName:sub(1,4)
if (name=='Kodi') then
print (deviceName..":"..otherdevices[deviceName]);
if (devicechanged['Doorbell_Switch'] == 'On' and otherdevices[deviceName] == 'Video') then
commandArray[deviceName] = 'Pause'
end
end
end
return commandArray
Code: Select all
2017-04-01 17:15:03.275 LUA: Kodi Livingroom:On
2017-04-01 17:15:03.275 LUA: Kodi Bedroom:On