Page 8 of 11

Re: Python plugin: Sony Bravia TV

Posted: Friday 11 August 2017 15:27
by schulpr
I have the same issue. A restart kills the buienradar plugin.


Verzonden vanaf mijn iPad met Tapatalk

Re: Python plugin: Sony Bravia TV

Posted: Friday 11 August 2017 19:59
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.

Re: Python plugin: Sony Bravia TV

Posted: Friday 11 August 2017 20:38
by schulpr
I use dzVents scripts and the domoticz-buienradar plugin.


Verzonden vanaf mijn iPad met Tapatalk

Re: Python plugin: Sony Bravia TV

Posted: Friday 11 August 2017 23:53
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.

Re: Python plugin: Sony Bravia TV

Posted: Sunday 13 August 2017 18:11
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

Re: Python plugin: Sony Bravia TV

Posted: Tuesday 15 August 2017 23:57
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()

Re: Python plugin: Sony Bravia TV

Posted: Wednesday 16 August 2017 13:15
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:

Re: Python plugin: Sony Bravia TV

Posted: Wednesday 16 August 2017 19:49
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?

Re: Python plugin: Sony Bravia TV

Posted: Wednesday 16 August 2017 22:08
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.

Re: Python plugin: Sony Bravia TV

Posted: Friday 18 August 2017 20:01
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

Re: Python plugin: Sony Bravia TV

Posted: Saturday 19 August 2017 16:17
by farhanito
hi,
has crashing issues on RPi resolved yet?

Re: Python plugin: Sony Bravia TV

Posted: Saturday 19 August 2017 21:20
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 👍

Re: Python plugin: Sony Bravia TV

Posted: Saturday 19 August 2017 23:27
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.

Re: Python plugin: Sony Bravia TV

Posted: Monday 21 August 2017 1:54
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:

Re: Python plugin: Sony Bravia TV

Posted: Monday 21 August 2017 23:07
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.

Re: Python plugin: Sony Bravia TV

Posted: Wednesday 23 August 2017 21:34
by simon_rb
G3rard, buy yourself a new Sony TV (Android one).You deserve it 😂👍

Re: Python plugin: Sony Bravia TV

Posted: Monday 28 August 2017 22:49
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

Re: Python plugin: Sony Bravia TV

Posted: Tuesday 29 August 2017 8:10
by hekm77
v1.2 works fine with KDL-60W605B
Thanks.

Re: Python plugin: Sony Bravia TV

Posted: Tuesday 29 August 2017 19:49
by vgr2
Could not find Hardware Type "Sony Bravia TV" on last beta V3.8367

Re: Python plugin: Sony Bravia TV

Posted: Tuesday 29 August 2017 20:27
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.