Skip to content
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

[panasonictv] Initial Contribution #11558

Closed
wants to merge 8 commits into from

Conversation

thinkingstone
Copy link

@thinkingstone thinkingstone commented Nov 11, 2021

I would like to contribute/continue the work done for adding the panasonictv binding from oh1 to oh3.
Therefore I used the existing migrations from #3904, #6179 and #9024.
There is also a discussion in https://community.openhab.org/t/panasonictv-oh3/108124

Issue for this PR #11559

DESCRIPTION

scienty and others added 7 commits November 11, 2021 10:30
Signed-off-by: Prakashbabu Sidaraddi <[email protected]> (github:
scienty)

# Conflicts:
#	addons/binding/pom.xml
#	bundles/org.openhab.binding.panasonictv/.classpath
#	bundles/org.openhab.binding.panasonictv/.project
#	bundles/org.openhab.binding.panasonictv/.settings/org.eclipse.core.resources.prefs
#	bundles/org.openhab.binding.panasonictv/.settings/org.eclipse.jdt.core.prefs
#	bundles/org.openhab.binding.panasonictv/.settings/org.eclipse.m2e.core.prefs
#	bundles/org.openhab.binding.panasonictv/ESH-INF/binding/binding.xml
#	bundles/org.openhab.binding.panasonictv/ESH-INF/config/config.xml
#	bundles/org.openhab.binding.panasonictv/ESH-INF/i18n/panasonic_de.properties
#	bundles/org.openhab.binding.panasonictv/ESH-INF/thing/channel-types.xml
#	bundles/org.openhab.binding.panasonictv/ESH-INF/thing/thing-types.xml
#	bundles/org.openhab.binding.panasonictv/META-INF/MANIFEST.MF
#	bundles/org.openhab.binding.panasonictv/OSGI-INF/PanasonicTvDiscovery.xml
#	bundles/org.openhab.binding.panasonictv/OSGI-INF/PanasonicTvHandlerFactory.xml
#	bundles/org.openhab.binding.panasonictv/README.md
#	bundles/org.openhab.binding.panasonictv/about.html
#	bundles/org.openhab.binding.panasonictv/build.properties
#	bundles/org.openhab.binding.panasonictv/pom.xml
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/PanasonicTvBindingConstants.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/handler/PanasonicTvHandler.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/PanasonicTvHandlerFactory.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/config/PanasonicTvConfiguration.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/discovery/PanasonicTvDiscoveryParticipant.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/protocol/RemoteControllerException.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/protocol/UpnpRemoteController.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/service/DataConverters.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/service/MediaRendererService.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/service/PanasonicTvUtils.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/service/RemoteControllerService.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/service/ServiceFactory.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/service/api/EventListener.java
#	bundles/org.openhab.binding.panasonictv/src/main/java/org/openhab/binding/panasonictv/internal/service/api/PanasonicTvService.java
#	features/openhab-addons/src/main/feature/feature.xml
Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: Jan N. Klug <[email protected]>
fix readme and properties to changed thing configuration

Signed-off-by: Michael Binder <[email protected]>
Signed-off-by: Michael Binder <[email protected]>
optimize imports

Signed-off-by: Michael Binder <[email protected]>
@cweitkamp cweitkamp added the enhancement An enhancement or new feature for an existing add-on label Nov 12, 2021
@Flole998
Copy link
Member

As far as I can see you don't have the power state/command in there? Is there a specific reason for that?

@thinkingstone
Copy link
Author

thinkingstone commented Nov 14, 2021

As far as I can see you don't have the power state/command in there? Is there a specific reason for that?

You need to send "Power" (or exactly "NRC_POWER-ONOFF") to the keycode channel.
Or maybe I didn't understand what you mean.

I didn't find a way to identify if the device is powered on. My tv can be in standby or powered on mode. In standby it can also be reachable by network or not, depending on it's network settings. If it is reachable the thing is considered online, but I can not determine if is powered on.

@Hilbrand Hilbrand added the oh1 migration Relates to migrating an openHAB 1 addon to openHAB 2 label Nov 14, 2021
@Flole998
Copy link
Member

I've described how that's done in #4407. Additionally you should only send the power key code then if the command state is != the current state, otherwise sending on would turn the TV off if it's already on.

@wborn wborn added new binding If someone has started to work on a binding. For a new binding PR. and removed enhancement An enhancement or new feature for an existing add-on labels Nov 27, 2021
@fwolter fwolter changed the title [panasonictv] Add / Continue Panasonic Viera TV Binding [panasonictv] Initial Contribution Jan 27, 2022
Copy link
Member

@fwolter fwolter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I reviewed your code and here is my feedback.

There is one checkstyle warning left. You could take a look at target/code-analysis/report.html after building it with mvn clean install.

@@ -228,6 +228,7 @@
/bundles/org.openhab.binding.oppo/ @mlobstein
/bundles/org.openhab.binding.orbitbhyve/ @octa22
/bundles/org.openhab.binding.orvibo/ @tavalin
/bundles/org.openhab.binding.panasonictv/ @J-N-K
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This username shouldn't be the author, but the maintainer of the binding. If you want to maintain this binding in the future, this should be your username.

Comment on lines +8 to +12
Panasonic TVs does not support full UPNP standard functionalities
Volume and Mute status are updated in real time
Most of the control is provided by sending Key Code to RemoteControl API

Source Name (read only) is updated when a Key Code to change the source is sent to tv, otherwise it is Undefined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please finish the sentences with a period (.).

Comment on lines +17 to +20
| Model | State | Notes |
|---------------|---------|--------------------------------------------------------------------------------------|
| Viera E6 | OK | Initial contribution is done by this model |
| TX-40CX680 | OK | Initial contribution is done by this model |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could mention the Thing Type UIDs. These are necessary for textual configuration.

Comment on lines +30 to +32
## Binding Configuration

The binding does not require any special configuration.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed, then.

Comment on lines +36 to +37
The Panasonic TV Thing requires the UPNP UDN of the RemoteController and MediaRenderer as a configuration value in order for the binding to know how to access it. Panasonic TV publish several UPnP devices and the manufacturer and service names are used to recognize those UPnP devices.
Additionally, a refresh interval can be configured in milliseconds to specify how often TV resources are polled.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add a table with the configuration parameters like in other binding readmes. See for example https://www.openhab.org/addons/bindings/telegram/#thing-configuration


updateResourceState(SERVICE_ID, "SetVolume",
Map.of("InstanceID", "0", "Channel", "Master", "DesiredVolume", Integer.toString(newValue)));
// updateResourceState(SERVICE_ID, "GetVolume", Map.of("InstanceID", "0", "Channel", "Master"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed? Same for below.


<name>Panasonic TV Binding</name>
<description>This is the binding for Panasonic TV. Binding should support all Panasonic Viera TV models</description>
<author>Prakashbabu Sidaraddi</author>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The author tag is deprecated and should therefore be removed. See openhab/openhab-core#1844.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be adapted to the new addon.xml, the PR to adapt the developer docs is not merged yet, so if you need more details, the corresponding issue is here: openhab/openhab-core#2058
But you can also update your branch and look at another binding's addon.xml and adapt it to this initial contribution.

Comment on lines +7 to +12
<channel-type id="volume">
<item-type>Dimmer</item-type>
<label>Volume</label>
<description>Volume level of the TV.</description>
<category>SoundVolume</category>
</channel-type>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +14 to +18
<channel-type id="mute">
<item-type>Switch</item-type>
<label>Mute</label>
<description>Mute state of the TV.</description>
</channel-type>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for mute.

@@ -0,0 +1,44 @@
/**
* Copyright (c) 2010-2021 Contributors to the openHAB project
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated to 2022. You can do it automatically by invoking mvn license:format in the root dir of this repo.

@thinkingstone
Copy link
Author

Thanks for your contribution! I reviewed your code and here is my feedback.

Thanks you very much. I will check your feedback. This may take some time.

@lolodomo lolodomo added the stale As soon as a PR is marked stale, it can be removed 6 months later. label Nov 5, 2022
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

See #11833

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>3.2.0-SNAPSHOT</version>
Copy link
Member

@wborn wborn Dec 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<version>3.2.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>

@stale stale bot removed the stale As soon as a PR is marked stale, it can be removed 6 months later. label Jan 16, 2023
@openhab openhab deleted a comment from fwolter Jul 24, 2023
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/comparison-to-home-assistant/151931/57

@lsiepel lsiepel added the stale As soon as a PR is marked stale, it can be removed 6 months later. label Mar 10, 2024
@lsiepel
Copy link
Contributor

lsiepel commented Jun 21, 2024

Unfortunately it looks like we cannot bring this PR to the finish line. After two years of inactivity i close this PR. If there is a need to restart, feel free to re-open or start a new PR.

@lsiepel lsiepel closed this Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback new binding If someone has started to work on a binding. For a new binding PR. oh1 migration Relates to migrating an openHAB 1 addon to openHAB 2 stale As soon as a PR is marked stale, it can be removed 6 months later.
Projects
None yet
Development

Successfully merging this pull request may close these issues.