-
-
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
[nuvo] Nuvo Whole House Audio Binding - initial contribution #7651
Conversation
update fork
update fork
Signed-off-by: Michael Lobstein <[email protected]>
Signed-off-by: Michael Lobstein <[email protected]>
Test build available here: If you receive an error about openhab-transport-serial, issue the following command in the openhab console: feature:install openhab-transport-serial |
Travis tests were successfulHey @mlobstein, |
Signed-off-by: Michael Lobstein <[email protected]>
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests were successfulHey @mlobstein, |
update fork
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests were successfulHey @mlobstein, |
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests were successfulHey @mlobstein, |
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests were successfulHey @mlobstein, |
update fork
update fork
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests were successfulHey @mlobstein, |
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests were successfulHey @mlobstein, |
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 again! There are some compiler warnings left, concerning null pointers.
...openhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/NuvoHandlerFactory.java
Outdated
Show resolved
Hide resolved
...g.openhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/NuvoThingActions.java
Outdated
Show resolved
Hide resolved
...inding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/communication/NuvoConnector.java
Outdated
Show resolved
Hide resolved
case CHANNEL_TYPE_TREBLE: | ||
if (command instanceof DecimalType) { | ||
int value = ((DecimalType) command).intValue(); | ||
if (value >= MIN_EQ && value <= MAX_EQ && value % 2 == 0) { |
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.
Is it worth to translate odd values to even values, instead of ignoring them?
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 device is weird in that it only accepts even values (from -18 to 18). So this was done to along with step=2 in the channel configuration to have the binding values match the device. I noted it in the readme also.
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 had something like this in mind:
if(value % 2 == 1) value++;
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.
good idea, it will automatically become a compatible value.
...penhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/handler/NuvoHandler.java
Outdated
Show resolved
Hide resolved
...penhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/handler/NuvoHandler.java
Outdated
Show resolved
Hide resolved
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy,MM,dd,HH,mm"); | ||
connector.sendCommand(NuvoCommand.CFGTIME.getValue() + simpleDateFormat.format(new Date())); |
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.
Did you try this with different system timezones and configuring the timezone in PaperUI? I saw an example retrieving a zoned datetime service or so via @Reference
in an openHAB binding, but I can't find it again.
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 did not. It was just intended to use whatever the system time is regardless of time zone. I think this will be fine since most users set the host system to their local time.
bundles/org.openhab.binding.nuvo/src/main/resources/ESH-INF/thing/channels.xml
Outdated
Show resolved
Hide resolved
Signed-off-by: Michael Lobstein <[email protected]>
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests were successfulHey @mlobstein, |
Travis tests were successfulHey @mlobstein, |
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests were successfulHey @mlobstein, |
...ding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/communication/NuvoStatusCodes.java
Show resolved
Hide resolved
...ding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/communication/NuvoStatusCodes.java
Outdated
Show resolved
Hide resolved
....binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/communication/NuvoCommand.java
Outdated
Show resolved
Hide resolved
...hab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/communication/NuvoEnum.java
Outdated
Show resolved
Hide resolved
...hab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/communication/NuvoEnum.java
Outdated
Show resolved
Hide resolved
...ing.nuvo/src/main/java/org/openhab/binding/nuvo/internal/communication/NuvoReaderThread.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.binding.nuvo/src/main/resources/ESH-INF/thing/channels.xml
Outdated
Show resolved
Hide resolved
...penhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/handler/NuvoHandler.java
Outdated
Show resolved
Hide resolved
if ((serialPort == null || serialPort.isEmpty()) && (host == null || host.isEmpty())) { | ||
configError = "undefined serialPort and host configuration settings; please set one of them"; | ||
} else if (serialPort != null && (host == null || host.isEmpty())) { | ||
if (serialPort.toLowerCase().startsWith("rfc2217")) { |
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 openHAB serial port handler supports rfc2217
? Is there a reason not to use it and instead of having implemented a separate ip connector and configuration options?
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 as this was pulled in from the rotel binding. I seems like rfc2217 (Telnet Com Port) may be supported to some degree. But there were probably issues, so a distinct connector was defined instead and this check was put in place to prevent an unusable configuration. @lolodomo any ideas?
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.
RFC2217 through the openhab serial layer never worked in bindings I worked on.
I am not sure of the reason but my hypothesis was it doesn't work if you need to read and write in parallel.
But you are welcome to try with any new binding. Maybe I was just not enough clever to make it work.
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 probably a problem in case you have a reader thread that always read data.
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.
That makes sense. But I think I will just stick with what works.
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.
@hillbrand: Honestly I don't remember. I even don't remember if I tested that with this binding in particular. But as I am using serial over IP, I could try again one day.
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.
@lolodomo Maybe it was related to the endless sleep 'fix' (that could be and was removed during the review process)? Did you ever test after that change?
@mlobstein Did you test if it worked at all by using the rfc2217 version?
I did not test it with rfc2217
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 it's not tested or not known if the rfc2217 configuration way doesn't work I would be in favor of removing the specific ip implementation here and allowing the rfcc2217 configuratiin option for serial. Its always possible to add features, but removing them is hard. This also reduces the amount of copy-pasting of specific code.
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.
A couple questions...
-
I tried rfc2217 and it seemed to work connecting to a ser2net endpoint after a few changes to the serial connector. I had to conditionally bypass SerialPort.enableReceiveThreshold(), SerialPort.enableReceiveTimeout() & SerialPort.setFlowControlMode() as the calling those with rfc2217 throws an exception. I also had to catch an IllegalStateException that was being thrown if the remote connection was refused or otherwise failed to connect. That being said, are there any bindings that currently support rfc2217 explicitly (as a reference implementation)? I did a quick scan of the 2.5.x bindings and the only references to rfc2217 were in 6 other bindings that blocked its usage during initialization.
-
If rfc2217 is to be used, does the user need to make the choice to specify the rfc2217 url string in place of the serial port or can this be handled behind the scenes? There seems to be some controversy with setting limitToOptions=false for the serial port in the configuration. [Q] How to add a rfc2217://.. port in the UI (PaperUI, Habmin) openhab-core#1029 Once this is set to false, the user can type the url string for the rfc2217 connection (rfc2217://:). I feel this is cumbersome and it would be much easier for the user to give them a place to specify IP and port # for the remote serial port and use those to construct the rfc2217 url in the absence of a physical serial port being selected from the drop down.
@kaikreuzer
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 extensive testing this. At least we know it works (besides the exception throwing. In know the dsmr binding does also works once the exceptions would be wrapped.). The openhab-core issue 1029 you mentioned was about the possibility to be able to add a network connection. It doesn't even address the usability of it, which is too bad. I also looked at the other bindings. It looks to me this has grown historically. In the past the gnu serial library was used directly, so no rfc2217 support was availble. So that earlier binding implemented their own version of it. Later versions seem to be made by the same person and he copied that implementation. The other bindings seem to add a bridge for ip configuration. I also noted we already approved your oppo binding that does the same.
So I'll guess it should be ok to leave it as is here. What I'm planning, is to see if I can get those quircks fixed in core so it behaves the same as other direct serial connections and than see if this makes it possible to remove the custom implementations for ip connections. For example here you could construct the rfc2217 connection fromt host-port input and then use the rfc2217 of core. The configurations can than still remain (with addition that rfc2217 configuration would be allowed on serialPort configuration). But that would not be available before openHAB 3.0.
...penhab.binding.nuvo/src/main/java/org/openhab/binding/nuvo/internal/handler/NuvoHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests were successfulHey @mlobstein, |
Update fork
Signed-off-by: Michael Lobstein <[email protected]>
Travis tests have failedHey @mlobstein, |
Signed-off-by: Michael Lobstein <[email protected]>
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.
LGTM
Travis tests were successfulHey @mlobstein, |
…#7651) Signed-off-by: Michael Lobstein <[email protected]>
…#7651) Signed-off-by: Michael Lobstein <[email protected]>
…#7651) Signed-off-by: Michael Lobstein <[email protected]>
[nuvo] Initial contribution
This is the initial implementation of a Binding to control the Nuvo Grand Concerto or Essentia G whole house multi-zone amplifier.