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

[snapcast] Snapcast Binding initial contribution #4189

Closed
wants to merge 3 commits into from

Conversation

StbX
Copy link

@StbX StbX commented Nov 2, 2018

This is a new binding to integrate snapcast.

Snapcast is a multi-room client-server audio player, where all clients are time synchronized with the server to play synced audio.
This binding allows to control the snapcast clients (change volume, mute, select stream).

An compiled JAR is available at: https://github.com/StbX/openhab2-addons/releases

@wborn wborn added the new binding If someone has started to work on a binding. For a new binding PR. label Nov 2, 2018
@kaikreuzer
Copy link
Member

Snapcast looks like a very cool project for DIY multi-room audio 👍 .

FTR: Every change to this PR will automatically also be deployed to https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.snapcast/2.4.0-SNAPSHOT/, so there's no need for you to provide a manually build jar anywhere else!

@StbX StbX force-pushed the snapcast branch 2 times, most recently from 3886c51 to 29343e6 Compare November 27, 2018 23:58
@cguedel
Copy link
Contributor

cguedel commented Nov 28, 2018

This looks very cool. However, I was not able to control volume or play/pause a client using the configuration example you have provided. It seems like the system:volume channel is not found and there is no player channel at all?

@StbX
Copy link
Author

StbX commented Nov 29, 2018

@cguedel are you already using the unreleased openHAB 2.4?
I’m using for the description of the volume and mute channels global system-types. As far da I know, these system-types are new in the version 2.4.

@wborn wborn changed the title [snapcast] Initial contribution [snapcast] Snapcast Binding initial contribution Dec 18, 2018
Signed-off-by: Steffen Brandemann <steffen+openhab@dakloetz.de>
Steffen Brandemann added 2 commits February 19, 2019 22:53
Signed-off-by: Steffen Brandemann <steffen+openhab@dakloetz.de> (github: StbX)
Signed-off-by: Steffen Brandemann <steffen+openhab@dakloetz.de> (github: StbX)
@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/snapcast-binding/25551/20

@J-N-K
Copy link
Member

J-N-K commented Sep 22, 2019

@StbX, do you intend to continue this work?

@StbX
Copy link
Author

StbX commented Sep 30, 2019

@J-N-K Yes, I would like to continue this work.
I'm using this addon in my (currently outdated) openHAB.

@martinvw martinvw changed the base branch from master to 2.5.x January 13, 2020 09:56
Copy link
Member

@martinvw martinvw left a comment

Choose a reason for hiding this comment

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

@StbX thanks for your continued work.

I added some comments, please let us know when you need any help.

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

One of the major steps you have to do now is the BND migration more info:

https://community.openhab.org/t/tutorial-migrate-your-binding-to-the-maven-bnd-based-build-system/81389

xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<channel-type id="serverStreams">
Copy link
Member

Choose a reason for hiding this comment

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

I think that these channels would make more sense if they are provided as a selectable list of Options, see for example the Spotify binding:

https://github.com/openhab/openhab-addons/blob/2.5.x/bundles/org.openhab.binding.spotify/src/main/java/org/openhab/binding/spotify/internal/handler/SpotifyDynamicStateDescriptionProvider.java

Can you take a look at that? If that does not match what you need please explain your usecase.

<state readOnly="true" />
</channel-type>

<channel-type id="clientName">
Copy link
Member

Choose a reason for hiding this comment

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

What is the use case for this client-name? Does it make sense that it is read/write.

<state readOnly="false" />
</channel-type>

<channel-type id="clientLatency">
Copy link
Member

Choose a reason for hiding this comment

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

Some of these channels might make sense as properties wdyt?

<channel id="volume" typeId="system.volume" />
<channel id="mute" typeId="system.mute" />
<channel id="latency" typeId="clientLatency" />
<channel id="stream" typeId="streamId" />
Copy link
Member

Choose a reason for hiding this comment

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

To what does this stream refer? Is there also something like a stream name?

break;
case CHANNEL_CLIENT_VOLUME:
if (command instanceof RefreshType) {
clientProtocolHandler.updateVolumn(clientId);
Copy link
Member

Choose a reason for hiding this comment

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

Typo volumn -> volume

* @param origin the origin state
* @param update the new state
*/
protected <O extends Identifiable> void mergeThingState(O origin, O update) {
Copy link
Member

Choose a reason for hiding this comment

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

Is this really needed? What is the exact usecase for this?

try {
sh.openSocket();
} catch (IOException e) {
serverController.disconnected();
Copy link
Member

Choose a reason for hiding this comment

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

Please make sure to update the status of thing Things

try {
openSocket();
} catch (IOException e) {
Thread.sleep(5000);
Copy link
Member

Choose a reason for hiding this comment

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

Is this Thread.sleep really needed, can you maybe just reschedule a thread?

} catch (InterruptedException e) {
running = false;
} catch (IOException e) {
logger.error("snapcast connection error", e);
Copy link
Member

Choose a reason for hiding this comment

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

In E.4 of the coding guidelines we listed what kind of logging level should be used when. Error should only be used:

error logging should only be used to inform the user that something is tremendously wrong in his setup, the system cannot function normally anymore, and there is a need for immediate action.

Please change this to use the correct logging levels and if possible change the ONLINE/OFFLINE status of thing / bridge.

@J-N-K J-N-K added stale As soon as a PR is marked stale, it can be removed 6 months later. and removed awaiting feedback labels May 9, 2020
@Hilbrand
Copy link
Member

Closing due to long time no activity. If you still want to have this merged feel free to reopen or create a new pr.

@Hilbrand Hilbrand closed this Aug 27, 2020
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. 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.

None yet

9 participants