Problems with configuration - Squeezebox-Binding

Hi,
yesterday i installed LMS on my Server and added a Raspberry Pi 3 with max2play image.

On my android phone i installed squeezer and now i can control the squeezebox and listen to music with the built in speakers in my bathroom.

But openhab integration is not working.

What i did so far:

In paper ui i got new things for the player and the server. I copied the configuration data from this and made a new squeezebox.things-file by hand:

Bridge squeezebox:squeezeboxserver:myServer [ ipAddress="192.168.102.76", webport=9000, cliport=9090 ]
{
    Thing squeezeboxplayer Player_Raspi_EG_WC [ mac="B8:27:EB:xx:xx:xx" ]
}																					

Now i got 2 new things in paper ui, it is green and shows “online”.

But i still get the old 2 things in the inbox with a long UUID number. This number is not configured in my handmade things-file.

Could there be the error? I don´t want to have this long UUID as name for my squezebox-server.

Yesterday i was on oh 2.3 snapshot #1197. I made an update this morning and now i´m on latest snapshot. But still the same. My items are not working, i don´t get any title information on my sitemap and i can´t control the player with openhab.

And another question:
I have 2 player things in my inbox. One for the raspi3 with max2play and one with the ip-adress of my server (i think the built-in player of the lms squeezebox-Server). Is this right? Do i have to configure both? Only my max2play server is connected to an amp and speakers.

Now i changed the servername to the UUID and it works.

But how can i make this with my own servername for better reading?


Another question:
I get the remaining time, duration and so on in secons… How can i display this in the format: mm:ss ?

This is ok. It’s because the one in your inbox has been discovered by the binding (versus the one you created in your .things file). You can ignore it.

Can you post your items?

The squeezelite one is your max2play, correct?

As for the other one, were you at one time running the SqueezePlay app? It will be discovered by the binding and added to the inbox.

Two options:

  • using the .things file (which you did), or
  • create manually in Paper UI using a name of your choice

Thanks for your answers.

Now all is working, except the seconds are shown as only seconds, not as min:sec

Yes i tested with the software-player one time.

It´s not nice, that this still apears in the inbiox. So to remove this, i have to rename my selfmade player thing to the nave it is given in the inbox?

I made this with the server and now it is gone in the inbox.

Now i only have one max2play raspi, but i will add some more rooms with this, so i need good readable names for all of my players.

Ok, that explains the SqueezePlay in the inbox.

In Paper UI, you should be able to ignore the entry in the inbox by clicking on the icon to the left of the trash can.

You could write a small javascript transform to convert seconds to a string formatted like “mm:ss”, then use that transform in your sitemap.
https://docs.openhab.org/addons/transformations/javascript/readme.html

Here’s what the sitemap entry would look like.

Text item=SongDuration label="Duration [JS(mmss.js):%s]"

In Paper UI, you would need to install the Javascript transform addon, then add the mmss.js code into the conf/transform directory.

Thanks again, but i´m no programmer… Don´t know anything about javascript. Ok, that is not the highest priority on my list.

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…