(Unit of Measure, Time) - Seconds to M:S time to show on Page/OH-Card

(Unit of Measure, Time) - Seconds to M:S time to show on Page/OH-Card

Hello,

I am currently working on building a simple countdown timer and now I am looking at figuring out how to display the time on my page in an easy viewable manner. After finding the action timer (Action Timers) example I got basic countdown going now. I was able to calculate and show 30 second intervals by building a secondary rules/script to update a countdown number. By looking at what was done on the Washing machine status widget.

After hoping that defining the number as Number:Time to get to a formatting that I can find to work, it looks like per this post, Number Time UoM , this is not possible.

Number I am trying to convert in gui is shown in the image, I don’t know of another way to capture the full view of an item configurations. I do have the JS scripting installed under automation.

However, in the thread stream they mention using a script to convert the numbers to min and seconds. I have placed the script in the transform folder,but through the GUI, how do I call out that transform script?

I have tried replacing the %0.2f with “[JS(clockfmt.js):%s]” which lead to the system saying the JS was “Couldn’t transform value because transformation service of type ‘[JS’ is not available.”

Basic System:Openhab3.4 on Openhabian.

Any help or direction to further documentation on using scripting to change formatting would be greatly appreciated.

Thanks


A Number:Time Item can be formatted the same as a DateTime to get HH:MM:SS formatting… Something like %1$tH:%1$tM:%1$tS in the state description will break the time up into hours:minutes:seconds.

See Items | openHAB. You can include a transformation as part of the state description pattern. But if you have a Number:Time it’s not necessary. Use DateTime formatting and as long as the time isn’t larger than 30 days it will work just fine.

Thanks, that worked. I guess I had my blinders on and got caught in keeping same type of variables.