tcore
tcore copied to clipboard
[MQTT Plugin] How to get the topic?
Hello,
i have setup an Action which triggers by "MQTT Action-Trigger" and causes "MQTT Action-Type Store Data" to fire.
I'm using a debugging payload parser, to check what's being sent and the available globals:
console.log(payload);
console.log(this);
payload = [];
Here's what's being logged:
[22:10:34] Log from payload parser: 237.1
[22:10:34] Log from payload parser: {
"payload": 237.1,
"raw_payload": 237.1,
"device": {
"id": "6159fee2eeb93a8c0fa57097",
"tags": [],
"params": []
},
"console": {}
}
So, in "payload" i'm only getting the value, with no reference to the mqtt_topic.
I'm also using the cloud tago.io service, with a similar setup i always get metadata.mqtt_topic in the payload, but in tagocore mqtt plugin i only get the value. I could add different devices for each topic, but there should be a better way.