SqueezeControl custom widget

:grinning: :grinning: :grinning:
pretty easy

Thank

Just to add a few things to the textual config discussion:

  • text configs are not going away any time soon
  • new features in OH 3 and beyond are not guaranteed to have a text file equivalent (e.g. custom widgets, rule templates)
  • the symantic model is implemented using tags and Group membership so of course can be implemented in. items files; but you have to be careful to use the right tags in the right context
  • there is no such thing as renaming an Item. The names is the unique identifier and in text files what happens is the old item is deleted and a new one is created. This can leave a lot of trash laying around like orphaned links, rules, widgets, etc. which might cause problems
  • don’t forget the developer sidebar when working with anything in MainUI. You can pin the Items, Things, Rules and Widgets you are working with at the moment right there for easy reference
  • in general, the UI has lots of tools built in to make managing the configs easier which people do not take advantage of, and then pan the UI approach over all for being too much point and click. And even with the point and click it might be too much point and click, but you will be trading a self documenting interface where it’s almost impossible to make a syntax error for a text file with the need to have to keep looking at references and docs to get right and occasionally fighting syntax errors. It’s a trade-off.
1 Like

ok, but I think this is more a problem with database handling than with textual config or renaming… :wink:

I like the new UI but I think the same like @Karl1 stated, the Item and things list in UI is pure pain to work with, text files can be more easily structured and are way better to work with…
And I don’t like the rule engine very much… but maybe it’s better to discuss this elsewhere…

That’s why I brought up the developer sidebar and other tools. No one should be working primarily though the Items and Things list. I agree, that would be painful, but that’s not the only option.

Dear Dan

So now i am back to implement my squeezboxes. In the meantime i setup from scratch a new Raspi 4 with openhabian V1.71 (great work) based on Bullseye. Main reason for this was LOG4J thing which should in my understanding no longer be a problem in this new distribution.

The only tricky thing was get the LCN Binding working as the bridge used a software (PCHK) which need wiring PI and this is now discontinued. But lucky found a Pi version on the webside of the author for Raspi 4B and with this version i got it working.

Have done the config for squeeze now textual. :wink:

In your item config you use a map transformation. JS(mmss.js) where the formatting is done i think
But i don´t have skills to do this im my config also.

Number:Time  SqueezeWintergartenDuration          "Duration [JS(mmss.js):%s]"    

Found the solution from mhilbush
and placed a file mmss.js into the conf/transform directory

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

But the result is still showing only in seconds.
JS transformation ADDON is installed.

Thanks a lot for your time

Karl

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