Page 16 of 21

Re: Logitech Media Server

Posted: Saturday 10 March 2018 20:41
by capman
I have trying to use your script a couple of times. I thought that it must be installed on thesame machine where domoticz was installed.
In my case that was my NAS. But I had trouble with the 'cpan' module and also 'make'. So the second I did was to install it on my pi where
the lms was installed on. The installation was succesfull but when I executed the programme nothing happens.
But how can the script access another computer ? These are all secured by a password and username ?

Re: Logitech Media Server

Posted: Sunday 11 March 2018 13:17
by capman
I give up for now :( I tryed your script , but still no luck. Maybe it's because I have not actualy a squeezebox , but some rpi with squeezelite as players.
I set the debug on 1 but no logging in my domoticz. Maybe I must learn perl scripting :D :geek:

Re: Logitech Media Server

Posted: Monday 19 March 2018 18:20
by philchillbill
The LMS software has a web front-end that you can access from any machine on your network, usually on port 9000. You can click on various buttons and LMS will start/stop players, show you library contents, etc. No passwords required. My script just emulates somebody clicking in a browser by sending JSON RPC commands to LMS from perl. No magic here.

The script as listed in the wiki is a bunch of subroutines and they need to be called from something. Running them on their own will just exit silently. You should create a tiny perl program that calls one of the subroutines using &squeezealert. To test you can just add a call at the end of the file and run it. The wiki even shows 2 examples of this.

Edit: I've now done this - see update a few posts down

Re: Logitech Media Server

Posted: Tuesday 20 March 2018 11:35
by Eoreh
capman wrote: Sunday 11 March 2018 13:17 I give up for now :( I tryed your script , but still no luck. Maybe it's because I have not actualy a squeezebox , but some rpi with squeezelite as players.
I set the debug on 1 but no logging in my domoticz. Maybe I must learn perl scripting :D :geek:
You can try write easy script in dzVents which in version 2.4 support LMS. see doc
https://www.domoticz.com/wiki/DzVents:_ ... dia_Server

Re: Logitech Media Server

Posted: Wednesday 21 March 2018 12:29
by nanokatz
Hello All;

I've started using LMS for my audio needs and love that domoticz has the support for it. However I cannot find a away to access the current artist/album/title etc data from dzevents or such. Is this possible with the current module?
Basically I just want to update another device with data from a squeezebox to show whats playing.

Re: Logitech Media Server

Posted: Thursday 22 March 2018 18:00
by philchillbill
If you use a json devices call to the idx of the player, the returned data includes what's now playing:

e.g. http://192.168.178.12:8080/json.htm?typ ... es&rid=547

Code: Select all

{
   "ActTime" : 1521737888,
   "AstrTwilightEnd" : "20:48",
   "AstrTwilightStart" : "04:42",
   "CivTwilightEnd" : "19:27",
   "CivTwilightStart" : "06:03",
   "DayLength" : "12:18",
   "NautTwilightEnd" : "20:07",
   "NautTwilightStart" : "05:23",
   "ServerTime" : "2018-03-22 17:58:08",
   "SunAtSouth" : "12:05",
   "Sunrise" : "06:36",
   "Sunset" : "18:54",
   "result" : [
      {
         "AddjMulti" : 1.0,
         "AddjMulti2" : 1.0,
         "AddjValue" : 0.0,
         "AddjValue2" : 0.0,
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "High Noon at Salinas - Priority Pass (Extended Mix) (2017)",
         "Description" : "",
         "Favorite" : 0,
         "HardwareID" : 4,
         "HardwareName" : "LMS",
         "HardwareType" : "Logitech Media Server",
         "HardwareTypeVal" : 60,
         "HaveDimmer" : true,
         "HaveGroupCmd" : true,
         "HaveTimeout" : false,
         "ID" : "000001F",
         "Image" : "Light",
         "IsSubDevice" : false,
         "LastUpdate" : "2018-03-22 17:58:07",
         "Level" : 0,
         "LevelInt" : 0,
         "MaxDimLevel" : 15,
         "Name" : "SQ-Office",
         "Notifications" : "false",
         "PlanID" : "0",
         "PlanIDs" : [ 0 ],
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : "-",
         "Status" : "Playing",
         "StrParam1" : "",
         "StrParam2" : "",
         "SubType" : "AC",
         "SwitchType" : "Media Player",
         "SwitchTypeVal" : 17,
         "Timers" : "false",
         "Type" : "Lighting 2",
         "TypeImg" : "LogitechMediaServer",
         "Unit" : 1,
         "Used" : 1,
         "UsedByCamera" : false,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "547"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}

Re: Logitech Media Server

Posted: Friday 23 March 2018 11:36
by nanokatz
I am aware of the json data that is available. However the issue I have is that it returns just one string with the artist/track. I would rather have a way to access more of the raw data as separate strings. Obviously I can do this by bypassing domoticz and accessing the data from the LMS directly but would be nice to keep things in one place for me.

Another issue is that the LMS type doesn't seem to return events when the track changes only on play/stop (but that is a much smaller issue for me)
philchillbill wrote: Thursday 22 March 2018 18:00 If you use a json devices call to the idx of the player, the returned data includes what's now playing:

e.g. http://192.168.178.12:8080/json.htm?typ ... es&rid=547

Re: Logitech Media Server

Posted: Saturday 24 March 2018 15:48
by philchillbill
capman wrote: Sunday 11 March 2018 13:17 I give up for now :( I tryed your script , but still no luck. Maybe it's because I have not actualy a squeezebox , but some rpi with squeezelite as players.
I set the debug on 1 but no logging in my domoticz. Maybe I must learn perl scripting :D :geek:
I've rewritten the WIKI entry on alerts to include a full how-to for non-programmers. The perl is now wrapped in bash to make it a standalone script rather than just a library element. I'm curious if the instructions are now clear enough so if not, please PM me so I can modify.

https://www.domoticz.com/wiki/Logitech_ ... ox_Players

While I was at it, I modified the original script to allow playing on multiple players using threads and I stripped the log entries because kicking off a script will make those anyway.

Re: Logitech Media Server

Posted: Sunday 25 March 2018 20:24
by philchillbill
The LMS wiki just got 2 new sections with scripts that can be used to transfer playlists between players and to sync/unsync groups of players at the push of a Domoticz switch :D

https://www.domoticz.com/wiki/Logitech_ ... ng_Players

and

https://www.domoticz.com/wiki/Logitech_ ... of_Players

Re: Logitech Media Server

Posted: Sunday 25 March 2018 22:34
by pvm
philchillbill wrote: Sunday 25 March 2018 20:24 The LMS wiki just got 2 new sections with scripts that can be used to transfer playlists between players and to sync/unsync groups of players at the push of a Domoticz switch :D

https://www.domoticz.com/wiki/Logitech_ ... ng_Players

and

https://www.domoticz.com/wiki/Logitech_ ... of_Players
Nice, I especially like the syncing, do you know how to do this on a synology nas without SSH access?

Re: Logitech Media Server

Posted: Sunday 25 March 2018 22:55
by philchillbill
pvm wrote: Sunday 25 March 2018 22:34 Nice, I especially like the syncing, do you know how to do this on a synology nas without SSH access?
What exactly do you mean by 'do this on a Synology NAS'? You mean install the perl scripts on Synology? That's a real pain due to CPAN issues. If you have your LMS on Synology (as I do) but run Domoticz on something with Raspbian or Ubuntu, the scripts will still work across your network. Can you clarify your exact question?

Re: Logitech Media Server

Posted: Monday 26 March 2018 0:37
by pvm
philchillbill wrote:
pvm wrote: Sunday 25 March 2018 22:34 Nice, I especially like the syncing, do you know how to do this on a synology nas without SSH access?
What exactly do you mean by 'do this on a Synology NAS'? You mean install the perl scripts on Synology? That's a real pain due to CPAN issues. If you have your LMS on SYnology (as I do) but run Domoticz on something with Raspbian or Ubuntu, the scripts will still work across your network. Can you clarify your exact question?
Clear answer, I'll install it on a raspberry pi and make it a slave of my synology nas/domoticz . The pi remains a nice platform to do these kind of scripts. Thanks again for the effort put into the script, I tried doing this once using browser inspecting calls but did not manage

Re: Logitech Media Server

Posted: Monday 26 March 2018 14:00
by philchillbill
pvm wrote: Monday 26 March 2018 0:37 Clear answer, I'll install it on a raspberry pi and make it a slave of my synology nas/domoticz . The pi remains a nice platform to do these kind of scripts. Thanks again for the effort put into the script, I tried doing this once using browser inspecting calls but did not manage
Thanks. I've just added a Resources section to the wiki that gives an example of doing JSON RPC from bash/curl which would run OK on a Synology (I tested it) without installing anything. If you feel like coding it up, you'd just have to convert the perlish procedure calls to bashish ones in the same way...

https://www.domoticz.com/wiki/Logitech_ ... #Resources

Re: Logitech Media Server

Posted: Tuesday 27 March 2018 21:34
by philchillbill
For anybody using the Audio Alerts via Squeezebox script, I've just posted a second version of the script in the wiki that assembles temporary syncgroups to play the Alerts on multiple players at the same time without echos around the house. If you don't habitually use your own player groups this is the way to go. If you do then stick with the threaded version of the script as the second version will mess up your groups after an alert.

https://www.domoticz.com/wiki/Logitech_ ... ox_Players

Any issues, let me know.

Re: Logitech Media Server

Posted: Friday 30 March 2018 15:19
by philchillbill
I found a way for a script being executed using script:// in Domoticz to kick off a script on a remote machine (using ssh and stored keys). This means that Synology users can keep everything else on their NAS and run only the perl scripts from the wiki on a pi or other perl-friendly machine. The wiki has been modified to explain how it's done.

Let me know if there are any problems or if any of the explanations are unclear.

Phil

Re: Logitech Media Server

Posted: Monday 02 April 2018 9:57
by philchillbill
OK, here's a really cool script for LMS control. It announces the now-playing title and artist through a squeezebox itself, using the female Amazon Polly English-language voice 'Amy'. It's written up fully in the wiki (link below). There's also a demo youtube video here:

https://youtu.be/NxqP8lu8LnA

Wiki link:

https://www.domoticz.com/wiki/Logitech_ ... _Polly_TTS

Phil

Re: Logitech Media Server

Posted: Sunday 06 May 2018 10:09
by zicht
Hi All, I need a little help

I have LMS setup for a while and integrated in domoticz. Worked very well till a couple of days ago.
LMS - Chromcats bridge - 5 Chromecast audio devices --> Domoticz

In hardware the setup reports

Code: Select all

34	Beneden	cc:cc:0d:b1:xx:xx	Active
33	Woonkamerr	cc:cc:09:f5:xx:xx	Active
32	Slaapk 1e achter	cc:cc:09:f5:xx:xx	Active
31	Slaapk 1e voor	cc:cc:09:f5:xx:xx	Active
30	Anders	cc:cc:09:f5:xx:xx	Active
So that seems fine.In the log I see messages from LMS comming in.

Code: Select all

                                      Logitech Media Server: Worker started...
2018-05-06 10:04:18.852 Logitech Media Server: 9 player-switch(es) found.
2018-05-06 10:04:18.867 Logitech Media Server: No playlists found.
2018-05-06 10:04:19.977 Logitech Media Server: 9 connected player(s) found.
2018-05-06 10:04:20.743 Logitech Media Server: (Woonkamerr) Stopped - 'Lumidee featuring Pitbull - Crazy (2007)'
2018-05-06 10:04:20.868 Logitech Media Server: (Werkkamer) Stopped - '(empty playlist)'

2018-05-06 10:05:55.199 Logitech Media Server: (Woonkamerr) Playing - 'Lumidee featuring Pitbull - Crazy (2007)'
But on the switches page in domoticz the devices linked to the logitech devices stay off with svalue message unavailable. This does not update anymore.So internally in domoticz the info is retrieved from LMS but not set into the switches svalues ?

Code: Select all

	1509	LMS	0000021	49	Woonkamerr	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:54
  	1510	LMS	0000022	49	Beneden	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:54
  	1503	LMS	000001B	49	Werkkamer	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:53
  	1504	LMS	000001C	49	Boven	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:53
Any smart guys over here who know how to solve this ? Probably it is something i am overlooking.
It worked fine for months --> Updated domoticz introduced it, allreayd rolled back to working version but problem stays.

Many thanks

Re: Logitech Media Server

Posted: Sunday 06 May 2018 21:37
by zicht
zicht wrote: Sunday 06 May 2018 10:09 Hi All, I need a little help

I have LMS setup for a while and integrated in domoticz. Worked very well till a couple of days ago.
LMS - Chromcats bridge - 5 Chromecast audio devices --> Domoticz

In hardware the setup reports

Code: Select all

34	Beneden	cc:cc:0d:b1:xx:xx	Active
33	Woonkamerr	cc:cc:09:f5:xx:xx	Active
32	Slaapk 1e achter	cc:cc:09:f5:xx:xx	Active
31	Slaapk 1e voor	cc:cc:09:f5:xx:xx	Active
30	Anders	cc:cc:09:f5:xx:xx	Active
So that seems fine.In the log I see messages from LMS comming in.

Code: Select all

                                      Logitech Media Server: Worker started...
2018-05-06 10:04:18.852 Logitech Media Server: 9 player-switch(es) found.
2018-05-06 10:04:18.867 Logitech Media Server: No playlists found.
2018-05-06 10:04:19.977 Logitech Media Server: 9 connected player(s) found.
2018-05-06 10:04:20.743 Logitech Media Server: (Woonkamerr) Stopped - 'Lumidee featuring Pitbull - Crazy (2007)'
2018-05-06 10:04:20.868 Logitech Media Server: (Werkkamer) Stopped - '(empty playlist)'

2018-05-06 10:05:55.199 Logitech Media Server: (Woonkamerr) Playing - 'Lumidee featuring Pitbull - Crazy (2007)'
But on the switches page in domoticz the devices linked to the logitech devices stay off with svalue message unavailable. This does not update anymore.So internally in domoticz the info is retrieved from LMS but not set into the switches svalues ?

Code: Select all

	1509	LMS	0000021	49	Woonkamerr	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:54
  	1510	LMS	0000022	49	Beneden	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:54
  	1503	LMS	000001B	49	Werkkamer	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:53
  	1504	LMS	000001C	49	Boven	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:53
Any smart guys over here who know how to solve this ? Probably it is something i am overlooking.
It worked fine for months --> Updated domoticz introduced it, allreayd rolled back to working version but problem stays.

Many thanks
Solved by disabling firewall, so remaining question : what port numbers are used. 9000 and apperently some other ports ??

Re: Logitech Media Server

Posted: Wednesday 09 May 2018 0:06
by philchillbill
zicht wrote:
zicht wrote: Sunday 06 May 2018 10:09 Hi All, I need a little help

I have LMS setup for a while and integrated in domoticz. Worked very well till a couple of days ago.
LMS - Chromcats bridge - 5 Chromecast audio devices --> Domoticz

In hardware the setup reports

Code: Select all

34	Beneden	cc:cc:0d:b1:xx:xx	Active
33	Woonkamerr	cc:cc:09:f5:xx:xx	Active
32	Slaapk 1e achter	cc:cc:09:f5:xx:xx	Active
31	Slaapk 1e voor	cc:cc:09:f5:xx:xx	Active
30	Anders	cc:cc:09:f5:xx:xx	Active
So that seems fine.In the log I see messages from LMS comming in.

Code: Select all

                                      Logitech Media Server: Worker started...
2018-05-06 10:04:18.852 Logitech Media Server: 9 player-switch(es) found.
2018-05-06 10:04:18.867 Logitech Media Server: No playlists found.
2018-05-06 10:04:19.977 Logitech Media Server: 9 connected player(s) found.
2018-05-06 10:04:20.743 Logitech Media Server: (Woonkamerr) Stopped - 'Lumidee featuring Pitbull - Crazy (2007)'
2018-05-06 10:04:20.868 Logitech Media Server: (Werkkamer) Stopped - '(empty playlist)'

2018-05-06 10:05:55.199 Logitech Media Server: (Woonkamerr) Playing - 'Lumidee featuring Pitbull - Crazy (2007)'
But on the switches page in domoticz the devices linked to the logitech devices stay off with svalue message unavailable. This does not update anymore.So internally in domoticz the info is retrieved from LMS but not set into the switches svalues ?

Code: Select all

	1509	LMS	0000021	49	Woonkamerr	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:54
  	1510	LMS	0000022	49	Beneden	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:54
  	1503	LMS	000001B	49	Werkkamer	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:53
  	1504	LMS	000001C	49	Boven	Lighting 2	AC	Unavailable	-	-	Lamp/schakelaar toevoegenNaam wijzigen Log	2018-05-05 22:33:53
Any smart guys over here who know how to solve this ? Probably it is something i am overlooking.
It worked fine for months --> Updated domoticz introduced it, allreayd rolled back to working version but problem stays.

Many thanks
Solved by disabling firewall, so remaining question : what port numbers are used. 9000 and apperently some other ports ??
UDP 3483 is used for server discovery.


Sent from my iPhone using Tapatalk

Re: Logitech Media Server

Posted: Wednesday 09 May 2018 1:23
by Thunderbolt
I have the same issue
But on the switches page in domoticz the devices linked to the logitech devices stay off with svalue message unavailable. This does not update anymore.So internally in domoticz the info is retrieved from LMS but not set into the switches svalues ?
Domoticz is running on raspberry pi, so no firewall there. Noticed it today, so not sure, when it started.