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

[emotiva] Initial contribution #16499

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

[emotiva] Initial contribution #16499

wants to merge 10 commits into from

Conversation

espenaf
Copy link
Contributor

@espenaf espenaf commented Mar 7, 2024

This PR adds support for Emotiva Audio Corporation AV processors based on the Emotiva Network Remote Control protocol. Discovery is supported.

Binding has only been tested with an XMC-2, so please test and give feedback for other devices.

Has support for all Emotiva notification types in version 2.0 and 3.0 of the protocol, and adds support for almost all commands, has support for Zone 2 controls, browsing and controlling the menu and using the radio tuner.

@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/emotiva-av-processor-binding/154406/1

@mlobstein mlobstein added the new binding If someone has started to work on a binding. For a new binding PR. label Mar 9, 2024
@mlobstein
Copy link
Contributor

The build is failing because your commit it not signed. See here for instructions to fix it: https://github.com/openhab/openhab-addons/pull/16499/checks?check_run_id=22412921872

"@text/message.processor.connection.failed");
disconnect();
scheduleConnectRetry(retryConnectInMinutes);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Thinking out loud: could (some of) this status updating be moved to handleStatusUpdate()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, the connection method is synchronized and try to make sure the connection is either working or we need to schedule a retry. Suggestions are welcome.

Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding the ThingStatus, it is a common practice to:

  • In initialize()
    • Set updateStatus(ThingStatus.UNKNOWN); at the start
    • Check configuration and set ThingStatus with details if it is not valid
    • End with a scheduled task (e.g. updateTask()) that updates the thing state and channels
  • In updateTask()
    • Check if connection is authenticated and continue or get authenticated and set ThingStatus
    • Get data to update channels, set ThingStatus on error.

Not covering all cases and when applied to this binding it might not suit 100%.

Copy link
Contributor Author

@espenaf espenaf May 26, 2024

Choose a reason for hiding this comment

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

Updated initialize() with status setting and checking of port and ipaddress to the device. As there is no authentication here, I did not do anything around th updateTask().

@espenaf espenaf force-pushed the emotiva branch 3 times, most recently from bf10246 to 612fde5 Compare April 30, 2024 16:47
@espenaf espenaf changed the title [emotiva][WIP] Initial contribution [emotiva] Initial contribution Apr 30, 2024
@espenaf espenaf marked this pull request as ready for review April 30, 2024 16:53
@espenaf espenaf requested a review from a team as a code owner April 30, 2024 16:53
@espenaf espenaf force-pushed the emotiva branch 2 times, most recently from 10d3e3c to ec88727 Compare April 30, 2024 20:16
Copy link
Contributor

@lsiepel lsiepel 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 this contribution. Looked at all except the key controller/handlers, will do in a next round.
For each comment, try to check if it can also apply to other parts of the code.

Please check that al SAT errors are fxied and the build comes without any warnings.

Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

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

^^^

Signed-off-by: Espen Fossen <espenaf@junta.no>
* Renamed all channels to use - instead of _
* Adding state for a number of channels
* Start using i18n translations
* Cleanups and fixes

Signed-off-by: Espen Fossen <espenaf@junta.no>
* Wildcard for static imports.
* Removed Norwegian translation.
* Removed empty lines.
* Small fixes.

Signed-off-by: Espen Fossen <espenaf@junta.no>
* Discovery method
* Model and revisions as properties
* Rename keep-alive to last-seen

Signed-off-by: Espen Fossen <espenaf@junta.no>
Signed-off-by: Espen Fossen <espenaf@junta.no>
@lsiepel
Copy link
Contributor

lsiepel commented May 26, 2024

While waiting for emotiva to respons to the question about an oiption list, there are some issues to fix.
Can you fix the SAT issues and build warnings. (see
https://github.com/openhab/openhab-addons/actions/runs/9237265388/artifacts/1537689743 )
Some comment about previous review is open: #16499 (comment)

After these are fixed i need one last review round.

* Fix SAT issues
* Add config check and set to UNKNOWN on initialize

Signed-off-by: Espen Fossen <espenaf@junta.no>
* Rewrite tests from assertj to junit/mockito.

Signed-off-by: Espen Fossen <espenaf@junta.no>
@espenaf
Copy link
Contributor Author

espenaf commented May 26, 2024

While waiting for emotiva to respons to the question about an oiption list, there are some issues to fix. Can you fix the SAT issues and build warnings. (see https://github.com/openhab/openhab-addons/actions/runs/9237265388/artifacts/1537689743 ) Some comment about previous review is open: #16499 (comment)

After these are fixed i need one last review round.

Pushed new changes that fixes all the SAT issues.

Signed-off-by: Espen Fossen <espenaf@junta.no>
* Added catch of InterruptedIOException
* Move logging of message content to trace

Signed-off-by: Espen Fossen <espenaf@junta.no>
@lsiepel
Copy link
Contributor

lsiepel commented May 28, 2024

While waiting for emotiva to respons to the question about an oiption list, there are some issues to fix. Can you fix the SAT issues and build warnings. (see https://github.com/openhab/openhab-addons/actions/runs/9237265388/artifacts/1537689743 ) Some comment about previous review is open: #16499 (comment)
After these are fixed i need one last review round.

Pushed new changes that fixes all the SAT issues.

Thanks, Another step forward. There are 35 compile warnings, can you also look into those.

Signed-off-by: Espen Fossen <espenaf@junta.no>
@espenaf
Copy link
Contributor Author

espenaf commented May 28, 2024

While waiting for emotiva to respons to the question about an oiption list, there are some issues to fix. Can you fix the SAT issues and build warnings. (see https://github.com/openhab/openhab-addons/actions/runs/9237265388/artifacts/1537689743 ) Some comment about previous review is open: #16499 (comment)
After these are fixed i need one last review round.

Pushed new changes that fixes all the SAT issues.

Thanks, Another step forward. There are 35 compile warnings, can you also look into those.

Now those have also been fixed.

Communication is established with Emotiva, just waiting on word from the people at Engineering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new binding If someone has started to work on a binding. For a new binding PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants