Unable to power on Bravia TV

Hi All,

I’ve been recently trying to control my Bravia TV with Home Assistant and while I’ve been able to pair it with HASS (and control inputs and other functions) I am unable to power on the TV if it is in standby. I have tried using both wired Ethernet and Wireless. When I tail my log files while sending the power on command I see the following:

Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: ERROR:homeassistant.core:Error doing job: Task exception was never retrieved
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: Traceback (most recent call last):
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/usr/lib/python3.5/asyncio/tasks.py”, line 241, in _step
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: result = coro.throw(exc)
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/etc/hass/lib/python3.5/site-packages/homeassistant/core.py”, line 1025, in _event_to_service_call
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: yield from service_handler.func(service_call)
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/etc/hass/lib/python3.5/site-packages/homeassistant/components/media_player/init.py”, line 408, in async_service_handler
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: yield from getattr(player, method[‘method’])(**params)
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: yield self # This tells Task to wait for completion.
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: future.result()
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: raise self._exception
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: result = self.fn(*self.args, **self.kwargs)
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/etc/hass/lib/python3.5/site-packages/homeassistant/components/media_player/braviatv.py”, line 346, in turn_on
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: self._braviarc.turn_on()
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/etc/hass/lib/python3.5/site-packages/braviarc/braviarc.py”, line 257, in turn_on
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: self.send_req_ircc(self.get_command_code(‘TvPower’))
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: File “/etc/hass/lib/python3.5/site-packages/braviarc/braviarc.py”, line 108, in send_req_ircc
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: params+"</u:X_SendIRCC></s:Body></s:Envelope>").encode(“UTF-8”)
Sep 21 08:42:53 ca-vic-cm-hass02 hass-load[23040]: TypeError: Can’t convert ‘NoneType’ object to str implicitly

Of note, I can manually turn the TV on by sending a WOL packet from my HASS server. Any ideas?

OK, did some packet sniffing on my network, looks like HASS is sending the WOL packet out the wrong interface (I have 2 networks, one for IOT devices and one for regular devices). Is there any way to force HASS to send WOL packets out a specific interface?

Use script component for the one command. You may then specify eth0 or wlan0,etc.

These are separate physical network? (Not vlan?)

Thanks for the suggestion, how would I go about binding the Bravia power-on command to a custom script?

The two networks are on separate VLANs (Same physical infrastructure for the most part) but I have HASS running in a VM and the VLAN trunk terminates on the hypervisor which splits each VLAN out to a separate virtual NIC on the VM, so from HomeAssistant’s perspective they are separate physical networks.