question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possible to send JSON via MQTT?

See original GitHub issue

I’m trying to log data from mpp-solar to a Kotori instance (see https://github.com/daq-tools/kotori/issues/50), and it seems they’d prefer to have the data in a JSON block. I see that mpp-solar supports that output (-o json), but it looks like it just writes to the screen rather than to the specified MQTT broker. Is there a way to do this that I’m missing? Or if not, could it be added?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jblancecommented, Apr 5, 2021

added in version 0.7.40 e.g. below (make sure to change -p, -q and --mqtttopic options to suit) $ mpp-solar -p test -o json_mqtt -q screen --mqtttopic kotori -c QDI

{'topic': 'kotori', 'payload': '{"ac_output_voltage": 230.0, "ac_output_frequency": 50.0, "max_ac_charging_current": 30, 
"battery_under_voltage": 42.0, "battery_float_charge_voltage": 54.0, "battery_bulk_charge_voltage": 56.4, 
"battery_recharge_voltage": 46.0, "max_charging_current": 60, "input_voltage_range": "Appliance", "output_source_priority": 
"Utility first", "charger_source_priority": "Solar + Utility", "battery_type": "AGM", "buzzer": "enabled", "power_saving": "disabled", 
"overload_restart": "disabled", "over_temperature_restart": "disabled", "lcd_backlight": "enabled", 
"primary_source_interrupt_alarm": "enabled", "record_fault_code": "disabled", "overload_bypass": "disabled", 
"lcd_reset_to_default": "enabled", "output_mode": "single machine output", "battery_redischarge_voltage": 54.0, 
"pv_ok_condition": "As long as one unit of inverters has connect PV, parallel system will consider PV OK", "pv_power_balance": 
"PV input max power will be the sum of the max charged power and loads power", "unknown_value_in_response_25": "000"}'}
1reaction
jblancecommented, Apr 3, 2021

It shouldn’t be too hard. I’ll try to add this in the next day or two

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Send and Receive JSON Data Over MQTT with Python
Encoding data in JSON is popular for sending data over the Internet, and also for storing data. You can encode a Python List...
Read more >
How to Send data as JSON objects over to MQTT broker
You just need to create your JSON object as a string then call getBytes() on that string to get the byte array to...
Read more >
How to send data using MQTT - AssetWolf
Assuming your device is connected using MQTT, it should publish its data to: $sensorTopic = "up/client/clientId/asset/deviceId";. The topic is ...
Read more >
ESP32: Sending JSON messages over MQTT - techtutorialsx
The objective of this post is to explain how to send JSON messages over MQTT using the ESP32.
Read more >
Publish JSON Data over MQTT with Node-Red - YouTube
One of the the most common use scenarios for using JSON data is for combining data from multiple sources. In this tutorial we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found