Page 4 of 11
Re: Python plugin: Sony Bravia [ready for test]
Posted: Monday 01 May 2017 17:44
by Schuko80
Wow, it works now ... for all who have problems, the Problem was the opera browser, at the Computer it don't works with a old Version of Firefox, too - now i have used Firefox on Android and it works - nice plugin - thanks
Re: Python plugin: Sony Bravia [ready for test]
Posted: Monday 01 May 2017 23:50
by G3rard
Schuko80 wrote:Wow, it works now ... for all who have problems, the Problem was the opera browser, at the Computer it don't works with a old Version of Firefox, too - now i have used Firefox on Android and it works - nice plugin - thanks
That's good to hear
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 0:00
by G3rard
markcame wrote:
i have try to use localtest.py but i get response "[]" and i'm not able to read the real response, i think that actually the renew happens because the old cookie loses it's validity.
Can you also share localtest.py? Maybe I can help with the response part.
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 0:08
by G3rard
DarkFoxDK wrote:I've got a Sony Bravia KDL-46EX724, which is a couple of generations older than the ones supported by the plugin, however, it still does support IRCC codes, so I wonder what would be needed for at least partial support?
Have done some testing with my KDL-32EX720 and only IRCC commands are supported. So it's not possible to turn the TV on.
Also it's not possible to show what is being played.
So the only thing possible is to make a very simple version, where you can use a selector switch or the remote control to do some basic controls (volume, channel, HDMI input etc).
That would mean I have to make a new plugin for this kind of TV's. I can try to find some time to do that, but it has a low priority.
What IRCC functions do you want to control from Domoticz with this plugin?
And maybe we can use some info from
this site.
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 0:10
by G3rard
EBOOZ wrote:This is awesome! I'll test the script this weekend
Already did some testing?
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 0:12
by DarkFoxDK
G3rard wrote:DarkFoxDK wrote:I've got a Sony Bravia KDL-46EX724, which is a couple of generations older than the ones supported by the plugin, however, it still does support IRCC codes, so I wonder what would be needed for at least partial support?
Have done some testing with my KDL-32EX720 and only IRCC commands are supported. So it's not possible to turn the TV on.
Also it's not possible to show what is being played.
So the only thing possible is to make a very simple version, where you can use a selector switch or the remote control to do some basic controls (volume, channel, HDMI input etc).
That would mean I have to make a new plugin for this kind of TV's. I can try to find some time to do that, but it has a low priority.
What IRCC functions do you want to control from Domoticz with this plugin?
Unless you really feel like it, I wouldn't bother. I can just as easily use my current script with virtual switches and on/off actions.
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 0:15
by G3rard
DarkFoxDK wrote:Unless you really feel like it, I wouldn't bother. I can just as easily use my current script with virtual switches and on/off actions.
Are you able to switch the TV on with your script (using the wakeonlan part)? Then things are getting more interesting
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 0:22
by DarkFoxDK
G3rard wrote:DarkFoxDK wrote:Unless you really feel like it, I wouldn't bother. I can just as easily use my current script with virtual switches and on/off actions.
Are you able to switch the TV on with your script (using the wakeonlan part)? Then things are getting more interesting
Sadly not.
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 21:05
by markcame
G3rard wrote:markcame wrote:
i have try to use localtest.py but i get response "[]" and i'm not able to read the real response, i think that actually the renew happens because the old cookie loses it's validity.
Can you also share localtest.py? Maybe I can help with the response part.
on localtest.py i sinply added :
Code: Select all
x.connect("0000" , "prova","prova1")
on the first run, then i pass the pin and run manually again and changing the code with
Code: Select all
x.connect("3074" , "prova","prova1")
then the tv says device registered but in bravia.py the json.dumps give me error and i'n not able lo read the real response
Code: Select all
pi@raspberrypi:~/domoticz/plugins/sony$ python3 localtest.py
Traceback (most recent call last):
File "localtest.py", line 25, in <module>
x.connect("3074" , "prova","prova1")
File "/home/pi/domoticz/plugins/sony/bravia.py", line 104, in connect
Domoticz.Debug(json.dumps(response.json()))
AttributeError: 'bytes' object has no attribute 'json'
for now i have set a workaround i call with subprocess a bash script to renew the cookie but would be nice to obtain internally form the plugin
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 21:14
by G3rard
@markcame, yeah that is exactly the line I mentioned in an earlier post, which isn't changed and still depending on the requests module, where the other parts of the code are changed to use the urllib module (requests module is not working with the Python plugin).
Can you change
Code: Select all
Domoticz.Debug(json.dumps(response.json()))
to
and maybe comment out the next line starting with self._cookies because that is also still using the requests module part.
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 22:05
by markcame
G3rard wrote:@markcame, yeah that is exactly the line I mentioned in an earlier post, which isn't changed and still depending on the requests module, where the other parts of the code are changed to use the urllib module (requests module is not working with the Python plugin).
Can you change
Code: Select all
Domoticz.Debug(json.dumps(response.json()))
to
and maybe comment out the next line starting with self._cookies because that is also still using the requests module part.
changing gime me
Code: Select all
pi@raspberrypi:~/domoticz/plugins/sony$ python3 localtest.py
b'{"id":1,"result":[]}'
it seems still give null result
Re: Python plugin: Sony Bravia [ready for test]
Posted: Tuesday 02 May 2017 23:55
by G3rard
Just released a new version on
https://github.com/gerard33/sony-bravia.
* Added remote control --> you can now use the remote control in Domoticz (next to the TV icon in the Status device), this can among others be used for volume up and down (will also work when you have an amplifier connected)
* Added channel number in playing information --> shows the channel number which is playing
* Some code cleanup
Re: Python plugin: Sony Bravia [ready for test]
Posted: Wednesday 03 May 2017 14:43
by vgr2
I could see the remote control, but how should it be work? I could not see any response if i try it... do i have to do updates before
Re: Python plugin: Sony Bravia [ready for test]
Posted: Wednesday 03 May 2017 14:59
by G3rard
Update to the latest version of the plugin and then restart Domoticz.
Re: Python plugin: Sony Bravia [ready for test]
Posted: Wednesday 03 May 2017 15:14
by vgr2
ok I will try it. Will it be also possible (for you) to have an connection to the integrated TV camaera?
Re: Python plugin: Sony Bravia [ready for test]
Posted: Thursday 04 May 2017 21:11
by G3rard
Nope, the TV camera is not part of the interface I am using for the plugin.
Re: Python plugin: Sony Bravia [ready for test]
Posted: Sunday 07 May 2017 19:46
by vgr2
Remote control is working with latest version. Will it be possible to add the TV/Radio button to RC?
Re: Python plugin: Sony Bravia [ready for test]
Posted: Monday 08 May 2017 21:29
by G3rard
Yeah that's possible.
In plugin.py replace the following line
Code: Select all
elif Command == "Channels": _tv.send_req_ircc("AAAAAQAAAAEAAAA6Aw==") # Display
with
Code: Select all
elif Command == "Channels": _tv.send_req_ircc("AAAAAgAAABoAAABXAw==") # Tv_Radio
Then select the TV in the Hardware menu and press Update.
After that pressing the CH button can be used for TV/Radio.
You can of course change any of the other keys you would like to use for this.
Re: Python plugin: Sony Bravia [ready for test]
Posted: Monday 08 May 2017 22:10
by vgr2
Could not find the line
elif Command == "Channels": _tv.send_req_ircc("AAAAAQAAAAEAAAA6Aw==") # Display
in my plugin.py the line Looks like
elif Command == "Channels": _tv.send_req_ircc("AAAAAgAAABoAAABhAw==") # PopUpMenu
Re: Python plugin: Sony Bravia [ready for test]
Posted: Monday 08 May 2017 23:20
by G3rard
You're right, I already have an updated version where the CH button is representing the Info button of the TV remote.
But the line with Channels and ending with #PopUpMenu is the one you can replace.