JSONPATH question for datetime item

  • Platform information:
    • Hardware: raspberry (without openhabian)
    • OS: rasbian 4.19.97+
    • Java Runtime Environment: zulu8.40.0.178-ca-jdk1.8.0_222-linux_aarch32hf
    • openHAB version: 2.5.3

I use a tasmota device with power sensing module. Now I want to display the date and time when the total counter was set to zero. But I can only display the given string without formatting.

mqqt comes as follow: {“Time”:“2020-03-15T15:04:36”,“ENERGY”:{“TotalStartTime”:“2020-03-15T11:27:08”,“Total”:0.015,“Yesterday”:0.000,“Today”:0.005,“Period”:0,“Power”:1,“ApparentPower”:14,“ReactivePower”:14,“Factor”:0.08,“Voltage”:229,“Current”:0.060}}

I will need the TotalStartTime und put under incoming value transformation: JSONPATH:$.ENERGY.TotalStartTime

What do I have to put under Outgoing Value Format to display the correct date and time?

Outgoing value as in sending it to the device or for viewing in OH?

For viewing in OH.

Do you have a sitemap file?

You can also use a proxy item and a rule to update the item.
Proxy item example:

DateTime Garage_update "Last change [%1$tm/%1$td %1$tH:%1$tM]"

No, I have no files. Just playing with PaperUI.

Create a sitemap and use BasicUI. You should be able to get the date/time posted there. Nothing needed for outgoing value as that is for sending info to a device from OH.

But with number fields it works fine when I format the number with e.g. “%.2f” in the Outgoing Value Format Field.

So it’s working?

Yes, for number fields.
No, for datetime fields.

Try something like [%1$tm/%1$td %1$tH:%1$tM] for the datetime field. Just may need to change the order as it looks like yours is date then time.

PaperUI is for configuration and while you can control some things it’s recommended to use a sitemap file and something like BasicUI or ClassicUI.

Also, have a look at item profiles as you may find it helpful.

This is what I used to convert date time in the format you have. It works great. I have as part of the label string in basic ui.

1 Like