-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the Panasonic Viera component #33433
Conversation
For some reason, the update of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format your code with black and take a look at the flake8
errors on Azure DevOps.
@@ -2,7 +2,7 @@ | |||
"domain": "panasonic_viera", | |||
"name": "Panasonic Viera TV", | |||
"documentation": "https://www.home-assistant.io/integrations/panasonic_viera", | |||
"requirements": ["panasonic_viera==0.3.2", "wakeonlan==1.1.6"], | |||
"requirements": ["panasonic_viera==0.3.4", "wakeonlan==1.1.6", "configurator"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"configurator"
is rather a dependency than a requirement since it is HA internal, therefore please move it to the dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The access mode has changed for some of the files. Eg:
homeassistant/components/panasonic_viera/init.py 100644 → 100755
Please revert those changes.
@@ -1,7 +1,7 @@ | |||
"""Support for interface with a Panasonic Viera TV.""" | |||
import logging | |||
|
|||
from panasonic_viera import RemoteControl | |||
from panasonic_viera import * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please import names explicitly. Don't use a star.
needs_pairing = False | ||
|
||
if needs_pairing: | ||
configurator = hass.components.configurator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configurator is legacy and should not be used for new code. Please create a config flow instead.
We have a scaffolding script to help you get started with that.
https://developers.home-assistant.io/docs/creating_component_index
@@ -117,6 +177,14 @@ def __init__(self, mac, name, remote, host, broadcast, app_power, uuid=None): | |||
self._volume = 0 | |||
self._app_power = app_power | |||
|
|||
hass.services.async_register( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want side effects in init method. Please move the service registration out of init.
Also, we should limit this pull request to one thing. A new service can be added in a different PR.
If all tests pass, will it automatically be included in the Home Assistant Core? |
Hi! (Also, I'm sorry for doing so many things wrong, it's the first time I contribute to Home Assistant and I probably didn't read the guidelines right.) |
Working on it! |
Not sure if this is helpful, but there appears to be an issue with the Panasonic_viera 0.3.4 library that needs to be taken into account with this integration. If a command is sent to a tv when it is off, an HTTPError exception is thrown. Once this happens, the remote will not work any more. This is because the library code decrements _session_seq_num when an exception is thrown, but does not take into account the possibility that the exception occurs before _session_seq_num is incremented. |
Thanks, @sgthree, I will investigate that! I'll be creating a new pull request soon. |
Breaking change
If your TV needs encryption, just remove the entity and restart Home Assistant. The configurator will them show up in notifications asking you to start the pairing process (very much like the
webostv
integration).Proposed change
Add encryption support for the Panasonic Viera integration (through configurator) with persistent data and a
send_key
service to easily send key presses to the TV. It also prevents HTTP errors by renewing the connection at every update and updatesmanifest.json
andrequirements_all.txt
to require the latest panasonic-viera library version (0.3.4).Type of change
Example entry for
configuration.yaml
:Additional information
There are still some changes that need to be made, such as preventing the entity from not being created and adding sources support.
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale: