TurnON Panasonic Viera from HASS

Hello,
HASS world is new for me but for last 3 days I was abble to add around 20 devices to my installation without any issues at all! This is great and I want to thank you to everyone who helped to make it so easy.

From what I’ve read there is no way how to turn on Viera TV from HASS, but if you check following video (sorry for the quality) https://drive.google.com/file/d/0B_vRvdQVNYI4THpXbmF3R2I2QUE/view?usp=drivesdk
you can see that I can turn ON my Viera TX-47AS750E if I manage to click 2nd time on the on/off symbol before it disappeare.

Is there any way how to keep the on/off button visible all the time?

EDIT: Please check my last comment for more information

More than likely you got it before it fully disconnected from the network which meant it would still receive key presses.

Are you on WiFi or ethernet?

@kylerw I’ve manage to do it on WIFI and Ethernet. Also there is official app from Panasonic and it can turn the tv on without any problems even if the tv is turned off hours ago, so there should be a way how to do it from HASS also. The official app only needs to be at the same network like the TV and this makes me think that TV is connected to the network even it is off. Correct me if I’m wrong.

Some Panasonic VIERA models have wake on lan functionality as far as I know. I have two VIERA Panasonic Plasma TVs and unfortunately none of them has it, so I cannot try this, but for your model I can see in the user manual that it should have it, so maybe there is a way for developers of this component to find out if model has “Network standby” function and enable power on button for such models.

1 Like

@sustah you are so right!!! I’ve just was able to use WOL to turn the TV on!!! I’ve change one configuration ot the TV:
Menu -> Network -> TV Remote APP Settings -> Networked Standby -> On

@sustah, @kylerw, @balloob could you please add support for WOL turning on?

From what I’ve got as information from my local Panasonic support office many of AS740/750 (and maybe more other models from 2014/2015) should support this functionality, also almost all 2016 models are supporting it.

I think that this will be very handy. Basically my idea was to add 2 more optional configuration parameters to the yaml section: “use_wol” -> true/false and “mac_address”. After that based on the value of the “use_wol” SUPPORT_TURN_ON can be added to SUPPORT_VIERATV at homeassistant/components/media_player/panasonic_viera.py

From what I’ve saw at the repo there is custom function which is implementing actual key presses so I think that there won’t be a problem to add new one for the WOL. Also I’ve noticed that there is already implemented wol_switch.py but I’m not sure can it be reused.

Sorry if it looks like I’m telling you how to write your code but the php dev inside me is speaking :smiley: currently I’m without a PC at home and I’m relaying only on my phone and my Rpi that is the reason why I cant make the modifications by myself.

Thanks in advance!

New PR with all changes is made.

https://github.com/home-assistant/home-assistant/pull/4371

I have a Viera 40CS650 and it does some wierd things.

I add it as a Panasonic Viera TV with the IP and MAC address but it also discovers it as an unnamed media player and either can be used to control it. 1469 supported commands as the Viera and 1341 as an unnamed media player.

Not really an issue but on/off is. Off is fine but turn_on doesn’t work however sending it turn_off while it’s off does turn it on (using either instance).

Any suggestions?

Was this included in 0.49.0? I’ve just tried testing this and made sure the correct settings were setup on my TV but I can’t seem to turn it on from HASS still. I’m using the media_player.panasonic… component.

Does it turn off?

If so the problem is probably the same as mind. Some Viera TV’s use WOL (Wake on Lan) to turn on as they don’t have the processor active while the screen is off whereas newer ones like mine keep it and ethernet on so it only needs the turn on command sent. (Haven’t tried it over wireless).

A fix is to edit /components/media_player/panasonic.viera.py to send NRC_POWER-ONOFF instead of a magic packet (WOL). Open the file and scroll down to the turn_off and turn_on functions and simply copy and paste the turn_off over turn_on and change the state check and setting to on. Save, reload and it’ll work.

If you need help to edit it just ask and I’ll try to assist.

mine is of 2013: is old or new enough?

Can yiou copy paste your code, I did not get it

It will depend on the method it uses. If it won’t turn on with the current method, using WOL, then you can try this edit.

This is the changed code from /components/media_player/panasonic.viera.py

Prior to the edit it the turn_on function sent a WOL packet.

        """Turn on the media player."""
        if self._state != STATE_ON:
            self.send_key('NRC_POWER-ONOFF')
            self._state = STATE_ON

    def turn_off(self):
        """Turn off media player."""
        if self._state != STATE_OFF:
            self.send_key('NRC_POWER-ONOFF')
            self._state = STATE_OFF

This is aweseome to find. I can turn on my VIera from other platforms with similar soap commands, but not with the default code in Home Assistant.

Where do we edit this though? I can’t find the Components folder under /usr/lib/Python*, and others who ask get told to use the custom components area within the config directory ( I am using docker).

So to override the old panasonic.viera.py, should we establish a new file under config/custom_components/media_player/panasonic.viera.py? In which case we would need the full code…?

Grateful, but a bit lost :slight_smile:

Edit - I did the above (added config/custom_components/media_player/panasonic.viera.py after finding the git repo) and one of my TVs now turns on. Great!

But - my older Panasonic doesn’t have network standby, which of course kills all possible angles :slight_smile:

In other words, when I turn the TV off, it neither pings, nor can be reached on port 55000

@MattP i use hass.io and i have Panasonic too. how i can edit that .py?
where i can find that file?

The file is listed from the main viera Home Assistant page - listed as “source”.

https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/media_player/panasonic_viera.py

Copy then create that file in the path I wrote above, and it will take over the definition/controls. Then you can edit it to your needs.

@MattP thank you .
i edit that file and modify
“”“Turn on the media player.”“”
if self._state != STATE_ON:
self.send_key(‘NRC_POWER-ONOFF’)
self._state = STATE_ON

def turn_off(self):
    """Turn off media player."""
    if self._state != STATE_OFF:
        self.send_key('NRC_POWER-ONOFF')
        self._state = STATE_OFF

but, i can only turn off my Panasonic, not turn on :frowning:

I would suggest that you manually telnet to the TV when it is turned on, confirm that you get a connection.

Then turn your TV off, and try again.

If you cannot get the telnet connection with your TV off, then your TV either: doesn’t support the API on standby, or: you need to enable the advanced standby settings in your TV.

can you tell , how i can acess to Tv via telnet?

which model works, which not?