Binding for Sony Bravia tv

1,485 views
Skip to first unread message

Stefan TP

unread,
Aug 19, 2014, 4:08:31 AM8/19/14
to ope...@googlegroups.com
Hi.
Anybody how have been working on a binding for Sony tv's?
It is possible to control the over wifi, so guess it would be possible to make a openhanded binding too.
Unfortunately I do not have the skills my self, so hope that there is a person with the right skills who think that this would be useful too.

Best regards
Stefan.

Hans Jørgensen

unread,
Aug 19, 2014, 9:35:23 AM8/19/14
to ope...@googlegroups.com
I can add some info on this.. that at least works on my TV (can't remember the model.. It's a W6 or W7 I think)

http://blog.rieder.io/blog/2014/02/04/bravia-scripting/
http://www.openremote.org/display/forums/Sony+TV+HTTP+control

Some more functions are available via uPNP. Like setting the volume to something specific instead of just turning up / down. And also reading the current volume.

The TV can be turned on with Wake-on-LAN..

What I've not been able to find out is how to figure out what channel/input the TV is on right now.. If anyone knows please share..

I've put a bunch of scripts in my ~/bin with the useful functions I've fund.. And I have attached them as a tgz to this post if anyone likes them...
bravia-scripts.tgz

Stefan TP

unread,
Aug 20, 2014, 4:39:04 AM8/20/14
to ope...@googlegroups.com
Hi Hans Jørgen
 
Thank you for sharring.
 
Now just a dump question.
How du you use these scripts?
Eg if i want to use a item or rule to turn off the tv, how do i send the TVoff command from openhab to the tv?
Ass you guess i am quite new to this "world"
 
Thanks
Stefan

Hans Jørgensen

unread,
Aug 20, 2014, 8:04:33 AM8/20/14
to ope...@googlegroups.com
Hello Stef T.

I'm using the exec binding..

Switch TV_Status                "TV" <video>                            { exec="ON:/home/haj/bin/TVon_hdmi2, OFF:/home/haj/bin/TVoff" }

And actually I run a bash script in cron that keeps the status of the TV updated..  (as well as sync other stuff that I'm not using bindings for), below is the relevant part of the cron script;
<code>
# TV status
TVSTATE=`curl --connect-timeout 3 -s --header 'Content-Type: text/plain' --request POST --data '{"id":20,"method":"getPowerStatus","version":"1.0","params":[]}' http://tv/sony/system`
if [ $? == 28 ];then
        TVSTATE=off
else TVSTATE=`echo $TVSTATE | cut -d\" -f8`
fi
if [ "$TVSTATE" == "off" ];then
        TV_Status=OFF
elif [ "$TVSTATE" == "standby" ];then
        TV_Status=OFF
elif [ "$TVSTATE" == "active" ];then
        TV_Status=ON
fi

curl -s --header "Content-Type: text/plain" --request PUT --data "$TV_Status" http://192.168.1.103:8180/rest/items/TV_Status/state
</code>

Kirk Herron

unread,
Apr 10, 2015, 4:43:56 PM4/10/15
to ope...@googlegroups.com
Not sure if you can use this, but I have created an API Library called SonyAPILib,
We have just started a Google group here: https://groups.google.com/forum/#!forum/sony-api-library

You can also download the project here: https://github.com/KHerron/SonyAPILib
Reply all
Reply to author
Forward
0 new messages