Kodi Remote Control

hello and many thanks fo your help

I’ve changed the variables from xbmcstate to kodiremote in default.py , but it’s still the same – no information is being sent from Kodi to Vera. The commands from Vera to Kodi are not useful to me; I just want the play and pause states. Right now, I can see that it’s up or down for Kodi, but I don’t have the play and pause states.

When I directly send the URL in a browser, it does send the messages to the plugin, like 299, and changes the status to pause, stop, etc.

http://192.168.1.32:3480/data_request?id=variableset&DeviceNum=299&serviceId=urn:upnp-org:serviceId:KODIRemote1&Variable=PlayerStatus&Value=Video_stop

I have a “can’t detect device” message in red on the Vera since the installation, the same with xbmcstate and kodiremote. I’ll uninstall everything to see.

EDIT

Good news, the information is coming through despite the “can’t detect device” message. Not ideal, but it’s getting the job done!

i upload the file with kodiremote
micasaverde.addon.zip (42.2 KB)

1 Like

In the Vera UI7 web GUI go into the KodiRemote device and go to Advanced then Variables. Then look for a variable called Comm Failure. Edit that and change its value from a 1 to a 0 and Save.

Thank you, that’s great to hear that it’s working now!

I had a go myself also and got it working with the Player Status.

The icon is missing on the plugin instance however, not sure how to fix that.

image

Did you install the “KodiRemote” plugin from the App Store ? I did.

Note: - Seems you don’t actually need the akb-json.lua file uploaded to get the Player Status part working. As I forgot to upload the file initially and it was still working without it !

Yes, same here from the app store, and no icon as well.

Another question, as I haven’t really taken care of my Vera Edge for a very long time, and I’ve seen that it’s being abandoned for future updates. Is it better to migrate to Ezlo? There was supposed to be a migration tool from Vera to Ezlo, but is it reliable? Because I mainly use it for Z-Wave and a few old Lua scenarios. What did you do? Did you migrate?

Trying to fix the Transport control button in the Vera UI7 web GUI.

The Kodi HTTP commands are in the plugin file named “I_KODIRemote.xml”

I looked at fixing the “Back” button first.

image

Original Code:

function send_kodi_back_command ()
	        durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Input.Back%22%2c+%22id%22%3a+1%7d"
			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
end

New Code: This DOES NOT WORK

function send_kodi_back_command ()
	        os.execute('curl -X POST -H "content-type:application/json" http://" .. ipAddress .. ":8080/jsonrpc -d \'{"jsonrpc":"2.0","id":1,"method":"Input.Back"}\'')
end

This does work OK however if I explicitly hardcode the Kodi PC’s IP address. When pressing the “Back” button the Kodi GUI does go back.

function send_kodi_back_command ()
	        os.execute('curl -X POST -H "content-type:application/json" http://192.168.0.7:8080/jsonrpc -d \'{"jsonrpc":"2.0","id":1,"method":"Input.Back"}\'')
end

In the plugin “Params” I did enter in the IP of the Kodi PC.

image

And also on the “Variables” tab I changed the port number from 80 to 8080

image

So not sure why its not working when using the " … ipAddress … " and where it’s meant to be getting that IP address from etc.

Looking at the log on the Vera controller I see this:

08	08/24/23 14:00:34.813	JobHandler_LuaUPnP::HandleActionRequest device: 174 service: urn:upnp-org:serviceId:KODIRemote1 action: KODIBack <0x6c588520>
08	08/24/23 14:00:34.813	JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=174 <0x6c588520>
08	08/24/23 14:00:34.814	JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:KODIRemote1 <0x6c588520>
08	08/24/23 14:00:34.814	JobHandler_LuaUPnP::HandleActionRequest argument action=KODIBack <0x6c588520>
02	08/24/23 14:00:34.850	JobHandler_LuaUPnP::ConfirmReturnArguments missing KODIBack <0x6c588520>

I tried adding in more quotes " but this didn’t seem to work either, as nothing happens when I press the “Back” button.

os.execute('curl -X POST -H "content-type:application/json" "http://" .. ipAddress .. ":8080/jsonrpc -d \'{"jsonrpc":"2.0","id":1,"method":"Input.Back"}"\'')

I see the same message in the log file:

08	08/24/23 14:18:36.322	JobHandler_LuaUPnP::HandleActionRequest device: 174 service: urn:upnp-org:serviceId:KODIRemote1 action: KODIBack <0x6fbbe520>
08	08/24/23 14:18:36.322	JobHandler_LuaUPnP::HandleActionRequest argument DeviceNum=174 <0x6fbbe520>
08	08/24/23 14:18:36.322	JobHandler_LuaUPnP::HandleActionRequest argument serviceId=urn:upnp-org:serviceId:KODIRemote1 <0x6fbbe520>
08	08/24/23 14:18:36.323	JobHandler_LuaUPnP::HandleActionRequest argument action=KODIBack <0x6fbbe520>
02	08/24/23 14:18:36.416	JobHandler_LuaUPnP::ConfirmReturnArguments missing KODIBack <0x6fbbe520>

Here is the entire plugin file if someone with better coding skills wants to figure it out:

<?xml version="1.0"?>
<implementation>
  <functions>
  	local ipAddress
	local port
	local serviceid = "urn:upnp-org:serviceId:KODIRemote1"
	local deviceid = lul_device
	local endecoder = require("akb-json");

	local RENDERINGCONTROL_SID = 'urn:upnp-org:serviceId:RenderingControl'
	local AVTRANSPORT_SID = 'urn:upnp-org:serviceId:AVTransport'
		
	local DEBUG_MODE = false
	
	local function log(stuff, level)
		luup.log("KODI State: " .. stuff, (level or 50))
	end
	
	local function debug(stuff)
		if (DEBUG_MODE) then
			log("debug " .. stuff, 1)
		end
	end
  
	function getport (lul_device)
		local getports = luup.variable_get(serviceid,"Port", lul_device)
		return getports
	end
 
	function isup ()
		pingcommand = "ping -c 1 " ..ipAddress
		pingresponse = os.execute(pingcommand)
		if (pingresponse == 0) then
			luup.variable_set(serviceid,"PingStatus","up",lul_device)
			debug("KODIRemote is UP!")
		else
			luup.variable_set(serviceid,"PingStatus","down",lul_device)
			luup.variable_set(serviceid,"PlayerStatus","--",lul_device)
			luup.variable_set(serviceid,"IdleTime","--",lul_device)
			debug("KODIRemote is DOWN!")
		end
		PingInterval = luup.variable_get(serviceid,"PingInterval", lul_device)
		luup.call_timer("isup", 1, PingInterval, "", "")
	end

	function init(lul_device)
		ipAddress = luup.devices[lul_device].ip

		if (ipAddress == nil or ipAddress == "") then
			return false, "IP Address is required in Device's Advanced Settings!", "KODIRemote"
		else
			local Port1 = luup.variable_get(serviceid,"Port", lul_device)
			if Port1 == nil then
				luup.variable_set(serviceid,"Port","80",lul_device)
			end
			local PingInterval1 = luup.variable_get(serviceid,"PingInterval", lul_device)
			if PingInterval1 == nil then
				luup.variable_set(serviceid,"PingInterval","180",lul_device)
			end
			local PingStatus1 = luup.variable_get(serviceid,"PingStatus", lul_device)
			if PingStatus1 == nil then
				luup.variable_set(serviceid,"PingStatus","--",lul_device)
			end
			local IdleTime1 = luup.variable_get(serviceid,"IdleTime", lul_device)
			if IdleTime1 == nil then
				luup.variable_set(serviceid,"IdleTime","--",lul_device)
			end
			local PlayerStatus1 = luup.variable_get(serviceid,"PlayerStatus", lul_device)
			if PlayerStatus1 == nil then
				luup.variable_set(serviceid,"PlayerStatus","--",lul_device)
			end
			isup()
		end
	end

         function send_kodi_home_command ()
	        durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Input.Home%22%2c+%22id%22%3a+1%7d"
			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
        end
         function send_kodi_back_command ()
	        durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Input.Back%22%2c+%22id%22%3a+1%7d"
			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
        end
         function send_kodi_info_command ()
	        durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Input.Info%22%2c+%22id%22%3a+1%7d"
			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
        end
         function send_kodi_select_command ()
	        durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Input.Select%22%2c+%22id%22%3a+1%7d"
			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
        end
        function send_kodi_up_command ()
	        durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Input.Up%22%2c+%22id%22%3a+1%7d"
			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
        end
         function send_kodi_down_command ()
	        durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Input.Down%22%2c+%22id%22%3a+1%7d"
			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
        end
         function send_kodi_right_command ()
	        durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Input.Right%22%2c+%22id%22%3a+1%7d"
			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
        end 
         function send_kodi_left_command ()
	        durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Input.Left%22%2c+%22id%22%3a+1%7d"
			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
        end         

         function send_kodi_play_command ()
			local http1 = require("socket.http");

			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.GetActivePlayers%22%2c+%22id%22%3a+1%7d", 5)
			local jsondecoded = endecoder.decode(result1);

			local player_id =( jsondecoded['result'][1]['playerid'] );

			durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a%222.0%22%2c%22method%22%3a%22Player.PlayPause%22%2c%22params%22%3a%7b%22playerid%22%3a".. player_id .."%2c%22play%22%3atrue%7d%2c%22id%22%3a1%7d";
			http2 = require("socket.http");
			local  body, code, headers, status2 = http2.request(durl);
        end   
         function send_kodi_pause_command ()
			local http1 = require("socket.http");

			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.GetActivePlayers%22%2c+%22id%22%3a+1%7d", 5)
			local jsondecoded = endecoder.decode(result1);

			local player_id =( jsondecoded['result'][1]['playerid'] );

			durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a%222.0%22%2c%22method%22%3a%22Player.PlayPause%22%2c%22params%22%3a%7b%22playerid%22%3a".. player_id .."%2c%22play%22%3afalse%7d%2c%22id%22%3a1%7d";
			http2 = require("socket.http");
			local  body, code, headers, status2 = http2.request(durl);
        end  
         function send_kodi_stop_command ()
			local http1 = require("socket.http");

			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.GetActivePlayers%22%2c+%22id%22%3a+1%7d", 5)
			local jsondecoded = endecoder.decode(result1);

			local player_id =( jsondecoded['result'][1]['playerid'] );

			durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.Stop%22%2c+%22params%22%3a+%7b+%22playerid%22%3a+".. player_id .."+%7d%2c+%22id%22%3a+1%7d";
			http2 = require("socket.http");
			local  body, code, headers, status2 = http2.request(durl);
        end 


         function send_kodi_bigbackward_command ()
			local http1 = require("socket.http");

			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.GetActivePlayers%22%2c+%22id%22%3a+1%7d", 5)
			local jsondecoded = endecoder.decode(result1);

			local player_id =( jsondecoded['result'][1]['playerid'] );

			durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.Seek%22%2c+%22params%22%3a+%7b+%22playerid%22%3a+".. player_id .."%2c+%22value%22%3a+%22bigbackward%22+%7d%2c+%22id%22%3a+1%7d+";
			http2 = require("socket.http");
			local  body, code, headers, status2 = http2.request(durl);
        end 
         function send_kodi_bigforward_command ()
			local http1 = require("socket.http");

			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.GetActivePlayers%22%2c+%22id%22%3a+1%7d", 5)
			local jsondecoded = endecoder.decode(result1);

			local player_id =( jsondecoded['result'][1]['playerid'] );

			durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.Seek%22%2c+%22params%22%3a+%7b+%22playerid%22%3a+".. player_id .."%2c+%22value%22%3a+%22bigforward%22+%7d%2c+%22id%22%3a+1%7d+";
			http2 = require("socket.http");
			local  body, code, headers, status2 = http2.request(durl);
        end 

         function send_kodi_smallbackward_command ()
			local http1 = require("socket.http");

			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.GetActivePlayers%22%2c+%22id%22%3a+1%7d", 5)
			local jsondecoded = endecoder.decode(result1);

			local player_id =( jsondecoded['result'][1]['playerid'] );

			durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.Seek%22%2c+%22params%22%3a+%7b+%22playerid%22%3a+".. player_id .."%2c+%22value%22%3a+%22smallbackward%22+%7d%2c+%22id%22%3a+1%7d+";
			http2 = require("socket.http");
			local  body, code, headers, status2 = http2.request(durl);
        end 

         function send_kodi_smallforward_command ()
			local endecoder = require("akb-json");
			local http1 = require("socket.http");

			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.GetActivePlayers%22%2c+%22id%22%3a+1%7d", 5)
			local jsondecoded = endecoder.decode(result1);

			local player_id =( jsondecoded['result'][1]['playerid'] );

			durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.Seek%22%2c+%22params%22%3a+%7b+%22playerid%22%3a+".. player_id .."%2c+%22value%22%3a+%22smallforward%22+%7d%2c+%22id%22%3a+1%7d+";
			http2 = require("socket.http");
			local  body, code, headers, status2 = http2.request(durl);
        end



         function send_kodi_playpause_command ()
			local http1 = require("socket.http");

			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.GetActivePlayers%22%2c+%22id%22%3a+1%7d", 5)
			local jsondecoded = endecoder.decode(result1);

			local player_id =( jsondecoded['result'][1]['playerid'] );

			durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Player.PlayPause%22%2c+%22params%22%3a+%7b+%22playerid%22%3a+".. player_id .."+%7d%2c+%22id%22%3a+1%7d+";
			http2 = require("socket.http");
			local  body, code, headers, status2 = http2.request(durl);
        end 
        

         function send_kodi_mute_command ()
			durl = "http://" .. ipAddress .. ":8080/jsonrpc?request=%7b%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Application.SetMute%22%2c+%22params%22%3a+%7b+%22mute%22%3a+%22toggle%22%7d%2c+%22id%22%3a+1%7d"

			http = require("socket.http")
			local  body, code, headers, status = http.request(durl)
        end 

         function send_kodi_setfullscreen_command ()
			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b+%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22GUI.SetFullscreen%22%2c+%22params%22%3a+%7b+%22fullscreen%22%3a+true+%7d%2c%22id%22%3a0%7d", 5)
        end 

         function send_kodi_setVolume_command (cmd)
			local status1, result1 = luup.inet.wget("http://" .. ipAddress .. ":8080/jsonrpc?request=%7b+%22jsonrpc%22%3a+%222.0%22%2c+%22method%22%3a+%22Application.SetVolume%22%2c+%22params%22%3a+%7b+%22volume%22%3a+" .. cmd .. "+%7d%2c+%22id%22%3a+1+%7d", 5)
        end 

  </functions>
  <startup>init</startup>
  <actionList>
    <action>
      <serviceId>urn:upnp-org:serviceId:KODI1</serviceId>
      <name>GetPlayerStatus</name>
      <run>
        luup.variable_get(serviceid, "PlayerStatus", lul_device)
      </run>
    </action>
    <action>
      <serviceId>urn:upnp-org:serviceId:KODI1</serviceId>
      <name>SetPlayerStatus</name>
      <run>
        luup.variable_set(serviceid, "PlayerStatus", lul_settings.newPlayerStatus, lul_device)
      </run>
    </action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIHome</name>
      <run>
			send_kodi_home_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIBack</name>
      <run>
			send_kodi_back_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIInfo</name>
      <run>
			send_kodi_info_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODISelect</name>
      <run>
			send_kodi_select_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIUp</name>
      <run>
			send_kodi_up_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIDown</name>
      <run>
			send_kodi_down_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIRight</name>
      <run>
			send_kodi_right_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODILeft</name>
      <run>
			send_kodi_left_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
      <name>Play</name>
      <run>
			send_kodi_play_command ()
      </run>
	</action>
	<action>
		<serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
		<name>Pause</name>
		<run>
			send_kodi_pause_command ()
		</run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
      <name>Stop</name>
      <run>
			send_kodi_stop_command ()
      </run>
	</action>

        <action>
            <serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
            <name>SetVolume</name>
            <run>
                send_kodi_setVolume_command (lul_settings.DesiredVolume)
            </run>
        </action>

	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIPlaypause</name>
      <run>
			send_kodi_playpause_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIMute</name>
      <run>
			send_kodi_mute_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODISmallbackward</name>
      <run>
			send_kodi_smallbackward_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODISmallforward</name>
      <run>
			send_kodi_smallforward_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIBigbackward</name>
      <run>
			send_kodi_bigbackward_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODIBigforward</name>
      <run>
			send_kodi_bigforward_command ()
      </run>
	</action>
	<action>
      <serviceId>urn:upnp-org:serviceId:KODIRemote1</serviceId>
      <name>KODISetfullscreen</name>
      <run>
			send_kodi_setfullscreen_command ()
      </run>
	</action>
   </actionList>


</implementation>
 
 

I think lines 46 and 47 get the IP address

function init(lul_device)
		ipAddress = luup.devices[lul_device].ip

The “function isup” must be working as it does says “down” when the PC is off and “up” when the PC is on.

EDIT:

Maybe that message “JobHandler_LuaUPnP::ConfirmReturnArguments missing KODIBack” in the log is a red herring. as I see the same thing when I put in the actual IP address in the curl command and the back button then works.

But I can’t figure out how to get it working with the " … ipAddress … " instead.

No yet, I am still using my Vera Plus as my main controller. There are some threads on the forum talking about migration options. Have a search for those.

Okay, I’ve read a few things, but I haven’t come across any news about the tool that was supposed to arrive some time ago.

I am not sure what the current state of play is with regards to a migration path, I suggest you ask on one of the other threads.

If I do eventually migrate I will probably just move one Z-Wave device at a time over to my Ezlo controller and do it slowly and manually.

@madmax

image

If you want to fix the missing icon you have to do the following:

Connect to your Vera hub using WinSCP or whatever and copy the .png file into this folder:

/www/cmh/skins/default/icons

Now you need to edit the plugin file named “D_KODIRemote.json”

Change the first line from this:

"flashicon":"icons\/iconxbmcstate.png",

to this:

"default_icon": "../../../icons/kodistate.png",

kodistate

“kodistate.png” is what I called my new icon file etc. I also made it 50x50 in size.

Shame I couldn’t figure out how to fix the buttons or we’d have a fully working plugin again.

1 Like

@madmax Does the Player Status work for you when playing Music audio also?

In the Kodi addon settings in “Player state” I set all the Audio ones to “Yes”.

However in Vera I don’t see updated player status when I am playing albums / songs from the Kodi Music library.

It does work OK for me when playing Videos however.

Playing a song here:

image

Works when playing a Movie:

image

EDIT:

Never mind I fixed it. I broke something whilst customising the addon further.

image

1 Like

I’ll try it with music, but it’s for movies that I use Kodi in my home cinema room.

I’m not getting the title to come up; it’s strange, as if I’m missing some variables. However, if I play and pause, it works – the information comes back quickly. But if I press the movie to start it from the beginning, it doesn’t seem to recognize that it’s playing. Not a big issue, as it switches to pause correctly, and then resumes after pause. Still, I find it a bit odd.

I’d have to try / test it again to confirm what you say.
I’ll let you know next time I look at it again.

I didn’t edit any code to do with the Titles. I did edit some other code however to change some label names in both the Kodi addon and Vera plugin. I also slightly changed the variable names that get sent to the Vera plugin for the various play states.

I was hoping to also fix the buttons and then release all my changes in files posted here, but looks like I can’t get the buttons working.

1 Like

I have the same problem. Not good if it doesn’t recognise a movie has started playing.

As you say if you press Pause / Play it then updates the status and starts working.

@madmax I think I fixed the Video Start issue.

Edit your default.py file and go to line 62.

Change this:

def onPlayBackStarted(self):

to this:

def onAVChange(self):

Now when I start playing a movie it updates the status every time !

Here are my modified files so far, still haven’t fixed the buttons though.

micasaverde.addon.zip is the Kodi addon.
KODIRemote.zip are the Vera plugin files.

micasaverde.addon.zip (73.2 KB)

KODIRemote.zip (10 KB)

1 Like

The above fix for the Video Start then broke the Audio Start. I have updated the micasaverde.addon.zip file above again and now also got the Audio Start working again.

So both Video Start and Audio Start are working for me with those changes, so you might want to use my modified default.py file / Kodi addon now.

1 Like

I’ve got all the buttons working!

image

However the old code use to check for the active player ID of Kodi. I wasn’t able to get that part working yet, so I am just explicitly setting the player ID to 1 in my case which works for me.

If the buttons don’t work for you, you might have to edit the I_KODIRemote.xml file and change the player ID to something else like a 0 for the relevant HTTP commands.

For example, player Stop

os.execute('curl -X POST -H "content-type:application/json" "http://' .. ipAddress .. ':8080/jsonrpc" -d \'{"jsonrpc":"2.0","method":"Player.Stop","params":{"playerid":1},"id":1}\'')

Its this part {"playerid":1} you might need to change to {"playerid":0}

Anyway all the buttons are now working for myself and control my Kodi HTPC.

Attached are the updated Vera plugin files.

KODIRemote.zip (10 KB)

OK this is the final version and this one has code in it that does detect the Kodi Players current ID number and then inserts that number into the HTTP command (Player.GetActivePlayers).

I had a little help from a developer for that code, so thanks to him also.

KODIRemote.zip (10 KB)

Here is an example of the new code for the “Stop” command

function send_kodi_stop_command ()
	local command = 'curl -X POST -H "content-type:application/json" "http://' .. ipAddress .. ':8080/jsonrpc" -d \'{ "jsonrpc":"2.0", "method":"Player.GetActivePlayers", "id":1 }\''
    local handle = io.popen(command)
    local result = handle:read("*a")
    handle:close()

    local jsondecoded = endecoder.decode(result)
    local player_id = jsondecoded['result'][1]['playerid']
			
	os.execute('curl -X POST -H "content-type:application/json" "http://' .. ipAddress .. ':8080/jsonrpc" -d \'{ "jsonrpc":"2.0","method":"Player.Stop","params":{ "playerid":' .. player_id .. '},"id":1}\'')
end

I have also attached the Kodi addon.

micasaverde.addon.zip (73.2 KB)

And the Vera plugin icon which should be copied into this folder:

/www/cmh/skins/default/icons

kodistate

And here is a screen shot of the Player State triggers in a Vera scene. Just tested it and it is working.

Thank you for posting this! I just had to redo a vera system and was hunting around for the kodi addon file.
My issue now is that I can’t install the addon. It gives me a “Failed to install addon from zip file” and “The dependency on XBMC.Python V3.0.0 could not be satisfied”

Any insight? I’ve already allowed install apps from unknown sources.

Oh Im on LibreElec Kodi 18.9