Now i would like to have my lighting respond to it so i have a separate script to read the Plex status from the dummy (Switch type: media player). Unfortunately I can't get it to respond. Does anyone have an idea what I'm doing wrong?
return {
on = {
devices = {642} -- dz_plex_player IDX number plex media player device
},
logging = { level = domoticz.LOG_DEBUG,
marker = 'plexlivingroom',
},
execute = function(domoticz, plexmedia)
local playingtest = domoticz.devices(301) -- Dummy test switch playing
local pausedtest = domoticz.devices(303) -- Dummy test switch paused
-- when Plex is playing switch on device
if (plexmedia.state == 7) then
--if (plexmedia.state == 'playing') then
--if (plexmedia.nValue == 7) then
playingtest.switchOn()
-- when Plex paused switch on device
elseif (plexmedia.state == 2) then
--elseif (plexmedia.state == 'paused') then
--elseif (plexmedia.nValue == 2) then
pausedtest.switchOn()
end
end
}
DomoRies wrote: ↑Thursday 30 April 2020 16:17
Now i would like to have my lighting respond to it so i have a separate script to read the Plex status from the dummy (Switch type: media player).
can you try this? It does show you the actual state and nValue and check for the states as string
return {
on = {
devices = {642} -- dz_plex_player IDX number plex media player device
},
logging = { level = domoticz.LOG_DEBUG,
marker = 'plexlivingroom',
},
execute = function(domoticz, plexmedia)
local playingtest = domoticz.devices(301) -- Dummy test switch playing
local pausedtest = domoticz.devices(303) -- Dummy test switch paused
domoticz.log('plexmedia state: ' .. (plexmedia.state or ' no State?'), domoticz.LOG_DEBUG)
domoticz.log('plexmedia nvalue: ' .. plexmedia.nValue, domoticz.LOG_DEBUG)
-- when Plex is playing switch on device
if (plexmedia.state == '7' ) then
--if (plexmedia.state == 'playing') then
--if (plexmedia.nValue == 7) then
playingtest.switchOn()
-- when Plex paused switch on device
elseif (plexmedia.state == '2' ) then
--elseif (plexmedia.state == 'paused') then
--elseif (plexmedia.nValue == 2) then
pausedtest.switchOn()
end
end
}
DomoRies wrote: ↑Thursday 30 April 2020 16:17
Now i would like to have my lighting respond to it so i have a separate script to read the Plex status from the dummy (Switch type: media player).
can you try this? It does show you the actual state and nValue and check for the states as string
return {
on = {
devices = {642} -- dz_plex_player IDX number plex media player device
},
logging = { level = domoticz.LOG_DEBUG,
marker = 'plexlivingroom',
},
execute = function(domoticz, plexmedia)
local playingtest = domoticz.devices(301) -- Dummy test switch playing
local pausedtest = domoticz.devices(303) -- Dummy test switch paused
domoticz.log('plexmedia state: ' .. (plexmedia.state or ' no State?'), domoticz.LOG_DEBUG)
domoticz.log('plexmedia nvalue: ' .. plexmedia.nValue, domoticz.LOG_DEBUG)
-- when Plex is playing switch on device
if (plexmedia.state == '7' ) then
--if (plexmedia.state == 'playing') then
--if (plexmedia.nValue == 7) then
playingtest.switchOn()
-- when Plex paused switch on device
elseif (plexmedia.state == '2' ) then
--elseif (plexmedia.state == 'paused') then
--elseif (plexmedia.nValue == 2) then
pausedtest.switchOn()
end
end
}
Thanks for your reaction.
Strange, I played something in plex and paused but nothing happens in the log. The device is updated by the 'Plex status script'.
DomoRies wrote: ↑Thursday 30 April 2020 16:59
Strange, I played something in plex and paused but nothing happens in the log. The device is updated by the 'Plex status script'.
The posted Plex status script uses the option silent() if you have not removed that it will not trigger any subsequent scripts.
DomoRies wrote: ↑Thursday 30 April 2020 16:59
Strange, I played something in plex and paused but nothing happens in the log. The device is updated by the 'Plex status script'.
The posted Plex status script uses the option silent() if you have not removed that it will not trigger any subsequent scripts.
Wow thank you very much! Never thought about that. It works now