mscholz3
(Marcel Scholz)
September 26, 2020, 10:54am
1
Hi,
i get a String from the xiaomi binding:
String RoborockVacuumS5MaxLastEnd “Last Cleaning End time [%s]”
Wenn i show this value in a DummyWidget in habpanel, i get: “2020-09-24T17:33:09.000+0200”
It is possible to show only the date. Like 24.09 ? I couldn’t do it with “Format”.
Thanks
Marcel
opus
(Jürgen Baginski)
September 26, 2020, 11:37am
2
Welcome to the openHAB forum
Using the search function of this forum like this , I got this Tutorial thread .
mscholz3
(Marcel Scholz)
September 26, 2020, 11:58am
3
Thanks for your reply.
In your tutorial thread is the datatype DateTime. My datatyp is String.
I Found this this topic
He have the same Question and received no replies .
rossko57
(Rossko57)
September 26, 2020, 12:47pm
4
I suppose you might consider converting your string to date time of some kind, so that you can format it as you want.
Because openHAB 3.x rules now use Java Time API instead of Jodatime, there is a new DateTime Conversion thread for openHAB 3.x .
Overview
In openHab 2.x there are different ways to handle Date/Time values.
DateTimeType
A DateTime Item carries a DateTimeType .
Joda DateTime
By default openHAB 2.x-Rules use a Joda DateTime class to represent time, most notably now.
Epoch
The lowest common denominator when working with time is to get at the epoc value. Epoc is the number of milliseconds …
mscholz3
(Marcel Scholz)
September 26, 2020, 1:43pm
6
In unterstand, that i have to converted the string.
But i dont know how. I have only so far creat items and add it in habpanel.
Where can i converted?
Wolfgang_S
(Wolfgang_S)
September 26, 2020, 1:51pm
7
Shouldn’t e.g. work it with angularjs.
With the string from your example it would look like https://plnkr.co/edit/GSvV2uqcRE2aK3MZ?preview
What’s missing then is how to integrate that into habpanel. As far as I can see examples are shown here: Convert seconds to Hours:Minutes:Seconds in HabPanel?
opus
(Jürgen Baginski)
September 26, 2020, 1:57pm
8
Have you tried to just change the type to DateTime?
mscholz3
(Marcel Scholz)
September 26, 2020, 2:36pm
9
I change it in my .item file to datetime. i got only null. i changed it to String again. Now i get null too.
rossko57
(Rossko57)
September 26, 2020, 2:39pm
10
That’s the way it will stay until the next time the vacuum updates it.
mscholz3
(Marcel Scholz)
September 26, 2020, 2:40pm
11
I don’t know much about front-end technologies like angularjs.
How i get you script snippet in habpanel?
As already mentioned. So far I have only created items (in visual basic) and displayed them with existing widgets in habpanel.
mscholz3
(Marcel Scholz)
September 26, 2020, 2:47pm
12
I found this to learn to create own widgets.
Probablyi have to create a template-widget with the script
Infeus
(Oleksii Biatets)
June 22, 2024, 9:24am
13
Hi
Have you found solution to show normal date ? How to do it ?