Python plugin: Sony Bravia TV

Python and python framework

Moderator: leecollings

schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Python plugin: Sony Bravia TV

Post by schulpr »

I have the same issue. A restart kills the buienradar plugin.


Verzonden vanaf mijn iPad met Tapatalk
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard »

markcame wrote: Friday 11 August 2017 15:18 Finally i find the root cause because also the buienradar plugin does not survive @ domoticz restart.

I have disabled dzVents from domoticz setting and now all is up running and survive to reboot/restart, i don't know why it happens.
Good you have found this. But where you using dzVents with some active scripts? Because on my Pi3 dzVents is not disabled, but also not in use and I don't have errors when restarting Domoticz.
Not using Domoticz anymore
schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Python plugin: Sony Bravia TV

Post by schulpr »

I use dzVents scripts and the domoticz-buienradar plugin.


Verzonden vanaf mijn iPad met Tapatalk
markcame
Posts: 36
Joined: Wednesday 07 December 2016 19:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sony Bravia TV

Post by markcame »

I use dzVents 1.1.2 with some scripts but on the embedded version in domoticz 2.2.0 i have no scripts running but if enable it and you use also plugins on restart crash for segmentation fault.
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb »

G3rard,

Great plugin and been working great when watching normal TV. I export the volume switch to Homebridge so I can say "Hey Siri, set the Living Room TV to 30% and it does it. Then I'd like to turn the tv on and off using the same switch rather than mute. Don't mind changing the code within the plugin.py as I am probably then only one who would want to do this.

I have changed the code to turn the tv off however the on won't work as it never sends the On command as the TV is off. How do I go about changing that.. So far this is what I have done (Android TV)

Code: Select all

if Unit == 2:     # TV volume
                if action == 'Set':
                    self.tvVolume = str(Level)
                    _tv.set_volume_level(self.tvVolume)
                elif action == "Off":
                    _tv.turn_off()
                    UpdateDevice(2, 0, str(self.tvVolume))
                elif action == "On":
                    _tv.turn_on_command()
                    UpdateDevice(2, 1, str(self.tvVolume))
Thanks in advance
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard »

@simon_rb, the code checks if the TV is off and in that case only respons to unit 1 which is the TV power switch.
So your on command for unit 2 is never found.

If you add the following code after 'if self.powerOn == False:' and before 'else:' in the onCommand function then it should work.

Code: Select all

if Unit == 2:     # Use TV volume for switching on
    if action == "On":
        _tv.turn_on_command()
        self.tvPlaying = "TV starting" # Show that the TV is starting, as booting the TV takes some time
        self.SyncDevices()
And I would change the code from your post to:

Code: Select all

if Unit == 2:     # TV volume and switching off
    if action == 'Set':
        self.tvVolume = str(Level)
        _tv.set_volume_level(self.tvVolume)
    elif action == "Off":
        _tv.turn_off()
        self.tvPlaying = "Off"
        self.SyncDevices()
Not using Domoticz anymore
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb »

G3rard wrote: Tuesday 15 August 2017 23:57 @simon_rb, the code checks if the TV is off and in that case only respons to unit 1 which is the TV power switch.
So your on command for unit 2 is never found.

If you add the following code after 'if self.powerOn == False:' and before 'else:' in the onCommand function then it should work.

Code: Select all

if Unit == 2:     # Use TV volume for switching on
    if action == "On":
        _tv.turn_on_command()
        self.tvPlaying = "TV starting" # Show that the TV is starting, as booting the TV takes some time
        self.SyncDevices()
And I would change the code from your post to:

Code: Select all

if Unit == 2:     # TV volume and switching off
    if action == 'Set':
        self.tvVolume = str(Level)
        _tv.set_volume_level(self.tvVolume)
    elif action == "Off":
        _tv.turn_off()
        self.tvPlaying = "Off"
        self.SyncDevices()
Thats amazing, thanks!

I added the code above and I am getting various different errors and plugin won't load. It is 99.9% I am putting them in wrong. Being cheeky could I ask for a plugin.py file with the changes in? If not I shall continue to try and figure out where I have gone wrong! :lol:
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard »

No problem, will have a look at it.
Your errors are probably caused by using tabs as indents? Or were there other errors in the log?
Not using Domoticz anymore
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb »

G3rard wrote: Wednesday 16 August 2017 19:49 No problem, will have a look at it.
Your errors are probably caused by using tabs as indents? Or were there other errors in the log?
I pasted the above in. Most probably the indents. It was error on line errors.
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb »

I have this working now, if anyone wants the amended .py file I'll post it here

Thanks for your help G3rard
farhanito
Posts: 34
Joined: Friday 19 August 2016 5:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Python plugin: Sony Bravia TV

Post by farhanito »

hi,
has crashing issues on RPi resolved yet?
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb »

farhanito wrote: Saturday 19 August 2017 16:17 hi,
has crashing issues on RPi resolved yet?
Mine hasn't crashed at all since using it. There was an issue with one of the example .py's in the example folder under plugins (think it's the PIR one). I deleted that anyways and it's been fine and not experienced a single crash. I'm on a raspberry pi 3 which is running Domoticz, an Open VPN, Logitech Media Server, SQL library for all the kodi's around the house, FTP server for IP Camera motion detection in domoticz, homebridge including nest for the thermostat. There are loads more I have the Rapsberry pi doing and not a single crash 👍
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard »

simon_rb wrote: Saturday 19 August 2017 21:20
farhanito wrote: Saturday 19 August 2017 16:17 hi,
has crashing issues on RPi resolved yet?
Mine hasn't crashed at all since using it. There was an issue with one of the example .py's in the example folder under plugins (think it's the PIR one). I deleted that anyways and it's been fine and not experienced a single crash. I'm on a raspberry pi 3 which is running Domoticz, an Open VPN, Logitech Media Server, SQL library for all the kodi's around the house, FTP server for IP Camera motion detection in domoticz, homebridge including nest for the thermostat. There are loads more I have the Rapsberry pi doing and not a single crash 👍
It's the file script_device_PIRsmarter.py in the scripts/python folder. That file is causing crashes. So if't is in your folder you can delete it.
In the latest beta version this file is removed by the system, check this https://github.com/domoticz/domoticz/co ... 3681f73ab3 for more information.

For me also no crashed on my Pi3 after I have removed that file.
Not using Domoticz anymore
User avatar
lmet
Posts: 23
Joined: Wednesday 19 July 2017 22:35
Target OS: Raspberry Pi / ODroid
Domoticz version: v4.9700
Location: France
Contact:

Re: Python plugin: Sony Bravia TV

Post by lmet »

Hi,
For me no crash since removing "script_device_PIRsmarter.py" but many many errors in log :

Code: Select all

2017-08-20 19:02:17.231 Error: (Bravia) No data received from TV, probably it has just been turned off (time data '' does not match format '%Y-Success-0T%H:%M:
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard »

lmet wrote: Monday 21 August 2017 1:54 Hi,
For me no crash since removing "script_device_PIRsmarter.py" but many many errors in log :

Code: Select all

2017-08-20 19:02:17.231 Error: (Bravia) No data received from TV, probably it has just been turned off (time data '' does not match format '%Y-Success-0T%H:%M:
Can you install the latest version from Github and try that?
If it still gives errors please set Debug to True and send me the log output so I can have a look.
Not using Domoticz anymore
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb »

G3rard, buy yourself a new Sony TV (Android one).You deserve it 😂👍
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard »

@simon_rb, will tell it to the wife 8-)

But I am quite happy with my non-Android TV combined with a nVidia Shield :D
Not using Domoticz anymore
hekm77
Posts: 45
Joined: Thursday 09 February 2017 18:31
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Python plugin: Sony Bravia TV

Post by hekm77 »

v1.2 works fine with KDL-60W605B
Thanks.
vgr2
Posts: 71
Joined: Monday 29 August 2016 12:02
Target OS: -
Domoticz version:
Contact:

Re: Python plugin: Sony Bravia TV

Post by vgr2 »

Could not find Hardware Type "Sony Bravia TV" on last beta V3.8367
User avatar
G3rard
Posts: 669
Joined: Wednesday 04 March 2015 22:15
Target OS: -
Domoticz version: No
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard »

The Python plugins are disabled in the latest Domoticz beta versions.
Use the stable version if you want to have Python plugins working.
Not using Domoticz anymore
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest