Python plugin: Sony Bravia TV
Moderator: leecollings
-
- Posts: 94
- Joined: Monday 30 November 2015 16:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
It seems the plugin here isnt working.
im on V3.5877.
updating to beta fails
How can i fix this?
im on V3.5877.
updating to beta fails
How can i fix this?
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
You indeed need a beta to use this. Your version is the latest stable which does not support the Python plugins.
You can go to your Domoticz folder and execute
to install the latest beta.
You can go to your Domoticz folder and execute
Code: Select all
./updatebeta
Not using Domoticz anymore
-
- Posts: 94
- Joined: Monday 30 November 2015 16:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
Een i user ./Updatebeta, domoticz wint start anymore. Seems that there is another problem
-
- Posts: 69
- Joined: Wednesday 05 November 2014 10:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
I have a sony kdl40525exbaep from 2012, dont know if it works with, but if you think so, I can test for you.
Raspberry Pi 2 model B with domoticz
OMV NAS installed on thin client HP T610
Openelec Kodi Mediaplayer on thin client HP T520 (and with multiboot windows 10)
OMV NAS installed on thin client HP T610
Openelec Kodi Mediaplayer on thin client HP T520 (and with multiboot windows 10)
-
- Posts: 2
- Joined: Thursday 13 April 2017 12:59
- Target OS: Windows
- Domoticz version:
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
Hello G3rard, I'm new here and I don't have any idea about Python. But want to learn it. I will follow you, please update your post as much as you can. Thanks.
-
- Posts: 36
- Joined: Wednesday 07 December 2016 19:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
Hello,
I've tried the plugin with my Sony TV but I've find some problems,
- The first regarding the authorization mode, I'm not able to use the PSK. My TV normally does not have the menu to configure this settings, so i've put th TV in hotel mode and then enabled the PSK ad described, unfortunately I'm not able to control the tv with the plugin using this method.
using the old authorization mode with the cookie, the plugin is able to interact with the TV.
- The second problem is the volume bar, the volume is retrived correctly the mute function is ok but if i want to increase or decrease the volume the settings does not sended to the tv.
Someone have any ideas ?
I've tried the plugin with my Sony TV but I've find some problems,
- The first regarding the authorization mode, I'm not able to use the PSK. My TV normally does not have the menu to configure this settings, so i've put th TV in hotel mode and then enabled the PSK ad described, unfortunately I'm not able to control the tv with the plugin using this method.
using the old authorization mode with the cookie, the plugin is able to interact with the TV.
- The second problem is the volume bar, the volume is retrived correctly the mute function is ok but if i want to increase or decrease the volume the settings does not sended to the tv.
Someone have any ideas ?
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
@markcame, yeah there is still an issue with the volume slider. Updates from the TV are correctly received, but updates from Domoticz are not working yet. I have to check this in bravia.py.
Will make a Github issue for this (feel free to make an issue on Github yourself btw ).
The cookie method is working then? That is good news.
What is your TV model? Then I can add that to the readme on Github.
Will make a Github issue for this (feel free to make an issue on Github yourself btw ).
The cookie method is working then? That is good news.
What is your TV model? Then I can add that to the readme on Github.
Not using Domoticz anymore
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Python plugin: Sony Bravia [ready for test]
Well you don't need to have any Python knowledge to use the plugin.NotsniwFrancisco wrote:Hello G3rard, I'm new here and I don't have any idea about Python. But want to learn it. I will follow you, please update your post as much as you can. Thanks.
Just install the Domoticz beta and follow the readme on Github and you can start using the plugin.
Last edited by G3rard on Thursday 13 April 2017 14:56, edited 1 time in total.
Not using Domoticz anymore
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
Not sure if it will work, as I read somewhere you need a Bravia >= 2013, but just give it a try.DaWauZ wrote:I have a sony kdl40525exbaep from 2012, dont know if it works with, but if you think so, I can test for you.
Not using Domoticz anymore
-
- Posts: 36
- Joined: Wednesday 07 December 2016 19:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
@G3rard, the tv model is KDL- 42W805A at the moment the only way to control is using cookie, i will create the cookie using a script founded on github and then i put it in your script, i don't know if exist another way to do this.
at the moment i'm testing the plugin it works well in this way, i've noticed that probably needs to sync the input status with the retrived one from the tv , especially if the command is issued from a normal remote control.
the right imput isd displayed but on the input selector not...
thanks for the development of the plugin.
at the moment i'm testing the plugin it works well in this way, i've noticed that probably needs to sync the input status with the retrived one from the tv , especially if the command is issued from a normal remote control.
the right imput isd displayed but on the input selector not...
thanks for the development of the plugin.
Re: Python plugin: Sony Bravia [ready for test]
Nice plugin!
X8509C Android TV here.
My findings are -
Source seems to work fine.
EPG data works fine - Reports what is on TV
Volume doesn't work (as mentioned by others) but muting and reporting of volume does work.
The TV Remote button doesn't do anything (Not sure what it's supposed to do).
The TV does turn off, but will not turn on (I use WIFI, and a quick look at your script shows you use WOL, so i'm out of luck)
What i use to turn the TV on via wifi is an adapted version of another script made by StefanPuntNL (pasted it at the end of my post)
i just added this part -
jsonbodypoweron = '{\\"id\\":2,\\"method\\":\\"setPowerStatus\\",\\"version\\":\\"1.0\\",\\"params\\":[{ \\"status\\" : true}]}'
and then i edited the rest of the script accordingly.
I don't know if this only works for android TVs or not though...
Here's the full On/Off script (it does pull info from another script which pings my TV)
X8509C Android TV here.
My findings are -
Source seems to work fine.
EPG data works fine - Reports what is on TV
Volume doesn't work (as mentioned by others) but muting and reporting of volume does work.
The TV Remote button doesn't do anything (Not sure what it's supposed to do).
The TV does turn off, but will not turn on (I use WIFI, and a quick look at your script shows you use WOL, so i'm out of luck)
What i use to turn the TV on via wifi is an adapted version of another script made by StefanPuntNL (pasted it at the end of my post)
i just added this part -
jsonbodypoweron = '{\\"id\\":2,\\"method\\":\\"setPowerStatus\\",\\"version\\":\\"1.0\\",\\"params\\":[{ \\"status\\" : true}]}'
and then i edited the rest of the script accordingly.
I don't know if this only works for android TVs or not though...
Here's the full On/Off script (it does pull info from another script which pings my TV)
Code: Select all
commandArray = {}
if(devicechanged['Sony TV']) then
url = 'http://MYIPADDRESS/sony/system'
headername = 'X-Auth-PSK'
headervalue = 'sony'
jsonbodypoweroff = '{\\"id\\":2,\\"method\\":\\"setPowerStatus\\",\\"version\\":\\"1.0\\",\\"params\\":[{ \\"status\\" : false}]}'
jsonbodypoweron = '{\\"id\\":2,\\"method\\":\\"setPowerStatus\\",\\"version\\":\\"1.0\\",\\"params\\":[{ \\"status\\" : true}]}'
if (devicechanged['Sony TV'] == 'On') then
if(uservariables['TVOnlyStatusUpdate'] == 1) then
print('TV status update received (ON), resetting user variable.')
commandArray['Variable:TVOnlyStatusUpdate'] = '0'
else
runcommand = 'curl -v -H \"Content-Type:application/json\" -H \"' .. headername .. ':' .. headervalue .. '\" -d \"' .. jsonbodypoweron .. '\" ' .. url .. ''
response = os.execute(runcommand)
if response then
print('TV wakes up')
end
end
end
if (devicechanged['Sony TV'] == 'Off') then
if(uservariables['TVOnlyStatusUpdate'] == 1) then
print('TV status update received (OFF), resetting user variable.')
commandArray['Variable:TVOnlyStatusUpdate'] = '0'
else
runcommand = 'curl -v -H \"Content-Type:application/json\" -H \"' .. headername .. ':' .. headervalue .. '\" -d \"' .. jsonbodypoweroff .. '\" ' .. url .. ''
response = os.execute(runcommand)
if response then
print('TV goes sleepy sleep')
else
print('TV not in the mood for sleepy sleep')
end
end
end
end
return commandArray
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
Can you share the script for the cookie? Because the bravia.py I am using was originally created with the use of a cookie. I changed it to a PSK because that works easier and I had some troubles with the cookie.markcame wrote:@G3rard, the tv model is KDL- 42W805A at the moment the only way to control is using cookie, i will create the cookie using a script founded on github and then i put it in your script, i don't know if exist another way to do this.
at the moment i'm testing the plugin it works well in this way, i've noticed that probably needs to sync the input status with the retrived one from the tv , especially if the command is issued from a normal remote control.
the right imput isd displayed but on the input selector not...
thanks for the development of the plugin.
Maybe I can add a selector in the hardware page where you can choose between the cookie and the PSK.
The inputs are currently hardcoded (HDMI 1/MHL, HDMI 2, HDMI 3, HDMI 4). So if these are different on your TV, then the selector switch with the sources will indeed not show the correct state. The sources can be retrived from the TV with the use of bravia.py.
Can you add the following code to localtest.py (somewhere around line 70) and share the print result (preferably as a comment on https://github.com/gerard33/sony-bravia/issues/5)?
Code: Select all
test2 = x.get_source('extInput:hdmi')
print('Source list:', test2)
Last edited by G3rard on Friday 14 April 2017 1:05, edited 2 times in total.
Not using Domoticz anymore
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
Nice to see it's working on Sony Bravia with Android as wellMonki77 wrote:Nice plugin!
X8509C Android TV here.
My findings are -
Source seems to work fine.
EPG data works fine - Reports what is on TV
Volume doesn't work (as mentioned by others) but muting and reporting of volume does work.
The TV Remote button doesn't do anything (Not sure what it's supposed to do).
The TV does turn off, but will not turn on (I use WIFI, and a quick look at your script shows you use WOL, so i'm out of luck)
What i use to turn the TV on via wifi is an adapted version of another script made by StefanPuntNL (pasted it at the end of my post)
i just added this part -
jsonbodypoweron = '{\\"id\\":2,\\"method\\":\\"setPowerStatus\\",\\"version\\":\\"1.0\\",\\"params\\":[{ \\"status\\" : true}]}'
and then i edited the rest of the script accordingly.
I don't know if this only works for android TVs or not though...
Here's the full On/Off script (it does pull info from another script which pings my TV)
I used the script of StefanPuntNL as well
* Volume slider is indeed not working yet. Made a Github issue for that (https://github.com/gerard33/sony-bravia/issues/1).
* The TV remote is indeed not working. Not sure if that is supported by the Python plugin (yet).
* The script indeed uses WOL to turn the TV on. But there is also another way in bravia.py to turn the tv on. I commented that part out because it gave errors for my TV. But can you add the following code as the bottom of localtest.py and see if that works?
Code: Select all
x.send_req_ircc(x.get_command_code('TvPower'))
Not using Domoticz anymore
Re: Python plugin: Sony Bravia [ready for test]
I pasted "x.send_req_ircc(x.get_command_code('TvPower'))" at the end of localtest.py (just above the "else: Print" part) and restarted the domoticz.sh service just incase, but it didn't work
I hope i did it right haha.
I hope i did it right haha.
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Python plugin: Sony Bravia [ready for test]
The code must be added as the last line and with the same indent as the print line.
Also enter the IP and PSK in the top of the file (replacing the current values).
No need to restart anything, just SSH to the bravia plugin directory and execute
That will print some results and after this change tries to start the TV (when it's not switched on).
Also enter the IP and PSK in the top of the file (replacing the current values).
No need to restart anything, just SSH to the bravia plugin directory and execute
Code: Select all
./localtest.py
Not using Domoticz anymore
-
- Posts: 36
- Joined: Wednesday 07 December 2016 19:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
for the authorization with cookie i use the following script that can be found here https://github.com/breunigs/bravia-auth-and-remote
move on auth_cookie_examples folder then run auth.sh (you must previously fill with the required information in the script such as IP, nickname and a UUID)
then on the TV wil be displayed a code you can now enter on the console the code and a file will be created with the cookie.
it would be nice if this can be automatized in the plugin as a binding procedure, otherwise you can always run the the script and modify to update a domoticz variable that the plugin can catch, i think that for a full integration the harder part is to create a text box to enter the code displayed on the TV.
move on auth_cookie_examples folder then run auth.sh (you must previously fill with the required information in the script such as IP, nickname and a UUID)
then on the TV wil be displayed a code you can now enter on the console the code and a file will be created with the cookie.
it would be nice if this can be automatized in the plugin as a binding procedure, otherwise you can always run the the script and modify to update a domoticz variable that the plugin can catch, i think that for a full integration the harder part is to create a text box to enter the code displayed on the TV.
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
A new version of the plugin is available on https://github.com/gerard33/sony-bravia.
- Fixed volume control from Domoticz
- Fixed source name issue (regarding /MHL and the HDMI source)
- Added start time and end time for program playing
- Show status 'TV starting' in device when TV is switched on using Domoticz (it takes some time for the TV to boot and in the meanwhile no TV information is being loaded)
- Direct response in the Domoticz switches when TV is switched off using Domoticz
- Some cleanup
- Fixed volume control from Domoticz
- Fixed source name issue (regarding /MHL and the HDMI source)
- Added start time and end time for program playing
- Show status 'TV starting' in device when TV is switched on using Domoticz (it takes some time for the TV to boot and in the meanwhile no TV information is being loaded)
- Direct response in the Domoticz switches when TV is switched off using Domoticz
- Some cleanup
Last edited by G3rard on Sunday 16 April 2017 14:32, edited 2 times in total.
Not using Domoticz anymore
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
I think this can also work with the bravia.py file.markcame wrote:for the authorization with cookie i use the following script that can be found here https://github.com/breunigs/bravia-auth-and-remote
move on auth_cookie_examples folder then run auth.sh (you must previously fill with the required information in the script such as IP, nickname and a UUID)
then on the TV wil be displayed a code you can now enter on the console the code and a file will be created with the cookie.
it would be nice if this can be automatized in the plugin as a binding procedure, otherwise you can always run the the script and modify to update a domoticz variable that the plugin can catch, i think that for a full integration the harder part is to create a text box to enter the code displayed on the TV.
Are you able to try the connect function from bravia.py? You can add that to localtest.py to see if that works as well.
Not using Domoticz anymore
-
- Posts: 94
- Joined: Monday 30 November 2015 16:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Python plugin: Sony Bravia [work in progress]
I fixed my version of domoticz and added your plugin.G3rard wrote:Making some good progress with the plugin. Expect to release a first version soon which can be used for testing.
Let me know if you are interested to test the plugin.
It will work on Sony Bravia models 2013 and newer. Not tested on Sony Bravia with Android yet!
sony_tv_plugin.png
I see all the 3 devices. How can i adjust volume? it can only be muted
Last edited by maomanna on Tuesday 18 April 2017 23:39, edited 1 time in total.
- G3rard
- Posts: 669
- Joined: Wednesday 04 March 2015 22:15
- Target OS: -
- Domoticz version: No
- Location: The Netherlands
- Contact:
Re: Python plugin: Sony Bravia [ready for test]
Have you set the volume bar option to true in the hardware page?
Not using Domoticz anymore
Who is online
Users browsing this forum: Bing [Bot] and 1 guest