Read json data from other pi

Raspberry pi 4B
Home Assistant 2021.11.3

I am running a 2nd pi with a Python program, handling a modbus protocol from my Goodwe inverter. All the inverter data is written in a json file every 2 or 3 seconds.
I’d like to show this data on my 1st pi running HA.
I presume this question breaks down into 2 questions
a. how to read the json data from pi2
b. how to display the collected data into various gauges

can anyone give me an idea where to start?

It depends on your programming skills.
I would extend the python program so that it sends the json data to mqtt.
Then in HA use mqtt sensors.

I have moderate programming skills with Python but never worked with mqtt. If I understand right I have to use a mqtt server in the cloud or set up my own mqtt server?
I had hoped for a bit simpler solution. :expressionless:

Home assistant has its own integration to set up your own mqtt server. addons/DOCS.md at 69c68bfac9eb7300ab90727cfde9e557fa475169 · home-assistant/addons · GitHub

This makes setting up your own mqtt server quite easy.

There is also a python Library “paho-mqtt”. I’ve never used this one, but have used other similar libraries. It looks quite simple to use. Here’s an example

https://www.ev3dev.org/docs/tutorials/sending-and-receiving-messages-with-mqtt/

Besides MQTT, you could also use a webhook to send the data to HA through HTTP(S)

thanks all.
enough options to try out :slight_smile:

Another options would be for your pi2 program to serve an API with, for example, Flask. Minimal API is just a few lines of code in Flask.

And then you could use REST sensor to read it

I chose the mqtt path. With a cloud broker. A dozen lines of code in my Python program to publish a json string and the same amount of Yaml to subscribe to the topic and put the data on screen.
All thanks for the suggestions