I’m playing with the plugin, but I can’t get something to work, probably due to some inexperience with this plugin.
I have a ESP that is publishing to a MQTT broker running on my Pimatic server. The MQTT plugin is connected to the broker (“info [pimatic-mqtt]: Successfully connected to MQTT Broker mqttbroker”).
I have created a MQTTSensor device, according to the howto this should be able to grab data from a flat json object published to the topic.
Unfortunately, it doesn’t get any data and stays “Unknown”. I have played with changing the type from number to string, or adding quotes around the value in the json object, but all without any luck.
To rule out a issue with the json object the ESP publish to a second topic with just the value. Unfortunately this also stays “Unknown”.
Running a mosquitto client to make sure the data is pushed into the topic:
mosquitto_sub -h 192.168.2.121 -p 1883 -v -t /#
/electra { "T1":"1904618","T2":"2226285","L1":350,"L2":279,"L3":27,"Total":676}
/t1 1904618
Config of both devices:
{
"brokerId": "mqttbroker",
"attributes": [
{
"name": "T1",
"topic": "electra",
"type": "string",
"messageMap": {
"test": ""
},
"acronym": "T1 stroom"
},
{
"name": "T2",
"topic": "electra",
"type": "number",
"messageMap": {}
},
{
"name": "Total",
"topic": "electra",
"type": "number",
"messageMap": {}
}
],
"xAttributeOptions": [],
"id": "electra",
"name": "electra",
"class": "MqttSensor"
},
{
"brokerId": "mqttbroker",
"attributes": [
{
"name": "electrat1",
"topic": "t1",
"type": "string",
"messageMap": {}
}
],
"xAttributeOptions": [],
"id": "electra-t1",
"name": "electra-t1",
"class": "MqttSensor"
}
Can someone give me a hint in what corner to search for my error?
UPDATE: Got it working, I need to use the slash in the topic name : "/electra"
Works like a charm
Like my projects and help? Consider donating electroneum etnjwAKGPqF6omQWRmpp9u2BPyVDG9VuyRQjNJ1S8yfBdfR9qeUQ46kRy8KS2CNqbpNLRrsgmNW6F2TMzxmZgPrh6KctrkrYbm