Problems with configuration - Squeezebox-Binding

Now i´ve found a script which can do this.

Please can you tell me, how i can implement this into my number item?

I don´t use sitemap-configuration for every item, isimply show the whole group, so i can´t change the sitemap entrys, i will have to do this in items-file i think?

But my item for duration is a number-item.

So how can i combine the returned value from the script and my number item?

Is this not working and i have to change my sitemap to separate configuration of each item instead of showing only the whole group?

You can try the following.

  • Define your items like this.
Number PlayingTime "Playing Time [JS(mmss.js):%s]" { channel="squeezebox:squeezeboxplayer:36b70fd1:b827eb160000:currentPlayingTime" }
Number Duration    "Duration [JS(mmss.js):%s]"     { channel="squeezebox:squeezeboxplayer:36b70fd1:b827eb160000:duration" }
  • Install the Javascript transformation addon

  • Place a file named mmss.js in conf/transform that contains this

(function(i){ 
    var s = ~~(i%60);
    return (~~(i/60) + ':' + ((s < 10) ? '0' : '') + s);
})(input)

Hi, my squeezebox runs very smooth the last few months.

Only one problem: Sometimes, in openhab i can see in the logfile, that the commands to the squeezebox are sent. But i get no sound. I can connect to the squeezebox-client raspberry pi (max2play image) and make a reboot. Then the sound is back again.

I don´t know, how i can check, if the squeezebox-client (player software, not the raspberry at all) is still available?

Is there a way to check inside openhab with a rule, if the squeezebox player is still responding to openhab?

Or do you have another idea to find the problem?

The binding only talks to the LMS, not the players. Only the LMS talks to the players. You could try to find the port that the LMS uses to talk to the player, then use the network binding to send the player a transaction.

I have another idea for my squeezebox player and want to implement this:

I have a list of podcasts, the latest podcast is the latest news from a german radio station.

When i enter the bathroom in the morning, i want to hear the latest podcast.

I have a description from a german website, there it is working with a php-script, but i think it can be done with only openhab too.

Here is the adress of the website: https://www.forwardme.de/2017/10/12/openhab-aktuelle-radio-nachrichten-auf-knopfdruck-am-beispiel-deutschlandfunk/

Here is the php-script:

<?php
/**
 * Dieses Plugin lädt die aktuellsten Nachrichten des Radiosenders
 * Deutschlandfunk und setzt entsprechende Parameter so, dass diese 
 * abgespielt werden
 * 
 * Betroffene Parameter: $file
 * 
 * @return array
 */

function getPluginParams() {
 // Podcast-Stream vom Deutschlandfunk
 $url = 'http://www.deutschlandfunk.de/podcast-nachrichten.1257.de.podcast.xml';

// letzter Podcast auswerten, URL des MP3 extrahieren
 $xml = new SimpleXMLElement(file_get_contents($url));
 $file = $xml->channel->item[0]->link;
 return array('file' => (string) $file);
}

This script gives back a string with the podcast url and i want to give this string to my squeezebox.

Can anybody help me, how this can be done inside openhab or can someopne tell me, if this can be done?

Otherwise i will have to look for adapting the php-script to my needs…

How can i extract the latest podcast from the XML file?

Now i have the solution:

or

How can i play the mp3-url from inside openhab?

I know how to play a mp3-file, which is on my squeezebox-server.

command description
playStream(String url) plays an audio stream from an url to the default sink (set url to null if streaming should be stopped)
playStream(String sink, String url) plays an audio stream from an url to the given sink(s) (set url to null if streaming should be stopped)
1 Like

Thanks again, can you tell me, how i have to write the “String sink”?

I already tried the name from the things-file of my squeezebox-player, but there i get errors.

playStream(squeezebox:squeezeboxplayer:B2C02C4C-9107-4CC8-B2F3-D16387AE9904:b827eb37d5cf, Feed_DLF_News_url_rule.state)

EDIT:

With " it works…, but a second error apears, cannot convert from state to string… How do i have to write the item into playStream command?

Is this the right way?

Feed_DLF_News_url_rule.state.toString

With this i don´t get any errors. Sorry, i´m not at home to test, if it works…

So maybe this will work:

playStream("squeezebox:squeezeboxplayer:B2C02C4C-9107-4CC8-B2F3-D16387AE9904:b827eb37d5cf", Feed_DLF_News_url_rule.state.toString)

Note on my post above that the playStream action accepts Strings as arguments so we need to feed it Strings
Put your Thing betweem "" and convert the state to String by using the toString method

playStream("squeezebox:squeezeboxplayer:B2C02C4C-9107-4CC8-B2F3-D16387AE9904:b827eb37d5cf", Feed_DLF_News_url_rule.state.toString)

Oh, you found the solution yourself!!

1 Like

One more question:

What is the right way to also give the volume to the playStream-command?

I tried:

playStream(sink_EG_WC, Feed_DLF_News_url_rule.state.toString, 25)

and

playStream(sink_EG_WC, Feed_DLF_News_url_rule.state.toString, new PercentType(25))

But nothing is working. What is the right way? new PercentType was described here: https://www.openhab.org/docs/configuration/multimedia.html#audio

But maybe this doesn´t work with playStream, only with playSound?


(I put the long sink-name into a shorter global declared variable… So my rules will be smaller and better readable.)

Hi halloween,

Please check out our new plugin for http commands (copy and paste from our announcement thread)

Hi guys,

I wanted to update you on another feature we have been working on in conjunction with the openHAB server installer.

Our API-Examples plugin has just been added to all Max2Play systems with the new version 2.47 of Max2Play!
You can find it in all Max2Play systems with the update. It’s a free plugin and can be added in the Settings/Reboot menu from the available plugins section.

It dynamically creates a list of HTTP-Get and CLI commands to be copied and pasted into your openHAB solutions.

Commands like Play, Pause, Next Song but also commands like shutdown of the device or starting specific plugins like the Jivelite GUI or Kodi.

It also creates a more detailed API doc for the equalizer and other features we can add by request.

This is the ideal plugin to quickly find and add the functionalities you need for the multiroom audio to be added to your openHAB.

We would really appreciate feedback on this new plugin.

Here’s a screenshot:

And what is the correct command to do my playStream-command with volume change in one single line?

I know i can do this with separated commands, i think this will work, because i use this already for other sounds/music.

But in the squeezebox-binding-docs is written, it also works with one single command…

When i was at home yesterday, i tried the new rule.

The DLF-News-Strem was starting (the mp3-stream is 3-4 minutes), but after about 10 seconds, the music, which was played before, started…

Is there something i can configure?

Hi, i want to recover my old thread.

I wanted to play some different radio stations. If i save the stations inside plex and then play the favourites inside openhab-squeeze-binding, it works.

But when i send a url with playstream, then it plays the new radio station only for about 10 seconds.

Any idea?

Can you turn on debug logging and post what is logged?

Also, what happens if you send the url to an item linked to the stream channel?

Currently i´m not at home. But i did some further investigations:

When i send the comand to playstream, then i get “Notification” in my Remote-Tile-item. When the 10 seconds are over and it is switching back, i can see “Antenne Bayern …” in my item, this is the favourite 1 and it was played before, when i send a the new comand to playstream.

So why is there not the radio station name showed in the play remote title item?

Here is the log:

2019-06-27 13:22:49.276 [DEBUG] [eezebox.internal.SqueezeBoxAudioSink] - Processing audioStream http://mp3channels.webradio.antenne.de/coffee of format AudioFormat [codec=MP3, container=NONE, bigEndian=false, bitDepth=16, ]

2019-06-27 13:22:49.276 [DEBUG] [rnal.handler.SqueezeBoxPlayerHandler] - Play notification sound on player b8:27:eb:37:d5:cf at URI http://mp3channels.webradio.antenne.de/coffee

2019-06-27 13:22:49.277 [DEBUG] [ternal.handler.SqueezeBoxPlayerState] - Cur State: vol=0, mut=NOT MUTED, pwr=ON, stp=NOT STOPPED, ctl=PLAYING, shf=OFF, rpt=PLAYLIST, tix=0, tnm=1, tim=355

2019-06-27 13:22:49.277 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Setting up player for notification

2019-06-27 13:22:49.277 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Turning off repeat

2019-06-27 13:22:49.277 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf playlist repeat 0

2019-06-27 13:22:49.281 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf stop

2019-06-27 13:22:49.282 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Adding notification message to playlist

2019-06-27 13:22:49.283 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf playlist add http://mp3channels.webradio.antenne.de/coffee Notification

2019-06-27 13:22:49.684 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Playlist updated

2019-06-27 13:22:49.684 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Playing notification

2019-06-27 13:22:49.684 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf playlist index 1

2019-06-27 13:23:09.909 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Notification message timed out after 20 seconds

2019-06-27 13:23:09.909 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Restoring player state

2019-06-27 13:23:09.910 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf mixer volume 0

2019-06-27 13:23:09.910 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Removing notification message from playlist

2019-06-27 13:23:09.910 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf playlist delete 1

2019-06-27 13:23:12.513 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Playlist updated

2019-06-27 13:23:12.513 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf playlist index 0

2019-06-27 13:23:12.513 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf time 355

2019-06-27 13:23:12.513 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Resuming last item playing

2019-06-27 13:23:12.514 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf mixer volume 0

2019-06-27 13:23:12.514 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Restoring repeat mode

2019-06-27 13:23:12.514 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: b8:27:eb:37:d5:cf playlist repeat 2

2019-06-27 13:23:12.514 [DEBUG] [rnal.handler.SqueezeBoxPlayerHandler] - SqueezeBoxTimeoutException during notification: Notification message timed out

What’s the default notification timeout in the player thing? It seems like playStream is using the audiosink notification stuff to play the url. I’ve never used playStream before, so I’m not very familiar with how it’s handled internally.

That’s why I asked about what happens is you try using an item linked to the stream channel. Basically do a StreamItem.sendCommand("http://stream/url").

Ok, so it looks like playstream is using the audiosink notification stuff. It looks like the timeout is 20 seconds, not 10. So I would expect it to stop playing after 20 seconds, then return to whatever was playing prior to the playStream.

Can you try sending the url to an item linked to the player’s stream channel?