Play sound with squeezebox when entering bathroom

This adds a bit of complexity. The part that makes it complex is if you play other items when the bathroom is not in use. It’s easy if all you want to do is start/stop the bathroom song when someone enters/leaves the bathroom.

Yes, i know the problematics…

I often play other songs or radio streams manually.

How can i check inside a rule if the squeezebox-player is currently playing a song?

Can i check the channel playpause? If it is ON, then the player is currently ac tive? If OFF then there is no music playing now? Or is this channel only to send commands and is no status channel?

Will this channel change to ON if i play music with squeezer on my android phone?

Got it

if (Squeezeplayer_EG_WC_control.state != PLAY) {

playPause should also work (ON=playing, OFF=paused), but it doesn’t. :frowning: I’ll have to look at the code to see why not…

I have seen this a few minutes before, then i tried the player-item and that worked :slight_smile:

Why is “mute” a switch and “shuffle” and “duration” are numbers?

Also “stop”, “next” and “prev” are switches… Do i need expire binding (1 second) to get a pushbutton or is there a better solution?

“play/pause” is ok, because i have two states.

What will “power” do? Only stop playing?

Is it possible to make a selection widget with some playlistes? Is there a little example somewhere? I don´t have any playlistes yet.

ON=mute OFF=unmute

shuffle and repeat are defined as numbers by the LMS because they can have more than two states.

The “playlist shuffle” command is used to shuffle, unshuffle or query the shuffle state for the current playlist. A value of “0” indicates that the playlist is not shuffled, “1” indicates that the playlist is shuffled by song, and “2” indicates that the playlist is shuffled by album.

The “playlist repeat” command is used to indicate or query if the player will stop playing at the end of the playlist, repeat the current song indefinitely, or repeat the current playlist indefinitely. A value of “0” indicates that the player will stop at the end of the playlist, “1” indicates that the player will repeat the current song indefinitely and a value of “2” indicates that the player will repeat the entire playlist indefinitely

duration is the total length of the playing track in seconds.

I typically use mappings in the sitemap. For example

Switch item=Player_Next label="Next" mappings=[ON="Next"]
Switch item=Player_Prev label="Previous" mappings=[ON="Prev"]

I think it depends on the device. I haven’t looked at the squeezelite code in a while, but I think power does nothing. OTOH, if it’s a Squeezebox Receiver, Boom, etc, it actually powers if off/on.

I just added a feature you might like. Read about it here.

I now have a simple solution for play the song at the last stopped position, when no other song was played between:

I check if the title is still the title of the song which always plays and if yes, send playpause to on. Else send the url and then the song begins from the beginning.

1 Like

Can i do that with a playlist as well? Or can i make a folder inside LMS and only play the songs which are inside this folder?

Only one song gets boring with the time. I want to have a playlist or folder with many songs and play them with shuffle.

But how can i check inside a rule, if this playlist is playing? There is no item for “playlist”, only artist, title, …

And how can i send a command to my squeezebox to play a special playlist or a song from a special folder? Can i send folder url or playlist url instead of direct path and name of the song?

If i can´t check for which playlist is active at the moment, i have to edit all of the mp3-tags of the songs to a special name, let´s say “openhab” and if “title” openhab is playing, i can look for this?

In LMS you can add a Playlist to the Favorites folder.

I don´t understand the playFavourites-channel description exactly.

Do i have to send a number to this item?

Paper UI doesn´t show me this channel for linking with an item. Do i have to create this on my own?

That channel was added to the binding relatively recently (it’s included starting in build 1208). So, you need to have a very recent version of the binding. And, if your server and player things were added before that, they won’t have the new channel (nor do they automatically pick it up). The normal solution is to delete and rediscover/readd the squeezebox server and player things.

The playFavorite channel is a String, so you send it a string. The link I shared above explains how to use it.

Currently i´m on #1207

Ok, will have to make another update.

Yes, the downside of a product under very active development where features are being added constantly… :slight_smile:

Can i send a folder url to my squeezebox, too? Or can i only send a urls to a file or playlist or radio-stream?

I want to play all songs in one folder and shuffle.

Is this working with just send folder url? Or do i have to make playlist to do this?

I think it works…

But can you tell me the difference between shuffle 1 and shuffle 2?

I have some different songs in one folder. How will the play shuffled? With 1 or 2?

As far as I know shuffle1 is to shuffle per album and shuffle2 is to shuffle through all songs.

See reply above: Play sound with squeezebox when entering bathroom
He already explained the shuffle modes thoroughly.

I know that, but i don´t play all songs and i don´t play album.

I play all songs from inside a folder. And i think, shuffle is not working as i want this to have.

It always starts with the first song song from folder.

So what should i use in my case “play different songs inside one folder”.

All songs or albums?

When i´m playing a song and stop this song, all mp3-tag information about album, genre and artist is removed from the sitemap.

Only the mp3-tag “title” is still visible.

Is this a bug?

Would be nice, if i could still see all information. Because when i send play/pause command, the song will start again, so the song is still saved somewhere in LMS.

Strange, now it seems, that the values will be kept in the items…

Any idea for some cheap switches/sensors to control the music inside the room without a smartphone?

I can buy a 8-channel-knx-sensor, but then this is more expensive then raspi3 and hifiberry amp2 together…