Logitech Media Server

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Logitech Media Server

Post by Nautilus »

simon_rb wrote:This is my script. It turns the switch off every minute, even if I don't change it. What do I have to add for the If device changes you mentioned earlier and that it only turns it off. Doesn't actually change the percentage on the device. Appreciate all your help with this!

Code: Select all

commandArray = {}
    json = (loadfile '/home/pi/domoticz/scripts/lua/json.lua')()
    file = assert(io.popen('curl \'http://192.168.1.26:9000/jsonrpc.js\' --data-binary \'{"id":1,"method":"slim.request","params":["00:04:20:23:88:36",["status","-","1",""]]}\''))   
    
    raw = file:read('*all')
    file:close()   
    deviceinfo = json:decode(raw)
    volume = deviceinfo.result["mixer volume"]
    print(tostring(volume))
    commandArray['UpdateDevice'] = '265|0|' .. volume

return commandArray
Well, you need to read the current switch status first with something like:

Code: Select all

switchvolume = otherdevices_svalues['Switch Name']
then compare this to current volume and do something only if they differ:

Code: Select all

if tonumber(switchvolume) ~= tonumber(volume) then
    your command here
end
You need to be aware that different dimmer types have different number of step (16, 32, 100), so check what is the "svalues" when you put the dimmer to 100% brightness. Ideally you should use dimmer type with which it is 100 (and not 32 or 16). I haven't played much with those so you need to figure it out yourself or maybe someone here can help more with those. Also, it probably does not accept the decimal so you need to convert the result to whole number somehow. But I think you are getting there... 8-)
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Logitech Media Server

Post by simon_rb »

I am spending too long on this and giving me a headache. Its well beyond my skills. I think I will give this a miss. Thank you for taking the time to guide me this far. Maybe when I get more time I may come back to it. I need to improve my skills a before I attempt this again.

Cheers!!! :D
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Logitech Media Server

Post by Nautilus »

simon_rb wrote:I am spending too long on this and giving me a headache. Its well beyond my skills. I think I will give this a miss. Thank you for taking the time to guide me this far. Maybe when I get more time I may come back to it. I need to improve my skills a before I attempt this again.

Cheers!!! :D
Yeah, take your time. I think you have pretty much all the pieces together to make it work but when you spend too much time on one thing it can all become a bit blurry (been there :D ). In that case I also see it as best choice to try something else for a while and then come back to it a bit later - it may feel a lot simpler then :)
Pierryck
Posts: 24
Joined: Saturday 27 February 2016 20:39
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Logitech Media Server

Post by Pierryck »

Hi,

I have installed LMS and piCorePlayer.
Now I'm trying a write a script to manage LMS but it doesn't work as it should.

The play of Favorites works fine with this command:
commandArray['HP Salon']='Play Favorites'

The play of any playlist do not work.
For example:
commandArray['HP Salon']='Play Playlist Pop' for the playlist named Pop stop the music and there is nothing to hear and no error message in the Domoticz log.

commandArray['HP Salon']='Play Playlist PopWrong' does nothing but there is an error message in Domoticz log: Play List 'PopWrong' not found
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Logitech Media Server

Post by Nautilus »

Has anyone tried whether there's any issues to come if you change the name of the player switch in Domoticz (and only there, not in LMS). I tried it and so far so good. Just wondering how it determines there is a new player to be added and then what is the link between the player in Domoticz (whose name has changed) and in LMS, mac address?
Sneezydevil
Posts: 111
Joined: Monday 18 January 2016 9:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Logitech Media Server

Post by Sneezydevil »

It used to be Name / IP, but now its indeed MAC address based:

From the code:

Code: Select all

Check on MacAddress (default); Update Name in case it has been changed
So it might change the name back if the comment is correct.
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Logitech Media Server

Post by Nautilus »

Sneezydevil wrote:It used to be Name / IP, but now its indeed MAC address based:

From the code:

Code: Select all

Check on MacAddress (default); Update Name in case it has been changed
So it might change the name back if the comment is correct.
Right, there seems to be bunch of different condition for checking if something has changed and if not, then add a new player. But for some reason it does not change it back or add a new player at least in this case that I've just renamed the switch. Maybe the LMS name is stored in DB as well and that needs to change for something to happen?

Btw, I took a new iPhone in use and noticed that it cannot be added to Domoticz as a player anymore, the log just says:
2016-11-02 00:33:11.073 Error: EventSystem: Could not determine switch type for event device [iPhone_name_here]

it also reports it's status (even if it cannot be seen as a device):
2016-11-02 00:26:06.259 Logitech Media Server: ([iPhone_name_here]) On
2016-11-02 00:26:36.588 Logitech Media Server: ([iPhone_name_here]) Stopped - '(empty playlist)'

the model is still the same (iPengiPod).
qwerk
Posts: 222
Joined: Tuesday 22 July 2014 7:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Netherlands
Contact:

Re: Logitech Media Server

Post by qwerk »

I hope this is also the place for request.
I would really like the possibility to synchronize players.
So I can turn 2 or more players on in a lua script and let them play the same music.

thanks in advance
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Logitech Media Server

Post by Nautilus »

qwerk wrote:I hope this is also the place for request.
I would really like the possibility to synchronize players.
So I can turn 2 or more players on in a lua script and let them play the same music.

thanks in advance
Do you mean you normally keep them unsynced but you'd like to be able to sync them in certain cases with the help of a Lua script?
qwerk
Posts: 222
Joined: Tuesday 22 July 2014 7:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Netherlands
Contact:

Re: Logitech Media Server

Post by qwerk »

Nautilus wrote:
qwerk wrote:I hope this is also the place for request.
I would really like the possibility to synchronize players.
So I can turn 2 or more players on in a lua script and let them play the same music.

thanks in advance
Do you mean you normally keep them unsynced but you'd like to be able to sync them in certain cases with the help of a Lua script?

that is correct,
normally we use them seperately (spelling ?) but I would like to sync sometimes
bellissimo
Posts: 15
Joined: Saturday 18 October 2014 18:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Logitech Media Server

Post by bellissimo »

I just got an Echo and am very interested in controlling LMS by voice. I already have the Ha-Bridge set up so I can trigger switches in Domoticz using Alexa.

While I can see there are a handful of commands you can set up using this plugin (e.g. Start, Stop), what I want to do is say to Alexa for example:

'Alexa, Turn on Radio 6'

and have a Group in Alexa that does the following:
  1. Turn on the Squeezebox
  2. Turn on the Amplifier
  3. Start Playing BBC Radio 6 on the Lounge Player
The first two I can manage using the Harmony Hub. However I don't know how to turn on a radio station (this is done via the BBC iPlayer app in LMS) for a particular player. Any ideas?
bellissimo
Posts: 15
Joined: Saturday 18 October 2014 18:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Logitech Media Server

Post by bellissimo »

I spent some time with Wireshark and managed to extract the command for a radio station. This turned out to be a direct HTML call, something a bit like:

http://192.168.0.99:9000/anyurl?p0=playlist&p1=play&p2=...

So I added this as a new switch in Domoticz. For some reason it did not accept the above in the 'On URL' so I had to faff around some more to call it via a script instead. I can confirm however that this does work and changes the radio station nicely. I can now automate this using Alexa. The following JSON will stop the stream playing if you call it uing curl

Code: Select all

url = 'http://192.168.0.99:9000/jsonrpc.js' 
data = '{"id":1,"method":"slim.request","params":["xx:xx:xx:xx:xx:xx",["pause"]]}'
where xx:xx.. is the Mac address of the player
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Logitech Media Server

Post by Nautilus »

qwerk wrote:

that is correct,
normally we use them seperately (spelling ?) but I would like to sync sometimes
Ok, well I've never needed that but google for squeezebox cli sync (or squeezebox json sync) and hopefully there are some examples that will help you achieve the needed through some lua script for example.
jorns
Posts: 6
Joined: Tuesday 14 January 2014 15:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Logitech Media Server

Post by jorns »

Nice work.

Really looking forward to timers are implemeted.
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Logitech Media Server

Post by Nautilus »

bellissimo wrote:I spent some time with Wireshark and managed to extract the command for a radio station. This turned out to be a direct HTML call, something a bit like:

http://192.168.0.99:9000/anyurl?p0=playlist&p1=play&p2=...

So I added this as a new switch in Domoticz. For some reason it did not accept the above in the 'On URL' so I had to faff around some more to call it via a script instead. I can confirm however that this does work and changes the radio station nicely. I can now automate this using Alexa. The following JSON will stop the stream playing if you call it uing curl

Code: Select all

url = 'http://192.168.0.99:9000/jsonrpc.js' 
data = '{"id":1,"method":"slim.request","params":["xx:xx:xx:xx:xx:xx",["pause"]]}'
where xx:xx.. is the Mac address of the player
Here's a nice table for various p0-4 options you can use with LMS: http://tutoriels.domotique-store.fr/con ... -http.html

So you can for example toggle pause simply by http://url/status.html?p0=pause
Last edited by Nautilus on Friday 11 November 2016 13:30, edited 1 time in total.
bellissimo
Posts: 15
Joined: Saturday 18 October 2014 18:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Logitech Media Server

Post by bellissimo »

Brilliant, thanks. I was looking for something like that, but had to piece what I had together from various snippets on the LMS forums.
kllngtme
Posts: 47
Joined: Tuesday 14 June 2016 16:56
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: East Coast, USA
Contact:

Re: Logitech Media Server

Post by kllngtme »

Maybe i misunderstood but should the icons already be in Domoticz to select from? I thought I read this was added to one of the updates.

Do I still need to add my set via Setup>More Options>Custom Icons ?
toreandre
Posts: 91
Joined: Tuesday 19 January 2016 12:51
Target OS: -
Domoticz version:
Contact:

Re: Logitech Media Server

Post by toreandre »

Does anyone know what this logitech error in the Domoticz log comes from?
2017-02-16 19:24:11.168 Error: EventSystem: Could not determine switch type for event device <playername>
I also have 3 players with the same name in the logitech hardware list, two of them has 00:00:00:00:00:00 as mac adress.
dgonneau
Posts: 7
Joined: Tuesday 16 February 2016 15:01
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Logitech Media Server

Post by dgonneau »

Hi,

I'm using latest beta on Synology and after successfully setting up LMS and a bluetooth speaker connected to a rasp3 with SquezeLite I'm trying to get Domoticz to send audio notifications via tts.
Is there any plan to add that to domoticz ?
In the notification settings I saw the LMS option but it seems to be only visual notifications ? or are they audio + visual ?
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Logitech Media Server

Post by Nautilus »

dgonneau wrote:Hi,

I'm using latest beta on Synology and after successfully setting up LMS and a bluetooth speaker connected to a rasp3 with SquezeLite I'm trying to get Domoticz to send audio notifications via tts.
Is there any plan to add that to domoticz ?
In the notification settings I saw the LMS option but it seems to be only visual notifications ? or are they audio + visual ?
This would be very nice but I doubt there is much interest for anyone to start the development. I have though about hacking something together with izsynth (search the forum) which I already have running and e.g. https://www.domoticz.com/forum/viewtopic.php?t=15188 so that first the tts audio file would be copied to the location where LMS will pick it up and play it. But haven't yet done anything to actually piece these together...:)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest