Domoticz V4.10717
Plateform : Rpi 3
OS : Raspbian stretch
Hello,
I'm struggling while trying to sent a command to my Philips TV, for example, to set to volume to a given value with the OpenUrl command.
- The URL that has to be used is something like : http://ip-address:1925/1/audio/volume
- The method that should be used is POST
- I guess the parameters intended to my tv should be set in the postdata parameter of the OpenUrl command.
The postdata should be a JSON object ressembling to :
{
"muted": false,
"current": 18
}
This is relatively well documented here:
http://jointspace.sourceforge.net/proje ... -POST.html
However, when I use the domoticz.OpenUrl command, the data shown in the postdata is always empty, whatever the syntax I use to specify the JSON object.
Did someone already face this kind of issues with the openurl command, or does anyone have a example of how he dealed with sending commands to a Philips TV ?
I have tried out more or less all I could think about, unfortunately, still unsuccessfull.
If I do the same without postdata and with the GET method (to get the current volume), this runs fine, so the URL is most probably correct.
Thank you so much to the one(s) who could help me there. I'm trying to find out the solution over 3 days. Now, I'm out of ideas
dzvents - openurl - postdata
Moderator: leecollings
-
- Posts: 11
- Joined: Thursday 16 May 2019 22:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
dzvents - openurl - postdata
Last edited by fanabullunet on Wednesday 26 June 2019 19:43, edited 2 times in total.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: dzvents - openurl - postdata
Don't know what you already tried but should be something like this.fanabullunet wrote: ↑Tuesday 25 June 2019 23:18 I'm struggling while trying to sent a command to my Philips TV, for example, to set to volume to a given value with the OpenUrl command.
Code: Select all
return
{
on =
{
timer = {'every minute'},
response = { 'mycallbackstring' },
},
logging = { level = domoticz.LOG_DEBUG, marker = 'post data' },
execute = function(dz, item)
local targetIP = '192.168.xxx.xxx' -- Change to IP or dns of your TV
local function setVolume(volume)
url = 'http://' .. targetIP .. ':1925/1/audio/volume'
dz.openURL(
{
url = url,
method = 'POST',
callback = 'mycallbackstring',
postData =
{
muted = false,
current = volume,
}
})
end
if item.isTimer then
setVolume(8)
else
domoticz.log('Response from TV: ' .. item.data )
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: 11
- Joined: Thursday 16 May 2019 22:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: dzvents - openurl - postdata
Hi waaren
thank you for your reply. Will test it and let you know
thank you for your reply. Will test it and let you know
-
- Posts: 11
- Joined: Thursday 16 May 2019 22:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: dzvents - openurl - postdata
Hi waaren,
it seems so silly once it works ! So, good news, the answer is below
The problem was that, my postData was coded this way:
postData =
{
"muted": false,
"current": 18,
}
instead of:
postData =
{
muted = false,
current = 18,
}
Thanks you !
it seems so silly once it works ! So, good news, the answer is below
The problem was that, my postData was coded this way:
postData =
{
"muted": false,
"current": 18,
}
instead of:
postData =
{
muted = false,
current = 18,
}
Thanks you !
Who is online
Users browsing this forum: No registered users and 1 guest