Python plugin: Sony Bravia TV

Python and python framework
schulpr
Posts: 119
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

Re: Python plugin: Sony Bravia TV

Post by schulpr » Friday 11 August 2017 15:27

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


Verzonden vanaf mijn iPad met Tapatalk

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard » Friday 11 August 2017 19:59

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.
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

schulpr
Posts: 119
Joined: Thursday 01 January 2015 10:10
Target OS: NAS (Synology & others)
Domoticz version: Beta
Contact:

Re: Python plugin: Sony Bravia TV

Post by schulpr » Friday 11 August 2017 20:38

I use dzVents scripts and the domoticz-buienradar plugin.


Verzonden vanaf mijn iPad met Tapatalk

markcame
Posts: 34
Joined: Wednesday 07 December 2016 20:13
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Sony Bravia TV

Post by markcame » Friday 11 August 2017 23:53

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: 699
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb » Sunday 13 August 2017 18:11

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: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard » 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()
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

simon_rb
Posts: 699
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb » Wednesday 16 August 2017 13:15

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: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard » 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?
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

simon_rb
Posts: 699
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb » Wednesday 16 August 2017 22:08

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: 699
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb » Friday 18 August 2017 20:01

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

Thanks for your help G3rard

farhanito
Posts: 37
Joined: Friday 19 August 2016 5:39
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Python plugin: Sony Bravia TV

Post by farhanito » Saturday 19 August 2017 16:17

hi,
has crashing issues on RPi resolved yet?

simon_rb
Posts: 699
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb » 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 👍

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard » Saturday 19 August 2017 23:27

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.
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

User avatar
lmet
Posts: 24
Joined: Wednesday 19 July 2017 22:35
Target OS: Raspberry Pi
Domoticz version: v3.8153
Location: France
Contact:

Re: Python plugin: Sony Bravia TV

Post by lmet » 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:

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard » Monday 21 August 2017 23:07

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.
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

simon_rb
Posts: 699
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Python plugin: Sony Bravia TV

Post by simon_rb » Wednesday 23 August 2017 21:34

G3rard, buy yourself a new Sony TV (Android one).You deserve it 😂👍

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard » Monday 28 August 2017 22:49

@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
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

hekm77
Posts: 46
Joined: Thursday 09 February 2017 19:31
Target OS: Raspberry Pi
Domoticz version: beta
Contact:

Re: Python plugin: Sony Bravia TV

Post by hekm77 » Tuesday 29 August 2017 8:10

v1.2 works fine with KDL-60W605B
Thanks.

vgr2
Posts: 91
Joined: Monday 29 August 2016 12:02
Target OS: -
Domoticz version:
Contact:

Re: Python plugin: Sony Bravia TV

Post by vgr2 » Tuesday 29 August 2017 19:49

Could not find Hardware Type "Sony Bravia TV" on last beta V3.8367

User avatar
G3rard
Posts: 827
Joined: Wednesday 04 March 2015 23:15
Target OS: Linux
Domoticz version: V3.8153
Location: The Netherlands
Contact:

Re: Python plugin: Sony Bravia TV

Post by G3rard » Tuesday 29 August 2017 20:27

The Python plugins are disabled in the latest Domoticz beta versions.
Use the stable version if you want to have Python plugins working.
Ubuntu Server 14.04 | Domoticz v3.8153 | RFXtrx433E | Z-Wave Aeotec Z-Stick S2
Frontpage | Sonos PHP | Dark th3me | Sony Bravia Python plugin | Sonos Python plugin

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest