Philips TV JSON

There are some attempts to this on the forum, but I didn’t find any solution.

I want to change the source of my Philips TV from HDMI1 to HDMI2 using JSON in luup code.

How can I do this?

http://jointspace.sourceforge.net/projectdata/documentation/jasonApi/1/doc/API-Method-sources-current-POST.html
http://jointspace.sourceforge.net/projectdata/documentation/jasonApi/1/doc/API-Method-audio-volume-POST.html
http://jointspace.sourceforge.net/projectdata/documentation/jasonApi/1/doc/API-Method-input-key-POST.html

How can i do this with lua code?

http://ip-address:1925/1/sources/current

POST json

{
“id”: “hdmi2”
}

[quote=“dawiinci, post:2, topic:180061”]How can i do this with lua code?

http://ip-address:1925/1/sources/current

POST json

{
“id”: “hdmi2”
}[/quote]

function SendInputCommand(ipAddress, inputName)
	local http = require("socket.http")
	local lRequest = [[{"id":"]]..inputName..[["}]]
	local lURL = [[http://]]..ipAddress..":1925/1/sources/current]]
	local contents,response=http.request(lURL, lRequest)
end

SendInputCommand("192.168.1.111","hdmi2")