Closed cho0p closed 6 years ago
Voice commands via DialogFlow are also working now but still all LMS commands (lms + spotify) lead to the player status mentioned above. The player stops playing music and the playlist is blank.
Spotty internet fishing for next 2 days. Sounds like you may not have modified the shell scripts properly. They do the queries and queue up the music. See read me for that section and troubleshooting.md
Let me know how you make out I will be able to help better Friday
Sent from my iPhone
On Aug 8, 2018, at 5:33 AM, cho0p notifications@github.com wrote:
Voice commands via DialogFlow are also working now but still all LMS commands (lms + spotify) lead to the player status mentioned above. The player stops playing music and the playlist is blank.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks. I checked it once again but cannot figure out the problem.
If I enter "bash spot_art_alb.sh supertramp breakfast+in+america" in the shell directory via SSH I get the same output that you have.
It seemed like I havent activated the HA API (I am totally new to HA - just installed it because of your LMS script). I have added "api:" to the configuration.yaml now but it doesn
t seem to fix the problem.
For the spotify *.sh`s I have added the client id and client secret (double checked it several times now) and changed the URL to
https://**XXX**.duckdns.org/api/states/sensor.art_ID?api_password=**XXX**
For the qry_alb.sh and qry_alb_song.sh I use my local IP address:
query=$(printf "artists 0 20 search:$1 tags:a \nexit\n" | nc 192.168.1.60 9090 )
Is it correct that there is no colon between the IP and port?
I also noticed that "LMS command to play LMS song" on the frontend is stated twice:
Is that correct or is there something wrong with the configuration?
All 4 "Play..." lms commands lead to an immediate interrupt of the music playback and an empty playlist. I have installed another LMS on my Windows 10 machine for test purpose and it even crashes the server. Using the 4 "Add..." lms commands lead to no effect at all (nothing is added to the playlist but the lms server doens`t stop).
Thanks for your support!!
Here is an excerpt of the LMS log file when I try to play a song via HA web interface:
[18-08-08 16:10:45.1595] Slim::Control::Request::dump (2343) Param: [_item] = [] [18-08-08 16:10:45.1600] Slim::Control::Request::dump (2343) Param: [_title] = undef [18-08-08 16:10:45.1605] Slim::Control::Request::dump (2343) Param: [_fadein] = undef [18-08-08 16:10:45.1611] Slim::Control::Commands::playlistXitemCommand (1358) cmd: play, item: , title: , fadeIn: undef [18-08-08 16:10:45.1617] Slim::Control::Commands::playlistXitemCommand (1383) url: [18-08-08 16:10:45.1624] Slim::Control::Commands::playlistXitemCommand (1445) path: [18-08-08 16:10:45.1641] Slim::Control::Request::notifyFromArray (842) (playlist stop) [18-08-08 16:10:45.1656] Slim::Control::Commands::playlistXitemCommand (1489) currentPlaylist:// [18-08-08 16:10:45.1662] Slim::Control::Commands::playlistXitemCommand (1531) jumpToIndex: 0 [18-08-08 16:10:45.1668] Slim::Utils::Scanner::scanPathOrURL (54) Error: No path or URL was requested! [18-08-08 16:10:45.1680] Slim::Control::Request::dump (2339) Request: Command [b8:27:eb:3b:1e:97->playlist jump] (Dispatchable) [18-08-08 16:10:45.1691] Slim::Control::Request::dump (2343) Param: [_noplay] = [0] [18-08-08 16:10:45.1698] Slim::Control::Request::dump (2343) Param: [_fadein] = undef [18-08-08 16:10:45.1710] Slim::Control::Request::dump (2343) Param: [_seekdata] = undef [18-08-08 16:10:45.1717] Slim::Control::Request::dump (2343) Param: [_index] = [0] [18-08-08 16:10:45.1737] Slim::Control::Request::notifyFromArray (842) (playlist load_done) [18-08-08 16:10:45.1748] Slim::Control::Request::callback (2004) Callback disabled [18-08-08 16:10:45.1778] Slim::Control::Request::notifyFromArray (842) (prefset server currentSong ) [18-08-08 16:10:45.1832] Slim::Control::Request::notifyFromArray (842) (prefset server currentSong ) [18-08-08 16:10:45.1898] Slim::Control::Request::dump (2339) Request: Query [b8:27:eb:3b:1e:97->status] from JSONRPC (Dispatchable) [18-08-08 16:10:45.2156] Slim::Control::Request::dump (2343) Param: [tags] = [adKl] [18-08-08 16:10:45.2162] Slim::Control::Request::dump (2343) Param: [_quantity] = [1] [18-08-08 16:10:45.2168] Slim::Control::Request::dump (2343) Param: [_index] = [-]
While further testing I just noticed a slight difference in the shell output when performing "bash spot_art_alb.sh supertramp breakfast+in+america":
Your output:
uri is: spotify:album:1zcm3UvHNHpseYOUfd0pna
{"attributes": {}, "entity_id": "sensor.spotify_uri", "last_changed": "2018-07-27T00:05:28.674277+00:00", "last_updated": "2018-07-27T00:05:28.674277+00:00", "state": "spotify:album:1zcm3UvHNHpseYOUfd0pna"}
my output:
uri is: spotify:album:1zcm3UvHNHpseYOUfd0pna
{"attributes": {}, "context": {"id": "61a47a74f7f54ab2a68b5f7b6d0ee5c7", "user_id": null}, "entity_id": "sensor.art_id", "last_changed": "2018-08-10T16:51:53.261123+00:00", "last_updated": "2018-08-10T16:51:53.261123+00:00", "state": "spotify:album:1zcm3UvHNHpseYOUfd0pna"}
LMS Log using LMS spotify commands (via HA web UI):
[18-08-10 16:51:08.5536] Slim::Utils::Scanner::scanPathOrURL (54) Error: No path or URL was requested!
Hi cho0p, Sorry you're having issues getting this setup. A couple of questions first then we can try a few things. Shouldn't be too big of a deal. let's start with spotify first:
http:
section needs to include the following entry: api_password: yourAPIpassword
and usually contains an entry for base_url: https:\\XX.duckdns.org
. While I may not have discussed this, it's pretty much a gimme for a workign HA instance reachable over the internet. I will add this to the docs. Some details on the http component are available here. https://www.home-assistant.io/components/http/https:\\xx.duckdns.org
. Did it ask for a password?supertramp
and album to breakfast in america
and then select the command play album. This should run the script, and create a HA sensor called spotify uri which will contain the following link: spotify:album:1zcm3UvHNHpseYOUfd0pna
. If the sensor is not created then either the script is not being called or your https://XXX.duckdns.org/api/states/sensor.art_ID?api_password=XXX
link is not correct or enabled properly.Let me know how you make out to this point.
If no luck, you can send a private email to yland@vianet.ca with your configuration.yaml file for review if your comfortable with that.
Ynot.
Hi Ynot,
1: Yes, base url and api password have been set. 2: Yes, all port forwards are setup in the router and are working. I use the HA Web UI via https://... so the Duckdns SSL is also working. Web UI asks for the password every time. 3: Yes, they are the same.
6: Just noticed a slight difference (not sure if this matters - see post above). When I try to play that album nothing happens but the LMS stops playing, resets the queue and has the error mentioned above in the log files.
Yes, sure, I will send you the configuration.yaml via Email.
Thanks a lot for your help.
cho0p
did the senor get created in HA instance in step 6.
Where can I check that? Is there a log file somewhere?
On the states page https://xx.duckdns.org/states it would be at the
top with the rest of the sensors
or the logbook https://xx.duckdns.org/logbook
Quoting cho0p notifications@github.com:
Where can I check that? Is there a log file somewhere?
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/ynot123/LMS_Controls/issues/3#issuecomment-412152149
Ah this small round icon.. Yes - when I try to play Supertramp via Spotify it changes to:
spotify:album:1zcm3UvHNHpseYOUfd0pna
Looking for Rammstein - Mutter it`s: spotify:album:7ikuEzL6xeAgu6yT6YVLy7
so that seems to work (by the way: it`s not just spotify - I cannot start playing a LMS playlist as well).
OK good news. That means your basically there HA is getting the result of the query. A similar sensor (different name) is created when querying LMS database.
I assume your media player called mediaroom works in lms on its own. I notice in your config file the values for input_select.lms_player and input_select.lms_sync_master have not been updated to reflect your real values. This should be done.
Can you send me the name of your the LMS entity media_player.whatevethenameis
.
-rw-r--r-- 1 root root 1837 Aug 10 16:10 qry_alb.sh -rw-r--r-- 1 root root 4396 Aug 10 16:10 qry_alb_song.sh -rw-r--r-- 1 root root 766 Aug 10 17:09 spot_art_alb.sh -rw-r--r-- 1 root root 876 Aug 8 11:40 spot_art_alb_song.sh -rw-r--r-- 1 root root 839 Aug 8 11:40 spot_art_top.sh -rw-r--r-- 1 root root 743 Aug 8 11:40 spot_playlist.sh
in theory they should be executable but obviously if the sensor is
working then its running. see next email I replied.
Quoting cho0p notifications@github.com:
-rw-r--r-- 1 root root 1837 Aug 10 16:10 qry_alb.sh -rw-r--r-- 1 root root 4396 Aug 10 16:10 qry_alb_song.sh -rw-r--r-- 1 root root 766 Aug 10 17:09 spot_art_alb.sh -rw-r--r-- 1 root root 876 Aug 8 11:40 spot_art_alb_song.sh -rw-r--r-- 1 root root 839 Aug 8 11:40 spot_art_top.sh -rw-r--r-- 1 root root 743 Aug 8 11:40 spot_playlist.sh
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/ynot123/LMS_Controls/issues/3#issuecomment-412160169
I assume your media player called mediaroom works in LMS on its on using the LMS front end to queue the spotify songs using spotty addon..
I notice in your config file the values for input_select.lms_player and input_select.lms_sync_master have not been updated to reflect your real values. This should be done.
Can you send me the name of your the LMS entity media_player.whatevethenameis.
To be honest this is confusing me a little bit. I currently have one server (Raspberry Pi 3) which hosts the LMS and the HA (in a docker). This is what can be found on the LMS Web UI:
Logitech Media Server Version: 7.9.1 - 1522157629 @ Fri Mar 30 12:27:11 CEST 2018 Hostname: raspberrypi IP-Adresse des Servers: 192.168.1.60 Server-HTTP-Portnummer: 9000
I have another Raspberry Pi + Amplifier running Max2Play with Squeezelite:
Player-Modell: SqueezeLite Gerätetyp: squeezelite Hostname: mediaroom Firmware: Max2Play v1.0.1 based on v1.8.4-726 IP-Adresse des Players: 192.168.1.52 MAC-Adresse des Players: XX:27:eb:3b:1e:XX
Does this help?
This makes sense now. First off this will only work if you have a working instance of LMS server configured and running properly with the spotty addon (for spotify use). In addition, your LMS database needs to host some music files, and have some players to talk to (which obviously you have).
I am not familiar with Max2Play and if this contains the LMS server already or not.
The configuration you have outlined above should be workable. You may want to do some setup of your lms server so you know that works first, play some music using that interface then when that's setup you can consider tackling this part. When your player is setup, it should appear n your HA front-end GUI automatically.
Access LMS server is done by http:\192.168.1.60:9000 from there you should be able to set things up. Define your player name, setup your local music file database, setup spotty addon for spotify access.
A great place ot learn about this is https://forums.slimdevices.com/. Sorry I can't be of much help here until all that stuff is setup and working.
Hmm not sure if this is a misunderstanding. My LMS is already running for month now and working fine and properly as well as the Spotty plugin.
The Max2Play does not run LMS (otherwise I would have 2 LMS server instances) but just the Squeezelite Player "mediaroom".
So all is setup and working so I am not sure what else I should configure within my LMS configuration. The player also appears automatically in the HA web frontend, yes.
So i don`t see any issues here..?!
I can also control the volume already via Voice/Google Assistant and Dialogflow with your script. Just the LMS Commands are not working and I can`t figure out why.
OK my bad, sounded like it was a new install and thought it wasn't all setup up.
In your HA install do you have a file called entity_registry.yaml? It should list the LMS players you have configured in your LMS installation along with their mac address and platform. Typical entry looks like this:
media_player.kitchen:
config_entry_id:
name: Kitchen
platform: squeezebox
unique_id: bb:bb:4e:4a:xx:yy
HA refers to this entity by it's ID which is media_player.kitchen. In your configuration.yaml file, the input_select for lms_player and lms_sync_master need to contain the names of your players which is the part after media_player.XXXXXXXXX in my case `kitchen'. Each one of your players ID's need to be listed there exactly as listed is HA. Mine entities are media_player.kitchen, media_player.mediaroom, media_player.familyroom, media_player.garage, media_player.googlehome, etc.. so my input_select for lms_player and lms_sync_master contain the following entries:
lms_player:
name: Media Player Name
options:
- mediaroom
- kitchen
- garage
- familyroom
- googlehome
- googlemini_1
- googlemini_2
icon: mdi:cast-connected
lms_sync_master:
name: Master Player (Sync Source)
options:
- mediaroom
- kitchen
- garage
- familyroom
- googlehome
- googlemini_1
- googlemini_2
icon: mdi:cast-connected
Please update your to suit your configuration. You can always add more in the future.
No worries! Yes, I have the entity_registry.yaml file and it contains exactly the same lines:
media_player.mediaroom:
config_entry_id: name: mediaroom platform: squeezebox unique_id: XX:27:eb:3b:1e:XX
I guess the connection between HA and LMS is somehow working but it seems to "crash" the server because everytime I trigger a LMS Command via the HA web UI the LMS stop playing and empties the queue.
Interesting. That's the key. The volume, play, pause, next track do not use the media_player.squeezebox_call_method and I suspect that's what's giving you trouble.
Looking over your configuration.yaml file one more time, I notice the entry for the squeezebox component seems to be missing:
media_player:
- platform: squeezebox
host: 192.168.1.60
Add that and see if it works.
Hm no unfortunately that won`t solve the problem. It is already included (line 83-85):
Humor me and move the following lines to the end of the file, they are the additional files to be included in the config and belong at the end of the file.
group: !include groups.yaml automation: !include automations.yaml script: !include scripts.yaml
reboot and try again.
Nope, doesn't help :(
LMS commands from the HA Web UI lead to the following Logitech Media Server error (log):
[18-08-10 20:31:18.3850] Slim::Utils::Scanner::scanPathOrURL (54) Error: No path or URL was requested!
Everything is build from scratch because I found your script and wanted to install it. So I dont have any special plugins/addons or configurations (everything more or less standard) so I
d guess other users might face the same issue. Seems to be a tough one.
I have a few others using it with no issues, some voice component some not, no issues similar to this reported.
Repeat working means the squeezebox method is working as well. The immediate stop when using a play command is because we tried to queue nothing and that's what we got. If you try to add album in a running player, the player will likely continue playing.
I will review everything written here and see if we can figure this out. Sure it's going to be something fairly straight forward.
In the meantime perhaps one last test. In a shell can you run the following script with an album / artist that you have in your local lms database. Please note the underscores:
# bash qry_alb.sh _supertramp _breakfast_in_america
and send me the result. If the sensors are created let me know as well. They should be sensor.art_id and sensor.alb_id
Thanks ynot
pi@raspberrypi:/usr/share/hassio/homeassistant/shell $ bash qry_alb.sh _fritz_kalkbrenner _ways_over_water
Artists are: artists 0 20 search%3A_fritz_kalkbrenner tags%3Aa id%3A25 artist%3AFritz%20Kalkbrenner count%3A1
Artist check zero is: 1
Artist found so moving on to albums....
Album check zero is: 1
Albums are: albums 0 20 artist_id%3A25 search%3A_ways_over_water tags%3Aal id%3A1 album%3AWays%20Over%20Water artist%3AFritz%20Kalkbrenner count%3A1
Artist ID is:25 Album ID is: 1 now Posting results
{"attributes": {}, "context": {"id": "981b9e49319d4baeb9c849422f1458ff", "user_id": null}, "entity_id": "sensor.art_id", "last_changed": "2018-08-10T21:36:41.830545+00:00", "last_updated": "2018-08-10T21:36:41.830545+00:00", "state": "25"} {"attributes": {}, "context": {"id": "9a54753c7c1f47aa87e00bcec96da87b", "user_id": null}, "entity_id": "sensor.art_id", "last_changed": "2018-08-10T21:36:42.264048+00:00", "last_updated": "2018-08-10T21:36:42.264048+00:00", "state": "1"}
In the logbook there is only the art id 1 but no alb_id
Just replied to your email as well - the Call Service command works!
ok. looking at the result from the shell command the shell script is working when querying LMS. But you have a TYPO. The 2nd last line (70) in the qry_alb.sh script is supposed to say:
curl -X POST -d '{"state":"'"${alb_id}"'"}' https://HA_Link.duckdns.org/api/states/sensor.alb_ID?api_password=HA_API_Password
That's why the sensor did not show up. The source code is OK I checked. Looks like it may be copy of the line above for art_id.
Once this is fixed, try the HA GUI with player=mediaroom, source=lms, artist=fritz kalkbrenner, album=ways over water and see if it works.
Hm not sure where the TYPO is? This is my qry_alb.sh:
curl -X POST -d '{"state":"'"${art_id}"'"}' https://XXX.duckdns.org/api/states/sensor.art_ID?api_password=XXX echo curl -X POST -d '{"state":"'"${alb_id}"'"}' https://XXX.duckdns.org/api/states/sensor.art_ID?api_password=XXX echo
https://XXX.duckdns.org/api/states/sensor.art_ID?api_password=XXX should be alb_ID in the 2bd last line
Okay this is definitely embarrassing.. It was a typo in all shell scripts. I corrected them all and it is working now. Thanks so much for your support. All functions are working now and this is so cool!! :)
OK, I will close this issue and will fix the duplicate script Alias description (should say Script Do Nothing).
Hi ynot123,
I really appreciate your work and effort in developing LMC_Controls. I tried to install it on a Raspberry Pi 3 (Raspbian/Debian 9; Home Assistant 0.75.2 using Docker). The LMS runs on the same machine (version 7.9.1). I can control the volume, shuffle, repeat, pause, play using the Home assistant web interface (no voice yet) but as soon as I use any of the LMS commands (e.g. Play Artist) the player stops playing the music and is blank:
Any ideas?
Thanks, cho0p