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
Conversation
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! |
3886c51
to
29343e6
Compare
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? |
@cguedel are you already using the unreleased openHAB 2.4? |
Signed-off-by: Steffen Brandemann <steffen+openhab@dakloetz.de>
Signed-off-by: Steffen Brandemann <steffen+openhab@dakloetz.de> (github: StbX)
Signed-off-by: Steffen Brandemann <steffen+openhab@dakloetz.de> (github: StbX)
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
@StbX, do you intend to continue this work? |
@J-N-K Yes, I would like to continue this 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.
@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"?> |
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.
One of the major steps you have to do now is the BND migration more info:
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"> |
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 think that these channels would make more sense if they are provided as a selectable list of Options, see for example the Spotify binding:
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"> |
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 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"> |
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.
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" /> |
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 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); |
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.
Typo volumn -> volume
* @param origin the origin state | ||
* @param update the new state | ||
*/ | ||
protected <O extends Identifiable> void mergeThingState(O origin, O update) { |
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 this really needed? What is the exact usecase for this?
try { | ||
sh.openSocket(); | ||
} catch (IOException e) { | ||
serverController.disconnected(); |
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 sure to update the status of thing Things
try { | ||
openSocket(); | ||
} catch (IOException e) { | ||
Thread.sleep(5000); |
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 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); |
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.
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.
Closing due to long time no activity. If you still want to have this merged feel free to reopen or create a new pr. |
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