How to use a Unix timestamp received by a channel

I wonder if there is already a simple solution to link a unix timestamp channel to a DateTime Item (other than writing a transformation script) :slight_smile:
Background is a JSON object which offers the unix timestamp of an event.
As this timestamp may differ from the time the JSON object was received, it would be nice to have both available (and the latter is easy with profile="system:timestamp:change")

I think DateTimeType will work with epoch. But it might have to be a number channel or a datetime channel.

If that doesn’t work, you’ll need a transformation.

1 Like

I can confirm that.
I have a thing defined as:

Thing mqtt:topic:_MosquittoBroker:imac_idle "S2M - iMac" (mqtt:broker:_MosquittoBroker) @ "Office" {
    Channels:
        [...]
        Type datetime : heart_beat "iMac Sys2Mqtt HeartBeat" [
            stateTopic="sys2mqtt/<...>/heart_beat" ]
}

and an item defined as:

DateTime    iMac__HeartBeat        "iMac sys2mqtt heart beet"    <time>        (Sys2Mqtt)    {channel="mqtt:topic:_MosquittoBroker:imac_idle:heart_beat"}

and I get:

without any explicit transformation.

1 Like