Correct topic? Correct me if I’m wrong…
I couldnt think of a better topictitle, but here we go: I’ll descibe every step as it might be valuable to someone else, although the question is only a small part namely how to parse the dateformat from the received MQTT device.
Ive got MQTT installed and working. Added plant gateway (https://github.com/ChristianKuehnel/plantgatewa) and a sensor.
Using
mosquitto_sub -v -h 127.0.0.1 -p 1883 -t plants/#
I get:
plants/plant3/ {“battery”: 92, “temperature”: “20.1”, “conductivity”: 17, “timestamp”: “2017-04-27T17:04:39.873974”, “moisture”: 4, “brightness”: 999}
Added device in pimatic config:
{
“class”: “MqttSensor”,
“id”: “plant3-sensor”,
“name”: “mi home plant sensor 3”,
“attributes”: [
{
“name”: “battery”,
“topic”: “plants/plant3/”,
“type”: “number”,
“acronym”: “battery”
},
{
“name”: “temperature”,
“topic”: “plants/plant3/”,
“type”: “number”,
“unit”: “°C”,
“acronym”: “Temperature”
},
{
“name”: “conductivity”,
“topic”: “plants/plant3/”,
“type”: “number”,
“acronym”: “conductivity”
},
{
“name”: “timestamp”,
“topic”: “plants/plant3/”,
“type”: “date”,
“format”: “YYYY-MM-DD hhss”,
“acronym”: “timestamp”
},
{
“name”: “moisture”,
“topic”: “plants/plant3/”,
“type”: “number”,
“acronym”: “moisture”
},
{
“name”: “brightness”,
“topic”: “plants/plant3/”,
“type”: “number”,
“acronym”: “brightness”
}
]
},
Now obvious the date of timestamp is incorrect. But how should I do it? Is it even possible, or do i have to use a variable device? If so, how?
Also not sure if it will handle the microseconds.
By the way: I love pimatic! Awesome piece of software and community!
// edit: corrected topic string with ending /