rickwilleme wrote:dannybloe wrote:
Let me know if there still problems or missing kodi support.
What command should I use for executing the Kodi script?
Tried two ways but neither of them seem to work. Pausing video does work, so I know the Lua script is being triggered well.
Code: Select all
return {
active = true,
on = {
'DummyDeurbel'
},
execute = function(domoticz, mySwitch)
if (mySwitch.state == 'Group On') then
local kodi = domoticz.devices['HTPC - Kodi']
-- Pause if not playing music
if (kodi.state ~= "Audio") then
kodi.state = 'Pause'
end
-- Execute script SecurityCam
kodi.state = 'Execute script.securitycam'
kodi.execute = 'script.securitycam'
end
end
}
No, I guess this won't work indeed. So, let's start at the beginning. I assume that you do get into the first if-block right? Second, modifying devices with dzVents is not by setting the state. You have to use any of the device methods as listed
here. So in your case you could try kodi.setState('Pause').
Third, I just learned there are specific kodi commands (from the wiki):
commandArray['Lounge']='Off'
commandArray['Lounge']='Pause'
commandArray['Lounge']='Set Volume 30'
commandArray['Lounge']='Play Playlist Indierock'
commandArray['Lounge']='Play Playlist ActionMovies 15'
commandArray['Lounge']='Play Favorites'
commandArray['Lounge']='Play Favorites 3'
commandArray['Lounge']='Execute script.securitycam'
Currently there is no kodi support in dzVents specific for this so you have to use the generic methods:
domoticz.sendCommand('HTPC - Kodi', 'Execute script.securitycam')
so your script will be something like this:
Code: Select all
return {
active = true,
on = {
'DummyDeurbel'
},
execute = function(domoticz, deurbel)
if (deurbel.state == 'Group On') then
local kodi = domoticz.devices['HTPC - Kodi']
-- Pause if not playing music
if (kodi.state ~= "Audio") then
kodi.setState('Pause')
end
domoticz.sendCommand('HTPC - Kodi', 'Execute script.securitycam')
end
end
}
I will add the kodi commands and let you know.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.