SqueezeControl custom widget

Hi Karl,

here the content of my mmss.js it’s similar to yours:

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

the directory you put the file is the right one

if your Javascript Transformation is activated maybe user rights?? is the file executable?
just a guess…

to check this ssh into your PI4

and enter the follwing command

ls -la /etc/openhab/transform

the owner / group should be openhab:openhab
to change this enter:

sudo chown openhab:openhab mmss.js

to make sure it’s executabe for openhab and group members enter:

sudo chmod 774 mmss.js

Yes you are right:

transform

For the default files it is openhab:openhab

But the 2 files i created its : openhabian:openhab ???
Changed it it openhab:openhab for both files
Have i now change this for each created file to openhab:openhab ???

But after chang same:

Wondering a littel bit as i should put it in the transform directory.
Normal in this directory all files must have ending .map

Should i try it in the script directory?

I don’t use openhabian so try to search for an answer on the forum

the CurrentPlayingTime itself will never change, the system logs the data provided by the binding,
don’t be confused with the displayed item state! these are two different things one is a value the other is how the value is displayed for the user, keep that in mind!

You have to take a look at the widget to see if the time is converted by your mmss.js script…

Up to now i try to get everything ready in Main UI and then will configurating your widget.

So my question

when i use the item:

Number:Time  SqueezeWintergartenCurrPlaytime      "Playing Time [JS(mmss.js):%s]"    

then for my understanding in the main UI there should be the converted value from the script

But as i learned the log shows the values out of the binding and this is still only in second

You’re right! That’s how it works

Thanks for guiding me in the right direction

Karl

So now i have this solved: As i use Main UI i got the hint that i have to use metadata instead of do the transformation in the label area.

Number:Time  Squeeze_Wintergarten_CurrPlaytime      "Playing_Time"                          (WG_Squeezebox,Musik)  ["Status"]       {channel="squeezebox:squeezeboxplayer:musik:Wintergarten:currentPlayingTime", stateDescription=""[pattern="JS(mmss.js):%s"]}

But now the next question pops up.

Which type of item is the configurable “Server list item”
is it also only a dummy item and what should be the payload of this item ?

Or need i an additional squeeze server thing channel to define. Do you have a textual example for this?
This would help me a lot.

Karl

Sorry but have you read the bindings documentation? if not it’s just a click away

But to answer your question, it’s not a dummy item, it’s not a player channel so you don’t find it in your things configuration. It’s a server channel.

You can reach this channel here:

// Server
String  SqueezeServerListFavorite  "List Favorites"  (gSqueezeServer) {channel="squeezebox:squeezeboxserver:<your server name here>:favoritesList"}

please have a deeper look at the docs :wink:

cheers,
Dan

edit:
by the way… you have to fill this list with your favourites on the server side - this is a squeezebox feature… if you don’t add favourites to your squeezebox server, your list will remain empty.

1 Like

Sorry
I try to understand but as a not IT professional it´s not always so easy to understand everything in the right direction.

But thanks again for your patience.

By the way: I have now also my modell textual configured. Was a great tip.
Really happy to be textual again.
Was not so a big thing as i realized the tagging in the right way.
Sometimes difficult to find the right syntax but all in all ´m satisfight with it as it is easier to handle for me.

Karl

No problem Karl… that’s what we’re here for - to help each other!

Nice that you got your model running.

The documentation is a good tool to find answers to questions in general, this is why I pointed you there. Actually a good point to start because most of the questions are covered by the docs nowadays…

IT works, yeah

That´s my very first widget for me :heart_eyes: :heart_eyes: :heart_eyes:
Great work again.

Karl

Get grazy always a but:

My status up to now: player are choiseable and plays,

Cover art, player, volume,and power on off works.

Favorites show NULL as i have no faforites list definet on the server ( up to now)

Now the but: Track info doesn´t work as expected

When i hear radio stream there is no value in duration so i changed this to currplayingtime for test and this workes

Title and artist are always empty. But used the same suffix for all items ?

What me confuses when i customise the widget and i put in a static widget title (first line) always the title suffix ( 8.input line) also gets filled with the same value ?

For my understanding static title should be the label of the whole widget.
And in the line title suffix i should be able to fill in the necessary prefix ? When i change this also static widget title is changed ?

When i look in Main UI the item Artist is correct filled in.

image

Hi Karl,

Where do these underscores in your Names come from??

Should be

SqueezeWintergartenYear

not

Squeeze_Wintergarten_Year

maybe this is the reason why your information is not displayed - just a guess
or maybe you have a typo somewhere in your config and duplicated this error for every player via copy/paste - I don’t know… :wink:

have named my items in this form

squeeze_Playername_Channel
e.g
squeeze_Wintergarten_Title

and therefore my prefix is: “squeeze_” with postfix: “_Title”

try it without the “_”
Hopefully this helps

Hi Dan,

in your first post you write:

the according player item-names should follow this structure:

  • Prefix-Playername-Suffix

maybe this is a little misleading, although it becomes clear with the example that follows. Nevertheless, I would maybe change that to “PlayerPlayernameSuffix”

Removed all the “_” out of my items. No succsess.
When i try edit YAML Code ig et the following picture:

image

Why album is without quotes
and title and artist ist in quotes?

You mean “PrefixPlayernameSuffix” i think

Looks like you added spaces where the quotes are displayed :wink:

Remove them and you should be fine

1 Like

Removed all the quotes out in the YAML code and trick it works

No idea what this mean but it works

Karl

1 Like