ioBroker/ioBroker.lovelace

Timestamps

JiroMusik opened this issue · 4 comments

Hi there, I am not sure if this a bug or if I dont classified the datapoints and entities correctly:

I have a simple Entity card with a Timestamp Object (RPI adapter uptime) I have the role of the datapoint as value.datetime and the Lovelace entity activated as Timestamp (s)

But its showing 1. Jan 1970 on the Dashboard

So the entity is a sensor entity with device class set to Timestamp?

What is the value of the state? It needs to produce a date if put into new Date() in JavaScript (that is essentially what the frontend does with the state in that case). So either it needs to be a Unix-Timestamp, i.e. a number or a string that the Date Function can understand.
So in your case the state should ideally contain the unix timestamp of the last time your RPI was booted (I have such states with role "date" and admin shows the date fine, lovelace seems to calculate a "sinces XY" string from them, which seemingly can be controlled setting the "format" attribute of a card / entity row to either datetime or relative).

Here it is my problem. I have a timestamp in this format in the iobroker field: 1701039600000

This is what lovelace show me (in the card it shows me the next hours/days - in the detail-view the correct day):
Screenshot 2023-11-14 214610

I want that to display only the date wihtout a time. The best but not necessary is: date with the weekday.

What does happen, if you just switch the device_class attribute to date?

//Edit, ok, it seems the UI won't parse the timestamp, then... I changed that in the github version. If you are brave, you can test it (but it contains a new version of the UI -> this might break your theme & custom cards)

Thank you, it works.