Logitech Squeezeserver + Android + Pebble = <3 !
I'm one of the (very) proud owners of a Pebble smartwatch, and a Nexus 4 running Android Lollipop. For those who don't know this brilliant smartwatch, check here. In a way you could consider it to be an extension, a 2nd screen, and/or a remote to your phone.One of the first things I thought of doing with it, was to control my Logitech Squeezebox Radio with it: louder, next track, different station, etc.
It seemed to be a no-brainer, but apparently not too many people came up with this idea. After some research, reading forums, looking through documentations, I noticed most people got this working using a third party app.
I already have Squeeze Commander and Tasker on my phone, so I didn't want another app like Orange Squeeze or AutoSqueeze.
I have some experience in all sorts of aspects of the IT-world: I have Tasker on my phone, PebbleTasker on the watch, Logitech server running on my Synology NAS, and the radio in the living room. I knew the server has a web-interface, I figured it shoud have a command line interface, and maybe, just maybe, might be able to accept simple http-commands, and I didn't want to use any other apps if possible.
It was this last thing I was hoping for. Why? It's fairly easy to set up Tasker to go to a webpage. It's even easier to have your watch trigger Tasker's tasks. So 1 + 1 = "Pebble to radio remote control".
Yey for friendly documenters!
After I did some digging in how the Logitech server works, I stumbled upon this webpage: http://tutoriels.domotique-store.fr/content/54/95/fr/api-logitech-squeezebox-server-_-player-http.htmlIt has a lot of information on the parameters and the return-values of the Logitech server, and I can't thank the author enough for sharing!
After I found this, I started experimenting on the URL's. I don't bother with users and logins, since I'm the only one using the server, so basically URL > command > action is sufficient.
You can find some examples below, where <ip-address:port> should be the IP-address and port of your server, like "192.168.0.123:9080". It also has support for multiple players. In all my URLs I added the player ID, which basically is the MAC-address of the player you want to control. You can find this in the settings-page of the server, under the information tab.
In the http-URL, you can pass up to 5 paramters (p0-p4). I've noticed that using button-codes where possible work better than the documented paramters. The default button codes will me listed below, and you could consider them like being fysical buttons on a remote. So basically you pass the first parameter saying you want to press a button, and the second parameter you tell it which button you pressed. The last 'player'-paramter is the player-ID
So, examples:
Volume +5:http://<ipaddress:port>/status.html?p0=mixer&p1=volume&p3=%2B5&player=<playerID>
Volume -5:
http://<ipaddress:port>/status.html?p0=mixer&p1=volume&p3=-5&player=<playerID>
Turn off:
http://<ipaddress:port>/status.html?p0=button&p1=power&player=<playerID>
Start to play, even when off:
http://<ipaddress:port>/status.html?p0=button&p1=play&player=<playerID>
Play preset 2:
http://<ipaddress:port>/status.html?p0=button&p1=playPreset_2&player=<playerID>
Skip to next track:
http://<ipaddress:port>/status.html?p0=button&p1=fwd.single&player=<playerID>
Last part: Tasker (& PebbleTasker)
Now that you know which URLs you want to use, start making tasks for them in Tasker!It couldn't be more straightforward: New task > Add Action > Net > HTTP Get. In the field of 'Server:Port:, you put the URL you tested earlier. Run the task, and it shouldn't cause any problems.
Beware, as I said before: I don't have any users created on the Logitech server, so if you do, you might need to look into that. Maybe a simple http://user:password@192.168.1.123:9999 might work?
Now, in PebbleTasker, assign a button to the task, et voila! (tip:you can assign 2 tasks to the top and bottom buttons: short press & long press!)
My setup:
Top: Louder / On
Center: Presets (goes to new menu, Tasker task that repopulates the PebbleTasker menu with new entries)
Bottom: Quieter / Off
Presets-menu:
Top: Preset 1 / 4
Center: (nothing yet)
Bottom: Preset 3 / 6
My long-press-center-button brings up a quick menu, there I have a 'Close' task, which resets the PebbleTasker menu to defaults and exits the watchapp.
Closing & buttons
I hope any of you could find this helpful. I spent a while digging through forums and what-not, so I wanted to share what I learned in an easy and comprehensible way.
Feel free to ask any questions in the comments below!
[common]
# Button functions that are common to all modes (unless overridden)
0 = numberScroll_0
1 = numberScroll_1
2 = numberScroll_2
3 = numberScroll_3
4 = numberScroll_4
5 = numberScroll_5
6 = numberScroll_6
7 = numberScroll_7
8 = numberScroll_8
9 = numberScroll_9
0.hold = preset_0
1.hold = preset_1
2.hold = preset_2
3.hold = preset_3
4.hold = preset_4
5.hold = preset_5
6.hold = preset_6
7.hold = preset_7
8.hold = preset_8
9.hold = preset_9
0.hold_release = preset_release0
1.hold_release = preset_release1
2.hold_release = preset_release2
3.hold_release = preset_release3
4.hold_release = preset_release4
5.hold_release = preset_release5
6.hold_release = preset_release6
7.hold_release = preset_release7
8.hold_release = preset_release8
9.hold_release = preset_release9
arrow_down = down
arrow_down.repeat = down_repeat
knob_right = down
knob_right.repeat = down_repeat
arrow_left = left
arrow_left.hold = home
arrow_right = right
knob_push = right
arrow_up = up
arrow_up.repeat = up_repeat
knob_left = up
knob_left.repeat = up_repeat
rew.single = jump_rew
rew.hold = song_scanner
brightness_down = brightness_down
brightness_up = brightness_up
brightness.single = brightness_toggle
brightness.hold = dead
brightness = dead
fwd.single = jump_fwd
fwd.hold = song_scanner
format = titleFormat
muting = muting
pause.single = pause
pause.hold = stop
play.single = play
play.hold = play
power = power_toggle
power_front = power_toggle
power_front.hold = dead
power_front.repeat = dead
power_off = power_off
power_on = power_on
add.single = add
add.hold = dead
sleep.single = sleep
sleep.hold = sleep
snooze.single = snooze
snooze.hold = sleep
stop = stop
voldown = volume
voldown.repeat = volume
volup = volume
volup.repeat = volume
volup_front = volume_front
volup_front.repeat = volume_front
voldown_front = volume_front
voldown_front.repeat = volume_front
pitchdown = pitch_down
pitchdown.repeat = pitch_down
pitchup = pitch_up
pitchup.repeat = pitch_up
bassdown = bass_down
bassdown.repeat = bass_down
bassup = bass_up
bassup.repeat = bass_up
trebledown = treble_down
trebledown.repeat = treble_down
trebleup = treble_up
trebleup.repeat = treble_up
volume = volume
volumemode = volumemode
home = home
preset_1.single = playPreset_1
preset_2.single = playPreset_2
preset_3.single = playPreset_3
preset_4.single = playPreset_4
preset_5.single = playPreset_5
preset_6.single = playPreset_6
preset_1.hold = favorites_add1
preset_2.hold = favorites_add2
preset_3.hold = favorites_add3
preset_4.hold = favorites_add4
preset_5.hold = favorites_add5
preset_6.hold = favorites_add6
# playing display modes
now_playing = playdisp_toggle
playdisp_none = playdisp_0
playdisp_et = playdisp_1
playdisp_rt = playdisp_2
playdisp_pb = playdisp_3
playdisp_pbet = playdisp_4
playdisp_pbrt = playdisp_5
# textsize modes
size = textsize_toggle
textsize_small = textsize_small
textsize_medium = textsize_medium
textsize_large = textsize_large
# shuffle modes
shuffle.single = shuffle_toggle
shuffle.hold = randomPlay
shuffle_off = shuffle_off
shuffle_on = shuffle_on
# repeat modes
repeat = repeat_toggle
repeat_off = repeat_0
repeat_one = repeat_1
repeat_all = repeat_2
# special buttons
browse = browse
search = globalsearch
favorites.single = favorites
favorites.hold = favorites_add
visual = visual_toggle
favorites_2.single = favorites
favorites_2.hold = favorites_add
now_playing_2 = playdisp_toggle
search_2 = globalsearch
# menu shortcuts
menu_playlist = menu_playlist
menu_browse_genre = menu_browse_genre
menu_browse_artist = menu_browse_artist
menu_browse_album = menu_browse_album
menu_browse_music = menu_browse_music
menu_search_artist = menu_search_artist
menu_search_album = menu_search_album
menu_search_song = menu_search_song
menu_browse_playlists = menu_browse_playlists
menu_plugins = menu_plugins
menu_home = menu_home
menu_settings = menu_settings
menu_pop = menu_pop
menu_now_playing = menu_now_playing
menu_synchronize = menu_synchronize
# digital input
digital_input_aes-ebu = modefunction_Slim::Plugin::DigitalInput::Plugin->aes-ebu
digital_input_bnc-spdif = modefunction_Slim::Plugin::DigitalInput::Plugin->bnc-spdif
digital_input_rca-spdif = modefunction_Slim::Plugin::DigitalInput::Plugin->rca-spdif
digital_input_toslink = modefunction_Slim::Plugin::DigitalInput::Plugin->toslink
# analog input
analog_input_line_in = modefunction_Slim::Plugin::LineIn::Plugin->linein
Geen opmerkingen:
Een reactie posten