Thanks to a kind person PaulSturbo who shared their modbus MITM yaml, I got this working with my Delta E6-TL-US inverter and Acrel AGF-AE-D meter. The ESPHome MITM adjusts the meter readings provided to the inverter, offsetting by a value provided over mqtt, so I can control the inverter battery power flow.
Here’s my current complete .yaml esphome: name: delta-acrel-mitm friendly_name: Delta Meteresp32: bo - Pastebin.com
More details here about the system, and getting this MITM to work: Growatt MIN TL-XH-US or Delta E6-TL-US, AC coupled behind SMA SI6048US | DIY Solar Power Forum Key detail I got stuck on, was needing to set logger level to WARN or less, otherwise spewing the log messages overwhelms the ESP enough that it doesn’t respond in a timely enough fashion to the inverter requests, and the inverter gives up.
So the questions:
First question: is there a graceful way to have a modbus server not respond to register requests, or send an error response? The second feature I want, is to disable the inverter from using the meter at all, so it will leave the battery SOC as is. I want this typically when system is connected to the grid, and don’t want to charge or discharge this inverter’s battery. What sort of works so far, put a 2 sec delay in the lambda for one of the registers requested often by the inverter, depending on a control mqtt message. This makes the inverter think the meter is not working, and it does what I want. But it effectively hoses the ESP, chewing on 2 sec delays and never getting to service most modbus requests, and mostly stops reading the meter from the modbus client. It might be repeatedly resetting and restarting? My inverter does recover and work normally once the server is again passing for the meter.
Second question: from ESPhome, can I sniff additional device ids with the uart which is configured as a server pretending to be the meter? On the same rs485 bus (with inverter as the master/client) is the LG battery. I don’t need at this point to MITM it also, but I do want to receive the registers from it as the inverter is requesting them. The meter is id 2, and I need to respond to those messages. But I also want to store data from the battery id 15, and publish to mqtt.
Thanks! and thanks to those who created the whole ESPHome frame work. It’s so neat to do OTA and have something like this be functional without having to create code from scratch.