I have a home made pi zero w rain detector that i want to send messages to hass on a pi 4. It will be a simple flag for whether it is raining or not.
I used the MagPi scripts for a rain detector and think i am pretty comfortable with changing python scripts.
The issue is I am not experienced with MQTT whic I believe is the preferred method.
I have installed Mosquitto on the hass pi 4 (with an account) and I have also installed Mosquitto with paho on the rain detector pi.
I just don’t fully understand how to use this to send a MQTT message in Python.
Also, as the raining/not raining message will only be sent intermittently (ie when rain starts and then stops), i guess Hass will need to hold the last rain status for use in local automation scripts. So Hass will need a method to do this which I am also unsure of (set up a sensor somehow to hold the last status?).