Home Assistant release with the issue:
channel: stable
hassos: "2.11"
homeassistant: 0.102.1
hostname: hassio
logging: info
machine: raspberrypi3
supervisor: "192"
supported_arch:
Last working Home Assistant release (if known):
homeassistant: 0.102.1
Operating environment (Hass.io/Docker/Windows/etc.):
Hass.io
Integration:
https://www.home-assistant.io/integrations/panasonic_viera/
Description of problem:
Internal server error 500 when press all buttons except the mute button that works.
Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):
Traceback (if applicable):
Additional information:
Looks similar to #21185. I would advise you to create another issue in the panasonic_viera repo so this can be implemented in the python package that is used in this integration.
Looks similar to #21185. I would advise you to create another issue in the panasonic_viera repo so this can be implemented in the python package that is used in this integration.
It has already been implemented in the package.
Thanks for the tip @ramondunker, in which version has this device been implemented?
Oh I'm sorry @springstan, I was looking at the wrong issue.
Issue I'm having is this one:
https://github.com/florianholzapfel/panasonic-viera/issues/9
It has been addressed in the latest __init__.py (https://github.com/florianholzapfel/panasonic-viera/blob/master/panasonic_viera/__init__.py), but hasn't been implemented in Home Assistant.
No worries.
@ramondunker could you test the newest version of panasonic_viera in Home Assistant and report back so that it can be implemented?
I would if you could explain how to implement it in my own Home Assistant setup :-). @springstan
Well you could easily update your version of panasonic_viera by adjusting the following lines
https://github.com/home-assistant/home-assistant/blob/e793ed9ab0b8857ba0aa88a7e7bfb8accd7761b2/requirements_all.txt#L968-L969
https://github.com/home-assistant/home-assistant/blob/e793ed9ab0b8857ba0aa88a7e7bfb8accd7761b2/homeassistant/components/panasonic_viera/manifest.json#L5
to include panasonic_viera==0.3.4. By restarting your Home Assistant setup the mentioned version will be installed automatically and you can test it out ✌
Okay thanks but where can I find those files? Looked at /config/deps but nothing in there. @springstan
Okay thanks but where can I find those files? Looked at /config/deps but nothing in there. @springstan
I'm using a Raspberry Pi Zero W with Hassio.
Oh I am sorry but I believe this does not work under Hassio. However, you could set up a new development environment and test it there.
Okay thankyou. I will look into that after my tests! If it works on my dev environment, can I implement it into Hassio? @springstan
Sorry I am not too familiar with Hassio, therefore I cannot give you a concrete answer to that question. Still thank you very much for testing this out 👍
Okay I've installed a dev environment and installed 0.3.4. I edited configuration.yaml to include the mediaplayer. I'm getting the error: Failed to call service media_player/media_play_pause. Please refer to the docs for using encryption.
Could you help me find out how to get the encryption? @springstan
I think that this error message comes from the used library, therefore it looks like encryption needs to be implemented into the Home Assistant Panasonic viera component. The docs referring to the documentation of the library, which probably includes an example of how to use encryption.
Okay I worked it out! I placed this code inside media_player.py:
import panasonic_viera
rc = panasonic_viera.RemoteControl("192.168.1.52")
Make the TV display a pairing pin code
rc.request_pin_code()
Interactively ask the user for the pin code
pin = raw_input("Enter the displayed pin code: ")
Authorize the pin code with the TV
rc.authorize_pin_code(pincode=pin)
Display credentials (application ID and encryption key)
print rc._app_id
print rc._enc_key
We can now start communicating with our TV
Send EPG key
rc.send_key(panasonic_viera.Keys.epg)
And I changed the volume_up function to:
def volume_up(self):
"""Volume up the media player."""
volume = self.rc.get_volume()
self.rc.set_volume(volume + 1)
And it works. I guess every function has to be changed to use the key to make it all working.
Got it working. Now when I turn the tv off and I want to turn it back on it gives an Error 500: Internal server error. Any ideas? @springstan
Not really sure what is causing this server error, unfortunately I do not own a panasonic viera device myself so I cannot test it myself.
@ramondunker do you think you could put your code changes together in a pull-request? I'd also like to use this integration with my TV but can't because of the missing encryption. Hopefully your code can get merged into the master branch.
I'm not sure if that's going to work because there is no UI for entering the PIN inside Home Assistant. It has to be done with CLI. @SeanHub
Hmm @springstan my hassbian install of home assistant is missing that manifest file in the Panasonic integration folder? Or am I looking at this in the wrong place?
@ramondunker fair point, maybe a one time script could run the pin code functionality and the app_id and encryption_key that is returned could then be placed in the configuration values for the integration, for example:
media_player:
- platform: panasonic_viera
host: 192.168.0.10
app_id: BSkeeKuuwakd9Q==
encryption_key: EarvNQodKYlj5zTEIhZoXQ==
Hmm @springstan my hassbian install of home assistant is missing that manifest file in the Panasonic integration folder? Or am I looking at this in the wrong place?
@Depechie No, you are looking in the right place. Not sure why it is missing but I would recommend to create it (manifest.json) manually just to be safe.
Well you could easily update your version of panasonic_viera by adjusting the following lines
https://github.com/home-assistant/home-assistant/blob/e793ed9ab0b8857ba0aa88a7e7bfb8accd7761b2/requirements_all.txt#L968-L969
https://github.com/home-assistant/home-assistant/blob/e793ed9ab0b8857ba0aa88a7e7bfb8accd7761b2/homeassistant/components/panasonic_viera/manifest.json#L5
to includepanasonic_viera==0.3.4. By restarting your Home Assistant setup the mentioned version will be installed automatically and you can test it out ✌
Does it have to be a development environment? Or would a manual install of Home Assistant suffice?
I made a pull request that updates the component to support encryption (with persistent data and all). I just need to figure out how to make the tests pass (it's the first time I ever contribute to HA).
I made a pull request that updates the component to support encryption (with persistent data and all). I just need to figure out how to make the tests pass (it's the first time I ever contribute to HA).
Wow good job! I noticed my integration with my tv isn’t working anymore. I’m getting CancelledError error.
The panasonic_viera integration still needs a lot of improvements. For example, it fails to generate the media_player entity if a connection can't be established (differently from webostv). But I'll try to work on it! Just need to finish some school stuff...
Woow awesome work @joogps !! Can’t wait to get this up and running.
You’re welcome! Once you update your installation, you will be able to configure the integration either via YAML or the UI 😊
You’re welcome! Once you update your installation, you will be able to configure the integration either via YAML or the UI 😊
It seems that my TV isn't syncing. It shows that it's off in HA, but it is turned on.
Well, it takes some seconds... Did you check if the entity is set as 'unavailable'? Also check the logs to see if there are any connection errors happening!
I noticed that this occurs when I use the TV remote. Home Assistant doesn't sync the changed state when turned on or off with the TV remote. Have you had this issue aswel?
Nope, mine just syncs perfectly. Maybe it's not updating itself, I need to investigate on that.
hey @joogps I have a GZ950 and the new integration asked the pin connect and the new entity does show on / off status fine of the TV.
Turning it off works too, but turning it on will result in Unavailable in Home Assistant and this error log:
Logger: custom_components.panasonic_viera.media_player
Source: custom_components/panasonic_viera/media_player.py:224
First occurred: April 26, 2020, 11:48:46 PM (2 occurrences)
Last logged: April 26, 2020, 11:56:50 PM
Could not establish remote connection:
That's probably because your TV disconnects when it turns off. You could try to define a turn_on_action (which will override the default turn on method) to something that would be able to turn the TV on. In this case, wake-on-lan would be a good option.
wake_on_lan:
panasonic_viera:
host: 192.168.0.1 # This is the IP address of your TV
turn_on_action:
- service: wake_on_lan.send_magic_packet
data:
mac: "AA:BB:CC:DD:99:1A" # This is the MAC address of your TV
However, not all TVs and connection methods support it. Mine doesn't while connected via Wi-Fi, but maybe it would if I had connected it through the Ethernet port. Good luck!
Any idea @joogps why the official Panasonic app ( on my iPhone ) can start the TV than? Is it using another method you think?
( I will try the WOL packet later )
It's probably using wake-on-lan too. :)
Also, @Depechie quick question: are you using Wi-Fi or ethernet? I'm curious because my TV doesn't support wake-on-lan while on Wi-Fi and I can't use Ethernet.
By the way, the documentation page will be updated when Home Assistant gets updated. There you can find more info about customization. :)
Well it is indeed connected through WiFi and the turn action has no effect with WOL. Still weird the Panasonic app has no issues.
For reference it now gives another error:
An unknown error occurred: local variable 'res' referenced before assignment
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/panasonic_viera/media_player.py", line 217, in async_create_remote_control
partial(RemoteControl, self._host, self._port, *params)
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.7/site-packages/panasonic_viera/__init__.py", line 164, in __init__
self._request_session_id()
File "/srv/homeassistant/lib/python3.7/site-packages/panasonic_viera/__init__.py", line 412, in _request_session_id
root = ET.fromstring(res)
UnboundLocalError: local variable 'res' referenced before assignment
For reference it now gives another error:
An unknown error occurred: local variable 'res' referenced before assignment
That's a problem with the panasonic_viera library when the connection is not successful. My latest pull request fixes it.
Well it is indeed connected through WiFi and the turn action has no effect with WOL. Still weird the Panasonic app has no issues.
That's strange... I will download the app and see if I can figure out how it works.
Still, already thx for all the work!! I think with this new version I can already do all the automations I was thinking about. Turning ON the TV is not a high prio for me at the moment ;)
That makes me very happy! :D
If you need to send remote key commands for your automations, I'm working on it too: home-assistant/core#34444