Historical data with MariaDB- wrong format

Hello,

I’ll use my historical data in the charts area, but it seems, the format is the raw long number from the originally Mariadb- (Mysql-) timestamp:

(How) can I format it to an human readable format? I’d not found any documentation for it.

Sincerely

:slight_smile: Jens

I don’t think you can. At least not directly.

You might be able to use a String Item and a rule to format the data before it gets saved to persistence as a String. You won’t be able to chart that on a graph but it should work for a data table.

Hello,

Thanks for the reply :-).

So I`ll build my own webpages to get the data. When you ‘ll not close this thread, I’ll put an example of one page here in the next weeks.

Sincerely

Jens

Threads close automatically after 30 days. If it’s closed when you come back ping me and I can reopen it.

HtmlRequestDatum.txt (3.2 KB)

Hello,

as suggested, I post a example to get the OpenHab-Data from

a MariaDB- (or MySQL-DB),
with the OpenHab-Persistence-API,
Javascript
and Ajax

to format the raw MySQL-Date-Format to a human readable output to a HTML-Page.

Fill the [Variables] in the appended text file with your data,

rename the file to *.htm,

Put this HTML-Page on your OpenHab-Server in the Directory
[YourOpenHabBasis]/conf/html/static/

and start it in a Browser with the URL
http[s]://[query4OHServer]/static/HtmlRequestDatum.htm?item=[YourItemName]&datumVon=[YourStartDate]

You need

  • your OH-Server,
  • a ItemName [YourItemName] and
  • your API-Token
    to test the page.

It’s a very simple working example, you can extend it with OpenHab-Persistence-API-parameters, CSS-Styles and so on.

I hope, the snippet has no bugs- I can’t test it…

Sincerely
:slight_smile: Jens