Page 1 of 1

MQTT Import data format

Posted: 14 Mar 2020, 16:36
by Wiki
I am trying to integrate some power consumption/power supply informations into my IoT using the MQTT Import plugin. The log of the device configuered to receive the data from MQTT broker shows:

Code: Select all

2732646348: IMPT : Bad Import MQTT Command SMA-EM/status/XXXXXXXXXXX
2732646348: ERR : Illegal Payload {'timestamp': 1584199877.382727, 'psupply': 0.0, 'pconsume': 21.8} Netzüberwachung
The description of the MQTT Import plugin on wiki is pretty lean, so which data format does ESPEasy expect?

Re: MQTT Import data format

Posted: 14 Mar 2020, 16:47
by TD-er
I have not yet looked into the code, but I would expect the import could only import numerical values.
So the string should be convertible to float or int.

Your log shows a JSON formatted string and that's not interpretabel as numerical.

Re: MQTT Import data format

Posted: 14 Mar 2020, 22:02
by GravityRZ
when i look at my MQTT data it also is a JSON string but it uses double quotes(") instead of single quotes(')

so maybe you can try to change the MQTT code you are sending and replace ' with "

Re: MQTT Import data format

Posted: 15 Mar 2020, 17:46
by Wiki
Thank you for your tipp, but meanwhile I went another way. Now I am reading the desired informations directly from my inverter (SMA Sunny Island) using tcp modbus and create lean mqtt topics for the MQTT Import plugin.
Has been a useful lesson concerning handling of modbus data and mqtt. I found a q&d python project on github and modified it for my needs. The paho mqtt and modbus modules for python are pretty good tools for realizing such a project.