How did you associate the script with your Item? Where are you looking at a display?
What I did:
In the Openhab item from the sys info binding put the javascript in the profile:
This seems to work, an error in the javascript generates a log file entry.
I didnāt change the Item as I expected, the output value of the channel is changing:
And the widget looks like this:
component: oh-label-card
config:
actionAnalyzerItems:
- OpenhabSysteminfo_SystemUptime
item: OpenhabSysteminfo_SystemUptime
title: Uptime
icon: oh:switch
footer: =items.OpenhabSysteminfo_IPAddress.state
Applying a profile to a link alters the data from a channel before it gets updated to the Item.
The output of your transform is a string like ā2 hours 10 minutesā. You canāt update a Number type Item with a string like that.
Thanks a lot. Got more understanding, how openhab works.
But, still not solved the problem. Iāll try to make a number2number javascript conversion by dividing it by 1440. Then I should get days ( hopefully )
We donāt know what āthe problemā is. What are trying to achieve here, just a pretty transformation for display? If it is that, leave your Item in minutes and apply whatever transformation you want to the Itemās state presentation pattern.
That is exactly, what I want to archive. Just transforming the minutes in the Widget Display to a better readable output like days/hours/minutes or similar. I searched the documentation but I didnāt find a way to do this.
Alright, stop fiddling with profiles if you donāt want to change the Items state.
Apply the transformation to your Itemās state presentation pattern metadata. (Most of the docs are still OH2 and describe the same thing using in the Itemās label.)
This thread is relevant for that -