Bridging Modbus to Home Assistant over WiFi with a Raspberry Pi

How to connect a Modbus device to Home Assistant over WiFi using a Raspberry Pi.