Open freezir12 opened 3 years ago
Do you have the http server enabled in your snapcast server config? I think it's disabled by default.
Look for these lines in your snapserver.conf:
[http]
enabled = true
bind_to_address = 0.0.0.0
port = 1780
doc_root = /opt/snapweb/dist
Edit: I'm an idiot, you clearly said the server is enabled and working.
Yes "name" in the homebridge plugin config should match the --hostID command line option used on your snapclient. Also make sure the group name is correct.
Thx for your quick answer! I have problems configuring my setup: here is my config, could you have a look at it pls?:
Server:
Client:
homebridge accessory:
{ "accessory": "Snapcast", "name": "OSMC", "groupname": "Group 1", "serverUrl": "http://192.168.114:1780/jsonrpc" },
Is Homebridge and the snapserver on the same host? What do you have the bind_to_address setting set to in your snapserver.conf?
If they are on the same host and bind_to_address is set to 127.0.0.1 then you need to use http://127.0.0.1:1780/jsonrpc as the serverUrl.
In a web browser if you browse to http://192.168.114:1780 do you get the snapcast web UI and does it work as expected?
Good Morning! Yes, snapserver and Homebridge are running on the same host.
I have changed the snapserver config like you said: HTTP: Enabled:true Bind_to_adress: 127.0.0.1 Port: 1780
with “bind_to_adress” set to 127.0.0.1 the Snapweb WebUI is not reachable with 192.168.114:1780 anymore but:
Which version of snapserver are you using? Is it the 0.23?
I wasn't suggesting that you configure snapserver to bind to 127.0.0.1.. I just wanted to confirm that you were NOT binding to 127.0.0.1 because if you were then you would have to set the serverUrl to 127.0.0.1 or else it wouldn't work. So go ahead and set the bind address back to 0.0.0.0 and we will look somewhere else for the issue.
I am running snapserver 0.20.0. Maybe the json-rpc interface changed in 0.23.0 which broke my plugin. I will update my snapserver and see if it breaks my plugin. I will report back what I find.
Okay I think I found your issue. You have the groupname set to "Group 1". Technically "Group 1" isn't the name of your group but rather the index of your group. The snapweb interface doesn't give the ability to name groups, it simply lists them by index as Group 1, Group 2 and so on. My fix for you will be to add an additional setting to my config file named "groupnumber". So in your case where you don't have an actual name set for your group you can specify the group number instead. So in your case your config would look like this:
{ "accessory": "Snapcast", "name": "OSMC", "groupnumber": 1, "serverUrl": "http://192.168.114:1780/jsonrpc" }
I will get to work on this right now. Shouldn't take long.
That’s absolutely awesome! Thank you very much!Thanks for your effort!
Okay I pushed a commit to this repo with the update and also pushed a new package to npm. You should be able to use npm to update your package. If you don't pickup v1.0.2 then install using homebridge-snapcast@1.0.2. I tested it on my end and it seemed to work using groupnumber so hopefully it will work for you.
I am about to try your new version. I can not find a new version on npmjs. I only can see the new version here on github
Yeah npm is very slow to show new packages on their website. If you do "npm -g i homebridge-snapcast" you should pick up 1.0.2. It's there and the package manager will pull it, you just don't see it on their site yet.
Neverminded, you were right. When I did the publish I didn't realize I had npm set to publish to my private package registry.. I just switched back to npmjs and published again and now I see it on the website.
Alright, updated the package. Now i can see a reaction on the snapserver output if i change the volume. But it says:
[Error] (Server) Server::onMessageReceived JsonRequestException: {"error":{"code":-32603,"data":"Client not found","message":"Internal error"},"id":1,"jsonrpc":"2.0"}, message: {"id":1,"jsonrpc":"2.0","method":"Client.SetVolume","params":{"id":"00:00:00:00:00:00","volume":{"muted":true}}}
I guess there is something wrong with my snapclient config. Does this part "id":"00:00:00:00:00:00" has to be the MAC of my snapclient?
It isn't always a mac. On my Debian machine I launch a client like this:
--host 127.0.0.1 \
--instance 3 \
--hostID Bathroom \
--soundcard top_orange_softvol
And the ID ends up being "
Wait! I think i found the error in my snapclient config
edit: Nope still says client not found...
Sorry <.< I feel very stupid right now -.-
Okay, try running this gist on your server: https://gist.github.com/noelhibbard/d4ee334c6e84f4c402379b31582d162d
Run it like this for example:
node ./snapcast-groups.js 127.0.0.1:1780
It should create a file named snapcast-groups.json. Paste the results here and hopefully there will be some hints in there.
Here we go:
[ { "clients": [ { "config": { "instance": 1, "latency": 0, "name": "", "volume": { "muted": false, "percent": 100 } }, "connected": false, "host": { "arch": "armv7l", "ip": "10.9.90.128", "mac": "b8:27:eb:80:23:da", "name": "PlantBridgeRPi3", "os": "Raspbian GNU/Linux 10 (buster)" }, "id": "b8:27:eb:80:23:da", "lastSeen": { "sec": 1610652999, "usec": 643433 }, "snapclient": { "name": "Snapclient", "protocolVersion": 2, "version": "0.18.1" } } ], "id": "f2c012ba-42bf-962c-1ae3-9a097db5db81", "muted": false, "name": "", "stream_id": "Airplay" }, { "clients": [ { "config": { "instance": 1, "latency": 0, "name": "", "volume": { "muted": false, "percent": 100 } }, "connected": false, "host": { "arch": "armv7l", "ip": "10.9.90.120", "mac": "b8:27:eb:ff:ff:01", "name": "OSMCWohnzimmer", "os": "Debian GNU/Linux 10 (buster)" }, "id": "OSMC_Wohnzimmer", "lastSeen": { "sec": 1610602961, "usec": 60200 }, "snapclient": { "name": "Snapclient", "protocolVersion": 2, "version": "0.22.0" } } ], "id": "caadf122-1cf2-e6b1-57fa-11af53a99354", "muted": false, "name": "", "stream_id": "default" }, { "clients": [ { "config": { "instance": 1, "latency": 0, "name": "", "volume": { "muted": false, "percent": 100 } }, "connected": false, "host": { "arch": "armv7l", "ip": "10.9.90.120", "mac": "b8:27:eb:ff:ff:01", "name": "OSMCWohnzimmer", "os": "Debian GNU/Linux 10 (buster)" }, "id": "OSMCWohnzimmer", "lastSeen": { "sec": 1610653009, "usec": 984414 }, "snapclient": { "name": "Snapclient", "protocolVersion": 2, "version": "0.22.0" } } ], "id": "92e2e6bb-368e-84a4-fbfd-67ce04812b6b", "muted": false, "name": "", "stream_id": "Airplay" } ]
Okay looking at that I can see why this config wouldn't work:
{ "accessory": "Snapcast", "name": "OSMC", "groupnumber": 1, "serverUrl": "http://192.168.114:1780/jsonrpc" }
Group 1 only has one client in it and it isn't named "OSMC". In fact, none of your groups or clients have names.
If you drill into the json output you just pasted with this json path you will see what I mean: $.[0].clients[0].config.name
In the Snapcast webUI you should be able to click the pencil icon to the right of your client and then name it "OSMC" and that should make the plugin start working.
Through some tests i have changed the name from OSMC to OSMCWohnzimmer (in the homebridge config, in the snapclient config and the RPis hostname). So it all was set to the right name. This name showed up in the SnapWeb UI too. But apparently the clientname was not set for the snapserver until i clicked the pencil icon on the SnapWeb UI and submitted this exact name again!
Jesus Christ! Such an easy thing... Sorry i took so much of your time! Thanks sooo much for your patience and your help! I can not point out how happy you made me! :)
I used the pencil icon to set the name of one of my clients to be blank and after that it was displaying in the UI as the hostname of the client. So if your "name" is the same as the hostname I could see where there would be some confusion. I'm fairly new to snapcast so I don't know it that well so I've learned something new today. I will try to add some notes to the readme to point out some of this stuff.
So thank you too! Glad it's working for you now. Play around with Siri. You can say stuff like "Hey Siri, raise the bathroom speaker 20%".
Yeah already talking to Siri and playing with it :D
Hi! First thx for that plugin! I would really love it... if i could make it work. ^^ I have the snapserver and homebridge up and running, no errors regarding the homebridge-snapcast plugin and the webGUI for snapcast is running fine (at Port 1780) and the controls work fine. Sadly there is no effect to the snapcast player or the volume if i use the slider. In the config of the accessory the name should be the hostname of the device running the snapclient, or am i wrong? And in the verbose output of homebridge there is no line appearing saying that the state of the accesory changed or sth similar. Thx in advance! :)