Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Kodi control lights play,pauze,stop


Recommended Posts

Posted

hi all,

 

Iam using a quickapp that let me control kodi on my Nvidia shield.

 

The only thing that was missing was to control the lights when I pressed play,pauze,stop when I use the remote controller of the shield it self.

After a lot of trail an error I found a solution but its nog perfect in my eyes, but my Lua knowledge is to limited at the moment.

Maybe someone can assist me to make it more streamlined and functional.

 

I will put the part of the code that I use for the controls down below.

 

 

 

if GetActivePlayers[1] and GetActivePlayers[1].playerid and GetActivePlayers[1].type then
                local new_playerType = GetActivePlayers[1].type
                local player_id = GetActivePlayers[1].playerid
 
                -- Get player properties values
                KODI:getPlayerProperties(player_id, {"speed","time","percentage","totaltime"}, {
                    success = function(GetProperties)
                        -- {"id":"PlayerGetProperties","jsonrpc":"2.0","result":{"percentage":0.028967026621103287,"speed":1,"time":{"hours":0,"milliseconds":890,"minutes":0,"seconds":1},"totaltime":{"hours":1,"milliseconds":660,"minutes":48,"seconds":44}}}
                        local new_state
                        if GetProperties.speed then
                            if GetProperties.speed > 0 then
                                new_state = "playing"
                                fibaro.call(33, "turnOff")
                                fibaro.call(175, "turnOff")
                                fibaro.call(180, "turnOff")
                                --icon = "Play"
                            else
                                new_state = "paused"
                                fibaro.call(175, "turnOn")
                                fibaro.call(175, 'setValue', 50)
                                fibaro.call(180, "turnOn")
                                fibaro.call(180, 'setValue', 50)
                                --icon = "Pause"
                            end

--icon = "Stop"

                self:updateKodi(self.RefreshON, true, "stopped", new_playerType, new_title, "", "", 0, icon)

                                fibaro.call(33, "turnOn")

                                fibaro.call(33, "setValue",30)

                                fibaro.call(175, "turnOff")

                                fibaro.call(180, "turnOff")

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...