domoticz.openURL with JSON to control Kodi volume
Moderator: leecollings
-
- Posts: 13
- Joined: Wednesday 16 January 2019 14:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
domoticz.openURL with JSON to control Kodi volume
Hello all,
I have this
"curl -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Application.SetVolume","id":1,"params":{"volume":80}}' http://192.168.1.4:8080/jsonrpc"
in a bash script and I am using os.execute out of dzVents to set the volume on my Kodi.
I would like to use domoticz.openURL to do the volume setting directly but can not get it to work.
This is what I did, but domoticz doesn't like it. Something about postData is not formated properly.
domoticz.openURL({
url = 'http://192.168.1.4:8080/jsonrpc',
method = 'POST',
postData = {"jsonrpc":"2.0","method":"Application.SetVolume","id":1,"params":{"volume":80}}
})
Any ideas?
Regards
Kemal
I have this
"curl -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Application.SetVolume","id":1,"params":{"volume":80}}' http://192.168.1.4:8080/jsonrpc"
in a bash script and I am using os.execute out of dzVents to set the volume on my Kodi.
I would like to use domoticz.openURL to do the volume setting directly but can not get it to work.
This is what I did, but domoticz doesn't like it. Something about postData is not formated properly.
domoticz.openURL({
url = 'http://192.168.1.4:8080/jsonrpc',
method = 'POST',
postData = {"jsonrpc":"2.0","method":"Application.SetVolume","id":1,"params":{"volume":80}}
})
Any ideas?
Regards
Kemal
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
can you try this ?hkemal wrote: ↑Wednesday 16 January 2019 14:32 I have thisin a bash script and I am using os.execute out of dzVents to set the volume on my Kodi.Code: Select all
"curl -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"Application.SetVolume","id":1,"params":{"volume":80}}' http://192.168.1.4:8080/jsonrpc"
I would like to use domoticz.openURL to do the volume setting directly but can not get it to work. Any ideas?
Code: Select all
domoticz.openURL(
{
url = 'http://192.168.1.4:8080/jsonrpc',
method = 'POST',
postData = { ['jsonrpc'] = "2.0", ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ "volume":80}' }
}
)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 13
- Joined: Wednesday 16 January 2019 14:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
Hello,
I tried it.
Domoticz doesn't give any error but Kodi is not reacting. Volume does not get changed.
Maybe Kodi returns some error code, how can I catch this?
Regards
Kemal
I tried it.
Domoticz doesn't give any error but Kodi is not reacting. Volume does not get changed.
Maybe Kodi returns some error code, how can I catch this?
Regards
Kemal
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
Can you try this ?
Code: Select all
callback = "kodiResponse"
return {
on = { timer = { "every minute" },
httpResponses = { callback .. "*" },
},
logging = {
level = domoticz.LOG_DEBUG,
marker = "kodiResponse Test"
},
execute = function(dz, item)
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
local function setKodiVolume(postData,delay,testID)
delay = delay or 0
testID = testID or 1
dz.openURL(
{
url = 'http://192.168.1.4:8080/jsonrpc',
method = 'POST',
postData = postData,
callback = callback .. testID
}
).afterSec(delay)
end
if item.isHTTPResponse then
logWrite ("return from Kodi testString[" .. item.trigger:gsub(callback,"") .. "] ==>> " .. item.data)
else
local parmString1 = '{ ["volume"] = 80}'
local parmString2 = "volume"
local testStrings = {}
testStrings[1] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ \"volume\":80}' }"
testStrings[2] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ [ ' .. ' \"volume\" .. '] = 80}' }"
testStrings[3] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = ".. parmString1 .. "}"
testStrings[4] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = { [ ".. parmString2 .. "] }"
for index,testString in ipairs(testStrings) do
logWrite(testString[index])
setKodiVolume(testStrings[index],index * 5 , index)
end
end
end
}]
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 6
- Joined: Friday 29 June 2018 22:55
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
Hi,
Who can help.
I have created and tested a curl command and want to use this inside domoticz lua but can't get it to work.
This is my curl command (private info removed). I tested this with git bash
curl -X PUT --data '{"on":false}' http://192.168.100.128/api/<removed>/gr ... mer/action
This will switch of the light from HUE
This is my lua translation. It doesn't show errors but isn't working
os.execute ('curl -X PUT --data "{on:false}" http://192.168.100.128/api/<removed>/gr ... mer/action')
Who can help.
I have created and tested a curl command and want to use this inside domoticz lua but can't get it to work.
This is my curl command (private info removed). I tested this with git bash
curl -X PUT --data '{"on":false}' http://192.168.100.128/api/<removed>/gr ... mer/action
This will switch of the light from HUE
This is my lua translation. It doesn't show errors but isn't working
os.execute ('curl -X PUT --data "{on:false}" http://192.168.100.128/api/<removed>/gr ... mer/action')
-
- Posts: 13
- Joined: Wednesday 16 January 2019 14:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
Hi,waaren wrote: ↑Thursday 17 January 2019 15:40Can you try this ?
Code: Select all
callback = "kodiResponse" return { on = { timer = { "every minute" }, httpResponses = { callback .. "*" }, }, logging = { level = domoticz.LOG_DEBUG, marker = "kodiResponse Test" }, execute = function(dz, item) local function logWrite(str,level) dz.log(tostring(str),level or dz.LOG_DEBUG) end local function setKodiVolume(postData,delay,testID) delay = delay or 0 testID = testID or 1 dz.openURL( { url = 'http://192.168.1.4:8080/jsonrpc', method = 'POST', postData = postData, callback = callback .. testID } ).afterSec(delay) end if item.isHTTPResponse then logWrite ("return from Kodi testString[" .. item.trigger:gsub(callback,"") .. "] ==>> " .. item.data) else local parmString1 = '{ ["volume"] = 80}' local parmString2 = "volume" local testStrings = {} testStrings[1] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ \"volume\":80}' }" testStrings[2] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ [ ' .. ' \"volume\" .. '] = 80}' }" testStrings[3] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = ".. parmString1 .. "}" testStrings[4] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = { [ ".. parmString2 .. "] }" for index,testString in ipairs(testStrings) do logWrite(testString[index]) setKodiVolume(testStrings[index],index * 5 , index) end end end }]
this was in the log
2019-01-18 15:24:00.684 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: test_kodi:, trigger: every minute
2019-01-18 15:24:00.684 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-18 15:24:00.685 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-18 15:24:00.685 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-18 15:24:00.685 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ "volume":80}' }
2019-01-18 15:24:00.686 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = nil
2019-01-18 15:24:00.686 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse1
2019-01-18 15:24:00.687 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-18 15:24:00.687 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-18 15:24:00.687 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-18 15:24:00.688 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ [ ' .. ' "volume" .. '] = 80}' }
2019-01-18 15:24:00.688 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = nil
2019-01-18 15:24:00.688 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse2
2019-01-18 15:24:00.689 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-18 15:24:00.689 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-18 15:24:00.689 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-18 15:24:00.690 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = { ["volume"] = 80}}
2019-01-18 15:24:00.690 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = nil
2019-01-18 15:24:00.690 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse3
2019-01-18 15:24:00.691 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-18 15:24:00.691 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-18 15:24:00.691 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-18 15:24:00.692 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = { [ volume] }
2019-01-18 15:24:00.692 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = nil
2019-01-18 15:24:00.692 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse4
2019-01-18 15:24:00.693 Status: dzVents: Info: kodiResponse Test: ------ Finished test_kodi
2019-01-18 15:24:06.552 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse1
2019-01-18 15:24:06.552 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: test_kodi: HTTPResponse: "kodiResponse1"
2019-01-18 15:24:06.553 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[1] ==>>
2019-01-18 15:24:06.553 Status: dzVents: Info: kodiResponse Test: ------ Finished test_kodi
2019-01-18 15:24:06.046 Error: Error opening url: http://192.168.1.4:8080/jsonrpc
2019-01-18 15:24:11.566 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse2
2019-01-18 15:24:11.566 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: test_kodi: HTTPResponse: "kodiResponse2"
2019-01-18 15:24:11.567 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[2] ==>>
2019-01-18 15:24:11.567 Status: dzVents: Info: kodiResponse Test: ------ Finished test_kodi
2019-01-18 15:24:11.062 Error: Error opening url: http://192.168.1.4:8080/jsonrpc
2019-01-18 15:24:16.556 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse3
2019-01-18 15:24:16.557 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: test_kodi: HTTPResponse: "kodiResponse3"
2019-01-18 15:24:16.557 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[3] ==>>
2019-01-18 15:24:16.558 Status: dzVents: Info: kodiResponse Test: ------ Finished test_kodi
2019-01-18 15:24:16.055 Error: Error opening url: http://192.168.1.4:8080/jsonrpc
2019-01-18 15:24:21.552 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse4
2019-01-18 15:24:21.552 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: test_kodi: HTTPResponse: "kodiResponse4"
2019-01-18 15:24:21.553 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[4] ==>>
2019-01-18 15:24:21.553 Status: dzVents: Info: kodiResponse Test: ------ Finished test_kodi
2019-01-18 15:24:21.047 Error: Error opening url: http://192.168.1.4:8080/jsonrpc
2019-01-18 15:24:28.471 (RaZberry) Lux (Lichtstaerke_Wohnung)
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
What do you see in the log when you execute this ? (Please make sure to deactivate the previous script first)hkemal wrote: ↑Friday 18 January 2019 16:31 this was in the log
2019-01-18 15:24:06.046 Error: Error opening url: http://192.168.1.4:8080/jsonrpc
Code: Select all
callback = "kodiResponse"
return {
on = { timer = { "every minute" },
httpResponses = { callback .. "*" },
},
logging = {
level = domoticz.LOG_DEBUG,
marker = "kodiResponse Test"
},
execute = function(dz, item)
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
local function getKodiAddons()
dz.openURL(
{
url = 'http://192.168.1.4:8080/addons/',
method = 'GET',
callback = callback .. "_get"
}
)
end
if item.isHTTPResponse then
logWrite ("return from Kodi: " .. item.data)
else
getKodiAddons()
end
end
}]
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 13
- Joined: Wednesday 16 January 2019 14:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
This is what I get
dzVents: Info: kodiResponse Test: ------ Start internal script: testkodi:, trigger: every minute
2019-01-19 20:08:00.579 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/addons/
2019-01-19 20:08:00.579 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = GET
2019-01-19 20:08:00.580 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = nil
2019-01-19 20:08:00.580 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = nil
2019-01-19 20:08:00.580 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse_get
2019-01-19 20:08:00.581 Status: dzVents: Info: kodiResponse Test: ------ Finished testkodi
2019-01-19 20:08:01.527 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse_get
2019-01-19 20:08:01.527 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: testkodi: HTTPResponse: "kodiResponse_get"
2019-01-19 20:08:01.528 Status: dzVents: Debug: kodiResponse Test: return from Kodi: <html><head><title>Add-on List</title></head><body>
2019-01-19 20:08:01.528 <h1>Available web interfaces:</h1>
2019-01-19 20:08:01.528 <ul>
2019-01-19 20:08:01.528 <li><a href=/addons/webinterface.default/>Kodi web interface - Chorus2</a></li>
2019-01-19 20:08:01.528 </ul>
2019-01-19 20:08:01.528 </body></html>
2019-01-19 20:08:01.528 Status: dzVents: Info: kodiResponse Test: ------ Finished testkodi
dzVents: Info: kodiResponse Test: ------ Start internal script: testkodi:, trigger: every minute
2019-01-19 20:08:00.579 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/addons/
2019-01-19 20:08:00.579 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = GET
2019-01-19 20:08:00.580 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = nil
2019-01-19 20:08:00.580 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = nil
2019-01-19 20:08:00.580 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse_get
2019-01-19 20:08:00.581 Status: dzVents: Info: kodiResponse Test: ------ Finished testkodi
2019-01-19 20:08:01.527 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse_get
2019-01-19 20:08:01.527 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: testkodi: HTTPResponse: "kodiResponse_get"
2019-01-19 20:08:01.528 Status: dzVents: Debug: kodiResponse Test: return from Kodi: <html><head><title>Add-on List</title></head><body>
2019-01-19 20:08:01.528 <h1>Available web interfaces:</h1>
2019-01-19 20:08:01.528 <ul>
2019-01-19 20:08:01.528 <li><a href=/addons/webinterface.default/>Kodi web interface - Chorus2</a></li>
2019-01-19 20:08:01.528 </ul>
2019-01-19 20:08:01.528 </body></html>
2019-01-19 20:08:01.528 Status: dzVents: Info: kodiResponse Test: ------ Finished testkodi
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
Ok that at least confirms Kodi does. So it must be something related to the method POST . Maybe you need to add something in the header part like this ?
Code: Select all
callback = "kodiResponse"
return {
on = { timer = { "every minute" },
httpResponses = { callback .. "*" },
},
logging = {
level = domoticz.LOG_DEBUG,
marker = "kodiResponse Test"
},
execute = function(dz, item)
local function logWrite(str,level)
dz.log(tostring(str),level or dz.LOG_DEBUG)
end
local function setKodiVolume(postData,delay,testID)
delay = delay or 0
testID = testID or 1
dz.openURL(
{
url = 'http://192.168.1.4:8080/jsonrpc',
method = 'POST',
headers = { ['Content-type'] = 'application/json' },
postData = postData,
callback = callback .. testID
}
).afterSec(delay)
end
if item.isHTTPResponse then
logWrite ("return from Kodi testString[" .. item.trigger:gsub(callback,"") .. "] ==>> " .. item.data)
else
local parmString1 = '{ ["volume"] = 80}'
local parmString2 = "volume"
local testStrings = {}
testStrings[1] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ \"volume\":80}' }"
testStrings[2] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ [ ' .. ' \"volume\" .. '] = 80}' }"
testStrings[3] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = ".. parmString1 .. "}"
testStrings[4] = "{ ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = { [ ".. parmString2 .. "] }"
for index,testString in ipairs(testStrings) do
logWrite(testString[index])
setKodiVolume(testStrings[index],index * 5 , index)
end
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 13
- Joined: Wednesday 16 January 2019 14:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
Hello,
sorry for the delay, I executed it now.
Kodi gives a parse error back.
2019-01-28 13:12:00.376 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi:, trigger: every minute
2019-01-28 13:12:00.376 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-28 13:12:00.377 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-28 13:12:00.377 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-28 13:12:00.377 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ "volume":80}' }
2019-01-28 13:12:00.378 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = {["Content-type"]="application/json"}
2019-01-28 13:12:00.378 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse1
2019-01-28 13:12:00.379 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-28 13:12:00.379 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-28 13:12:00.379 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-28 13:12:00.380 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ [ ' .. ' "volume" .. '] = 80}' }
2019-01-28 13:12:00.380 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = {["Content-type"]="application/json"}
2019-01-28 13:12:00.380 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse2
2019-01-28 13:12:00.381 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-28 13:12:00.381 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-28 13:12:00.381 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-28 13:12:00.382 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = { ["volume"] = 80}}
2019-01-28 13:12:00.382 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = {["Content-type"]="application/json"}
2019-01-28 13:12:00.382 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse3
2019-01-28 13:12:00.383 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-28 13:12:00.383 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-28 13:12:00.383 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-28 13:12:00.384 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = { [ volume] }
2019-01-28 13:12:00.384 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = {["Content-type"]="application/json"}
2019-01-28 13:12:00.384 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse4
2019-01-28 13:12:00.385 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
2019-01-28 13:12:06.290 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse1
2019-01-28 13:12:06.290 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi: HTTPResponse: "kodiResponse1"
2019-01-28 13:12:06.322 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[1] ==>> {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
2019-01-28 13:12:06.322 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
2019-01-28 13:12:11.280 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse2
2019-01-28 13:12:11.281 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi: HTTPResponse: "kodiResponse2"
2019-01-28 13:12:11.304 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[2] ==>> {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
2019-01-28 13:12:11.304 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
2019-01-28 13:12:16.279 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse3
2019-01-28 13:12:16.280 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi: HTTPResponse: "kodiResponse3"
2019-01-28 13:12:16.304 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[3] ==>> {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
2019-01-28 13:12:16.305 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
2019-01-28 13:12:21.291 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse4
2019-01-28 13:12:21.291 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi: HTTPResponse: "kodiResponse4"
2019-01-28 13:12:21.315 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[4] ==>> {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
2019-01-28 13:12:21.315 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
sorry for the delay, I executed it now.
Kodi gives a parse error back.
2019-01-28 13:12:00.376 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi:, trigger: every minute
2019-01-28 13:12:00.376 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-28 13:12:00.377 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-28 13:12:00.377 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-28 13:12:00.377 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ "volume":80}' }
2019-01-28 13:12:00.378 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = {["Content-type"]="application/json"}
2019-01-28 13:12:00.378 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse1
2019-01-28 13:12:00.379 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-28 13:12:00.379 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-28 13:12:00.379 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-28 13:12:00.380 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = '{ [ ' .. ' "volume" .. '] = 80}' }
2019-01-28 13:12:00.380 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = {["Content-type"]="application/json"}
2019-01-28 13:12:00.380 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse2
2019-01-28 13:12:00.381 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-28 13:12:00.381 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-28 13:12:00.381 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-28 13:12:00.382 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = { ["volume"] = 80}}
2019-01-28 13:12:00.382 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = {["Content-type"]="application/json"}
2019-01-28 13:12:00.382 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse3
2019-01-28 13:12:00.383 Status: dzVents: Debug: kodiResponse Test: nil
2019-01-28 13:12:00.383 Status: dzVents: Debug: kodiResponse Test: OpenURL: url = http://192.168.1.4:8080/jsonrpc
2019-01-28 13:12:00.383 Status: dzVents: Debug: kodiResponse Test: OpenURL: method = POST
2019-01-28 13:12:00.384 Status: dzVents: Debug: kodiResponse Test: OpenURL: post data = { ['jsonrpc'] = '2.0', ['method'] = 'Application.SetVolume', ['id'] = 1, ['params'] = { [ volume] }
2019-01-28 13:12:00.384 Status: dzVents: Debug: kodiResponse Test: OpenURL: headers = {["Content-type"]="application/json"}
2019-01-28 13:12:00.384 Status: dzVents: Debug: kodiResponse Test: OpenURL: callback = kodiResponse4
2019-01-28 13:12:00.385 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
2019-01-28 13:12:06.290 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse1
2019-01-28 13:12:06.290 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi: HTTPResponse: "kodiResponse1"
2019-01-28 13:12:06.322 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[1] ==>> {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
2019-01-28 13:12:06.322 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
2019-01-28 13:12:11.280 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse2
2019-01-28 13:12:11.281 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi: HTTPResponse: "kodiResponse2"
2019-01-28 13:12:11.304 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[2] ==>> {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
2019-01-28 13:12:11.304 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
2019-01-28 13:12:16.279 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse3
2019-01-28 13:12:16.280 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi: HTTPResponse: "kodiResponse3"
2019-01-28 13:12:16.304 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[3] ==>> {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
2019-01-28 13:12:16.305 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
2019-01-28 13:12:21.291 Status: dzVents: Info: Handling httpResponse-events for: "kodiResponse4
2019-01-28 13:12:21.291 Status: dzVents: Info: kodiResponse Test: ------ Start internal script: kodi: HTTPResponse: "kodiResponse4"
2019-01-28 13:12:21.315 Status: dzVents: Debug: kodiResponse Test: return from Kodi testString[4] ==>> {"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}
2019-01-28 13:12:21.315 Status: dzVents: Info: kodiResponse Test: ------ Finished kodi
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
I expect that is something to do with quotes disappearing between domoticz and Kodi but cannot test as I do not own one. What you could try is escaping the quotes with a backslash so ' would become \' and " would become \"
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 13
- Joined: Wednesday 16 January 2019 14:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: domoticz.openURL with JSON to control Kodi volume
I had to do some escaping and forming of the data to match my syntax in curl, but this finally did the trick
testStrings[1] = "{\"jsonrpc\":\"2.0\", \"method\":\"Application.SetVolume\", \"id\":1, \"params\":{\"volume\":80}}"
Thank you!!
testStrings[1] = "{\"jsonrpc\":\"2.0\", \"method\":\"Application.SetVolume\", \"id\":1, \"params\":{\"volume\":80}}"
Thank you!!
Who is online
Users browsing this forum: No registered users and 1 guest