MQTT Import data format

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

MQTT Import data format

#1 Post by Wiki » 14 Mar 2020, 16:36

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?

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

TD-er
Core team member
Posts: 8729
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: MQTT Import data format

#2 Post by TD-er » 14 Mar 2020, 16:47

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.

GravityRZ
Normal user
Posts: 206
Joined: 23 Dec 2019, 21:24

Re: MQTT Import data format

#3 Post by GravityRZ » 14 Mar 2020, 22:02

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 "

Wiki
Normal user
Posts: 413
Joined: 23 Apr 2018, 17:55
Location: Germany

Re: MQTT Import data format

#4 Post by Wiki » 15 Mar 2020, 17:46

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.

Code: Select all

pi@raspberrypi:~ $ man woman
No manual entry for woman
pi@raspberrypi:~ $

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests