-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[denonmarantz] new Denon / Marantz 2.0 binding #2859
Conversation
Not sure why Jenkins / Travis builds failed? Something I can do about that? Update nevermind, saw that the line in Travis tailing the stderr log is expandable ;)
Will check what I can do about this, any suggestions are welcomed ;) |
Build issues fixed, found the jar file of the binding so other can test now. |
Testing by several users has been done over the past weeks. |
@martinvw ready for review! |
Binding is made available at the Eclipse Marketplace: https://marketplace.eclipse.org/content/denonmarantz-binding |
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.
Thank you for porting this binding to openHAB2!
I did a first review and left some comments inside the code.
One major thing I would propose is that you should think about splitting your connector into one that is responsible for telnet and one that is responsible for http.
<advanced>true</advanced> | ||
</parameter-group> | ||
|
||
<parameter name="zoneCount" type="integer" required="true" groupName="receiverProperties"> |
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.
If you provide a default value you can omit the required=true
<description>Hostname or IP address of the AVR to control.</description> | ||
</parameter> | ||
|
||
<parameter name="telnetEnabled" type="boolean" required="true" groupName="connectionSettings"> |
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.
If you provide a default value you can omit the required=true
<default>false</default> | ||
</parameter> | ||
|
||
<parameter name="telnetPort" type="integer" required="false" groupName="telnetSettings"> |
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.
required=false
is the default so you can remove it.
<advanced>true</advanced> | ||
</parameter> | ||
|
||
<parameter name="httpPort" type="integer" required="true" groupName="httpSettings"> |
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.
If you provide a default value you can omit the required=true
<advanced>true</advanced> | ||
</parameter> | ||
|
||
<parameter name="httpPollingInterval" type="integer" required="true" groupName="httpSettings"> |
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.
If you provide a default value you can omit the required=true
@@ -0,0 +1,86 @@ | |||
/** | |||
* Copyright (c) 2010-2017 by the respective copyright holders. |
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 run mvn license:format
to update it to 2018 for all files (some of yours even have 2015 :))
@Override | ||
public Boolean unmarshal(String v) throws Exception { | ||
if (v != null) { | ||
return v.toLowerCase().equals("on"); |
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.
Doesn't this return a "primitive" boolean
instead of the Boolean
object?
telnetEnable = false; | ||
logger.debug("We can access the HTTP API, disabling the Telnet mode by default"); | ||
} | ||
} catch (Exception e) { |
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.
See above: Please do not catch Exception
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.
See above, please suggest a solution for this.
Matcher matcher = DENON_MARANTZ_PATTERN.matcher(service.getQualifiedName()); | ||
if (matcher.matches()) { | ||
logger.debug("This seems like a supported Denon/Marantz AVR!"); | ||
this.serial = matcher.group(1).toLowerCase(); |
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.
What if you detect more than one? By storing the serial inside a class variable you will overwrite it in case there are 2 or more results.
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.
Ahh, didn't realize that! Thought the Participant would get instantiated for reach result, which obviously isn't the case. Good catch, this could have resulted in a hard to debug issue.
* @author Jeroen Idserda | ||
* @author Jan-Willem Veldhuis | ||
*/ | ||
public class DenonMarantzTelnetClient extends Thread { |
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 make it a Runnable
and schedule it with the scheduler (scheduler.submit
..)
@triller-telekom thank you for reviewing! I need to find time to work on your feedback. |
Note to self: need to fix issue in 2.3.0 caused by this Smarthome PR: #4787 and fixed here: #2997 Edit: took care of this.. Added static mapping from ChannelType to ItemType to avoid a lot of complex code to fetch those from the thing-types.xml file. Can be refactored later on when smarthome is enhanced with eclipse-archived/smarthome#4950 |
@jwveldhuis Thank you for your comments. If you have any updates on the code side please create a NEW commit on your branch and push it. Please do NOT amend your previous commit and do a force push. Reviewing the code is a lot easier if we only see the diff to the previous reviews. Thanks. |
@triller-telekom how do I handle the merge with upstream/master in between, should that be 'signed-off' as well? Update: Nevermind, I've reverted the branch back to previous commit and forced push a new commit. Looks like you don't need to sync the fork with master. Looks like this could work: # merge the current master in local checkout of fork, don't commit
git merge upstream/master --no-commit
# do dev work / testing
# abort the merge
git merge --abort
# now commit and push to fork.. |
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.
Thank you for your changes. the code looks much cleaner now with the separation of the http and telnet clients.
If you want to include the current status of the master branch in your feature branch, please rebase your branch onto the current master, never to a merge. Easiest thing to do that is to change tot he master branch and pull it: git checkout master; git pull
and afterwards go into your branch git checkout YOUR_BRANCH; git rebase master
.
This will replay all your changes on top of the current master to keep a clean and straight version history without any merge commits.
I have left some minor comments in the code.
org.openhab.binding.denonmarantz, | ||
org.openhab.binding.denonmarantz.handler, | ||
org.osgi.service.component.annotations;resolution:=optional, |
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.
You can remove this optional 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.
When I removed it I get this error for the Handler:
The type org.eclipse.jdt.annotation.NonNullByDefault cannot be resolved. It is indirectly referenced from required .class files
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.
Are you sure that you removed org.osgi.service.component.annotations;resolution:=optional,
and NOT accidentally org.eclipse.jdt.annotation;resolution:=optional,
? Because the later one would explain your error message...
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.
Mea culpa, yes I did.
However, when I remove the org.osgi.service.component.annotations;resolution:=optional,
I see the following warning in Eclipse:
DS Annotations missing from permanent build path
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.
This is because your branch is too old. I have just tested a plain checkout with the current master and everything is fine in the IDE. if I rebase your branch onto the current master and remove org.osgi.service.component.annotations;resolution:=optional,
from the MANIFEST.MF
, everything is alright.
So please rebase your branch onto the current master and do a push with --force. Careful though, because this will overwrite the branch on github. So you might want to do a backup of your current local repository before doing so since you said you had problems with git before.
However, I just did a git rebase master
in your branch locally (after pulling the latest master branch of course) on my machine and everything went smooth.
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.
I am on the latest commit (commit dc204c6) of openhab2-addons, still see the warning.
Is it perhaps a setting outside of this repo? What was changed to resolve this warning?
I am using openhab2-addons
and openhab-distro
in my IDE, I don't use the other internal repo's.
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.
Nevertheless, I will apply the change and ignore the local warning (I see them for other bindings as well), perhaps related to my IDE setup.
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.
All of you checked out repos have to be on the newest version, i.e. "openhab1-addons openhab2-addons openhab-core openhab-distro smarthome"
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.
I only have openhab2-addons
and openhab-distro
and both are up to date (while setting up the IDE I only picked "openHAB Development" (required) and "openHAB2 Add-ons" from the optional set of repos).
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.
Confirmed warning is gone when all git repos are included in the IDE.
@@ -57,26 +62,30 @@ The DenonMarantz AVR supports the following channels (some channels are model sp | |||
| mainVolume | Dimmer | Main zone volume |
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 add (R) or (RW) on all channels to make it consistent
@Override | ||
public void initialize() { | ||
// create connection (either Telnet & HTTP or HTTP only) | ||
config = getConfigAs(DenonMarantzConfiguration.class); | ||
denonMarantzState = new DenonMarantzState(this); |
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.
Maybe you want to check the configuration before doing anything?
@@ -58,6 +58,10 @@ public DenonMarantzState(DenonMarantzStateChangedListener listener) { | |||
this.listener = listener; | |||
} | |||
|
|||
public void connectionError(String errorMessage) { | |||
listener.connectionError(errorMessage); |
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.
What if the listener
is null
?
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.
It can't be. State is instantiated from the DenonMarantzHandler
like this, the handler is the (only) listener.
denonMarantzState = new DenonMarantzState(this);
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.
Yes I saw that is is initialized with the handler, but code gets changed over time and who knows if there won't be another instance created somewhere in the future? Just saying this because with the term listener
I usually connect that it is a 0-n relationship, i.e. it is optional or there may be many.
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.
I agree, will rename the variable to handler
to avoid future confusion.
|
||
private void startPolling() { | ||
if (!isPolling()) { | ||
logger.info("HTTP polling started."); |
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 decrease to debug level.
} | ||
|
||
private void updateSecondaryZones() { | ||
for (int i = 2; i <= config.getZoneCount(); i++) { |
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.
Why are you using a loop at all if you have a switch-case later on anyway?
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.
To reuse the code to construct the url, to get the document and to log about that.
String ret = IOUtils.toString(is); | ||
|
||
connection.disconnect(); | ||
|
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.
empty line
try { | ||
httpClient.start(); | ||
response = httpClient.newRequest("http://" + host + "/goform/Deviceinfo.xml") | ||
.timeout(3, TimeUnit.SECONDS).send(); | ||
int status = response.getStatus(); | ||
if (status == 200) { | ||
if (response.getStatus() == 200) { |
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.
Isn't there a constant like HTTP_STATUS.OK
or something instead of the 200?
try { | ||
response = httpClient.newRequest("http://" + host + ":8080/goform/Deviceinfo.xml") | ||
.timeout(3, TimeUnit.SECONDS).send(); | ||
if (response.getStatus() == 200) { |
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.
See above
logger.debug("Failed in fetching the Deviceinfo.xml to determine zone count: {}", e.getMessage()); | ||
} | ||
|
||
if (status == 200 && response != null) { |
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.
See above
@triller-telekom ahh, thanks for this basic git-HOWTO :) Searched and tried a lot, couldn't find this. |
@triller-telekom what is the recommended pattern to handle I am planning to handle it like this: pollingJob = scheduler.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
try {
refreshHttpProperties();
} catch (Throwable t) {
StringBuilder sb = new StringBuilder();
for (StackTraceElement s : t.getStackTrace()) {
sb.append(s.toString()).append("\n");
}
logger.error("Error while polling Http: \"{}\". Stacktrace: \n{}", t.getMessage(),
sb.toString());
}
}
}, config.httpPollingInterval, config.httpPollingInterval, TimeUnit.SECONDS); In this case (see trail of comments in #2204) the following happened: Took me 4 hours to diagnose this 😕 😦 |
Regarding your But it turned out that some jobs were not executed and thus we had to revert it via eclipse-archived/smarthome#4932 I just tried to play around with it but unfortunately I could not really reproduce it :( Neither in my IDE pure ESH setup nor in a basic installation of OH 2.2 with a patched smarthome.core bundle (one that contained the wrappedscheduler). So for now I guess you have to stick to catching the |
@jwveldhuis FYI: With eclipse-archived/smarthome#5045 I have fixed the logging of If you address the few minor issues from above we can handover your PR to the committers for a final review and merge. |
@triller-telekom excellent! Thank you! |
@triller-telekom does your fix only address the error logging, or does it also keep the scheduler running for subsequent tasks (I don't think so)? |
Yes indeed. My fix is only to make the error show up in the logs. if you already know that a |
Pushed changes.
In |
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.
Thank you for your changes. The code looks really good now except for two small things where I have left a comment.
Regarding the git rebase: You noticed correctly that the hash of you commit has changed because it was rewritten onto the master branch. In order to push this rebased version of you branch you have to somehow "force" it via git push --force-with-lease
A git push --force
would also be sufficient but in projects where you work with others together on the same branch you could overwrite their work if you are not careful. I just recently learned the lease command and think its a very good thing to have.
A colleague of me has recently shared a nice link to a good introduction for git rebase.
@@ -123,7 +126,7 @@ public void handleCommand(ChannelUID channelUID, Command command) { | |||
break; | |||
|
|||
default: | |||
logger.warn("Command for channel {} not supported.", channelUID.getId()); | |||
logger.warn("Command for (read only) channel {} not supported.", channelUID.getId()); |
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.
Why did you add the "(read only)" here? You could get a command for an arbitrary channel...
But I am thinking about whether if it would make sense to reduce the log level to debug, because you are not interested in commands for other channels.
@@ -12,6 +12,7 @@ | |||
import java.math.RoundingMode; | |||
import java.util.concurrent.ScheduledExecutorService; | |||
|
|||
import org.eclipse.jdt.annotation.NonNull; |
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 do not use @NonNull
, use @NonNullByDefault
on the class and @Nullable
where appropriate instead, if you want to make use of the null annotations.
@triller-telekom done. |
@kaikreuzer @martinvw This PR is now ready for a final review and can be merged afterwards. Please have a final look at it. Thanks. |
Thank you very much @jwveldhuis ! |
Thank you for the extensive review! Enjoyed the collaboration! |
Thanks for this contribution @jwveldhuis! |
@kaikreuzer there are many models (Denon and Marantz) and I don't have a clear overview which ones support multiple zones (2 or 3). Also more models come to market over time, by dynamically detecting (or letting the user set) the number of zones we avoid having to update the binding for each new model. Adding channels dynamically is already done in the current version of this binding. |
ok, fine.
As mentioned above: There is no information about channel groups at all in the Thing, so there is no need to create or assign any. All that exists as a reference is the channel id with 'zoneX#volume' format (in constrast to the normal 'volume' channel id). |
@kaikreuzer I start to get it now.. Struggling with the code which dynamically adds / removes channels. Was using the ChannelTypeUID as a unique identifier to add/remove channels, this obviously does no longer work. Need to think of an alternative mechanism. Big drawback of using channel groups is the lack of custom labels / descriptions for each channel.
How to distinguish Main Zone from Zone1 and Zone2? I used to have custom labels, e.g. "Power (zone2)", "Mute (zone3)", etc. |
Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: @jwveldhuis)
Signed-off-by: Jan-Willem Veldhuis <[email protected]> (@github: jwveldhuis)
Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: jwveldhuis)
Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: jwveldhuis)
Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: jwveldhuis)
Signed-off-by: Jan-Willem Veldhuis <[email protected]>
Zone3. Fixed comments according to code analysis report. Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: jwveldhuis)
Just pushed the updated Binding. Have created separate channel groups in order to provide a custom description for each channel group (while still reusing the common channels). |
Sorry for my late reply - there actually is no need to define multiple channel-group-types. For custom labels&descriptions, you can simply overwrite them for each channel group:
This should simplify you xmls again a bit (and hopefully not require any code changes at all). |
Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: jwveldhuis)
@kaikreuzer ah thanks, now it all makes sense 😁 |
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.
Thanks! Now that we have settled the modelling, I had a detailed look through the code as well and left a few review comments on it.
Please also note that you should add an "Also-By Jeroen Idserda..." to your commit message as @idserda is a co-author (and by adding him, I assume we also have his approval for this contribution).
*/ | ||
public class DenonMarantzHandler extends BaseThingHandler implements DenonMarantzStateChangedListener { | ||
|
||
private Logger logger = LoggerFactory.getLogger(DenonMarantzHandler.class); |
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.
add "final" keyword
|
||
<config-description> | ||
<parameter-group name="receiverProperties"> | ||
<label>Receiver properties</label> |
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.
You have a mix of cases in your labels - please follow a single style. Usually, we use capitals in labels, here e.g. "Receiver Properties".
</parameter> | ||
|
||
<parameter name="telnetEnabled" type="boolean" groupName="connectionSettings"> | ||
<label>Use Telnet port?</label> |
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.
remove the question mark
} | ||
|
||
if (connector instanceof DenonMarantzHttpConnector && command instanceof RefreshType) { | ||
// Refreshing individual channels isn't supported by the Http connector. |
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.
Not ideal, but if the polling is done so frequently (every 5 secs if I see it right), it should be ok.
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.
I know, but the AVR can't handle too many HTTP requests at once. I had to power cycle my AVR during tests when all linked channels got polled during startup.
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.
Sure. Just fyi: We have a expiring cache that is meant for this situation (reducing the number of calls that go out to the device).
denonMarantzState = new DenonMarantzState(this); | ||
configureZoneChannels(); | ||
// create connection (either Telnet or HTTP) | ||
// ThingStatus ONLINE/OFFLINE is set when AVR status is known. |
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.
How long can that take? If that might be a few seconds (what I assume due to potential HTTP timeouts), you should set the status to UNKNOWN here first.
/** | ||
* | ||
*/ | ||
public void receivedLine(String line); |
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.
remove public
|
||
/** | ||
* The telnet client has successfully connected to the receiver. | ||
*/ |
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.
add JavaDoc for parameter
/** | ||
* The telnet client has successfully connected to the receiver. | ||
*/ | ||
public void telnetClientConnected(boolean connected); |
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.
remove public
|
||
logger.debug("IP Address: {}", host); | ||
|
||
// try a HTTP request to autoconfigure the HTTP / Telnet parameter |
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.
This does not look like a good idea - this method is expected to return fast; doing an HTTP call means it will block for potentially a few seconds. Better leave some properties unset in the discovery result.
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.
I agree it's not perfect. For some models HTTP is not an option, so for those I want to set 'Use Telnet' to true
in the Thing parameter. The default for this parameter is false
.
Should I do this instead?
- set some property in the Thing indicating it was created via a Discovery Result (I guess there is no way to determine otherwise?)
- if set, auto-detect and alter the value for parameter 'Use Telnet' during Initialization
E.g. I don't want to override the parameter when "explicitly" (there is a default) set by the user during manual Thing creation (for whatever reason).
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.
I found another option, but have trouble implementing this:
Limit the number of times the procedure is invoked to exactly once, by stopping further (relatively expensive) discovery activities as soon as it's clear we already configured or discovered the Thing.
https://www.eclipse.org/smarthome/documentation/development/bindings/discovery-services.html#compare-with-existing-results
I tried to implement the ExtendedDiscoveryService
with the MDNSDiscoveryParticipant
, this does not work unfortunately. How can I add this callback to the MDNSDiscoveryService? How do I approach this?
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.
@jwveldhuis This is a missing feature which I have just implemented in eclipse-archived/smarthome#5526
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.
@triller-telekom perfect!
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.
I am not sure whether this would be a solution. After all, you still have to do HTTP requests in a method that must return fast. And discovery is supposed to be passive in most cases, it should really just sit there and listen.
Couldn't you simply leave this property unset (=null) and upon handler initialisation, you do the HTTP call and figure out the right value, if it is still null? This would allow you to set the value without bothering the user and still avoid the risk of overwriting a value that the user has specifically set.
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.
Ok, I have now moved this part over the the Handler. Added benefit is the auto configuration for telnet/http and zone count is now also applied to Things configured in text files.
@@ -31,6 +31,7 @@ | |||
<module>org.openhab.binding.coolmasternet</module> | |||
<module>org.openhab.binding.dlinksmarthome</module> | |||
<module>org.openhab.binding.dscalarm</module> | |||
<module>org.openhab.binding.denonmarantz</module> |
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 also add the binding to https://github.com/openhab/openhab2-addons/blob/master/features/openhab-addons/src/main/feature/feature.xml
Great work! Not sure how much of my original code is still left but you definitely have my approval. |
Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: jwveldhuis) Also-by: Jeroen Idserda (github: idserda)
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.
Excellent, thanks for your updates!
* Initial contribution for new Denon-Marantz 2.0 binding Also-by: Jeroen Idserda (github: idserda) Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: @jwveldhuis)
* Initial contribution for new Denon-Marantz 2.0 binding Also-by: Jeroen Idserda (github: idserda) Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: @jwveldhuis)
Hi, I use Your binding wit OH2.4 and AVR-X6300H, all working OK except "surroundProgram", this tag show nothing, connection HTTP or Telnet make no differences. Look on screenshot. Thanks New issue #3724 |
@grzegorz914 please create a new issue for this. Please don’t add comments to closed issues. |
* Initial contribution for new Denon-Marantz 2.0 binding Also-by: Jeroen Idserda (github: idserda) Signed-off-by: Jan-Willem Veldhuis <[email protected]> (github: @jwveldhuis)
* Remove duplications * Better null handling * Use constants * Use default waitForAssert timeout (10s) This may help to get the test more stable (openhab#1089). Signed-off-by: Wouter Born <[email protected]>
This is a OpenHAB 2 port of the existing 1.x Denon binding (created by @idserda). As the binding supports both Denon and Marantz receivers decided to change the name to 'denonmarantz'.
Improvements:
Note that this binding is still work in progress. Need others to test this binding as I only own one Marantz receiver (SR5008) myself. That is the main reason for this PR, as I know some cleanup, fixing and documentation is required.
This is my first binding, and it took more time and effort than I'd hoped for.. ;)
Happy to learn how to further improve.