MQTT Homie Thing DateTime Conversion

Dear community,

I started using MQTT Homie Thing and I have a script creating MQTT messages following the Homie Convention. Everything works fine, except for one thing: I’d like to transfer a timestamp which is not officially supported by the Homie Convention.

If I set the the “datatype” attribute ( to “DateTime” which is not supported, it will be recognized as “String” by the MQTT Homie Thing:

Now, I’d like to map that String (from which I know it ia a TimeStamp) to an OpenHAB DateTime Item. Does anyone know if I can do that without using rules?

Thank you very much

No, I don’t

IMHO such should work:

Type datetime : Date [stateTopic="tele/sonoff_TH/SENSOR", transformationPattern="JSONPATH:$.Time"]

I used that on my things file for a tasmota switch. Sure it depends on how your device sends the time data.

Merry Christmas

1 Like

Thank you very much for your advise. As I’m using auto discovery for the MQTT Homie Thing, this doesn’t work unfortunately. It does not accept the datatype “DateTime” given by the sensor via MQTT and recognizes it as String.

But you are right, if I do it manually and not using auto discovery, it would work.