19.04.2017, 14:23
One more simple KODI control solution:
Code:
require('socket.http')
socket.http.TIMEOUT = 5
-- play ---------------------------------------------------------------------------------------------
data1 = socket.http.request('http://192.168.1.79:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "Input.ExecuteAction", "params": { "action": "play" }, "id": 1 }')
-- pause --------------------------------------------------------------------------------------------
data1 = socket.http.request('http://192.168.1.79:8080/jsonrpc?request={ "jsonrpc": "2.0", "method": "Input.ExecuteAction", "params": { "action": "pause" }, "id": 1 }, "id": 1 }')
-- down ---------------------------------------------------------------------------------------------
data1 = socket.http.request('http://192.168.1.79:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Input.Down", "id": 1}')
-- up -----------------------------------------------------------------------------------------------
data1 = socket.http.request('http://192.168.1.79:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Input.Up", "id": 1}')
-- right --------------------------------------------------------------------------------------------
data1 = socket.http.request('http://192.168.1.79:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Input.Right", "id": 1}')
-- left ---------------------------------------------------------------------------------------------
data1 = socket.http.request('http://192.168.1.79:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Input.Left", "id": 1}')
-- home ---------------------------------------------------------------------------------------------
data1 = socket.http.request('http://192.168.1.79:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Input.Home", "id": 1}')
-- select -------------------------------------------------------------------------------------------
data1 = socket.http.request('http://192.168.1.79:8080/jsonrpc?request={"jsonrpc": "2.0", "method": "Input.Select", "id": 1}')