So, my goal is to be able to have Home Assistant read Modbus from my Solar Inverter (red in the picture below). Issue #1: The inverter only responds on Modbus requests on it’s built-in Wifi (192.168.200.1) where it acts as AP (192.168.200.0/24, SSID “SUN2000-HV…”). Can’t be changed. Issue #2: My internet provider delivers a NAT solution that gives me 192.168.200.0/24 internal network. Can’t be changed. Issue #3: There is a distance between the inverter and my AP of roughly 50m.
So what do I have? See the picture for current setup including 2x MikroTik mAP Lite that I hope can be configured to solve the issues. I have included them in the picture to show how I thought they could bridge the wireless distance.
But how do I configure them (the Mikrotik mAP Lite)? Maybe I can have the mAP Lite to translate IP addresses, so when my Home Assistant requests Modbus (port 502) from a “fake” IP 192.168.20.100 the MikroTik mAP Lite translates this to 192.168.200.1 which is the inverter internal IP.
Is this even possible?
Are there any better solutions?
On one of the MikroTik mAP Lite I will set up a bridge, probably the one that connects to my AP 192.168.20.0/24
The other mAP Lite I will do this:
Assign IP 192.168.20.100 on ethernet port
Assign IP 192.168.200.100 on wlan port
Add dst-nat rule dst=192.168.20.100 to=192.168.200.1 and src-nat rule src=192.168.20.194 to=192.168.200.100
Add dst-nat rule dst=192.168.200.100 to=192.168.20.194 and src-nat rule src=192.168.200.1 to=192.168.20.100
My idea here is that Home Assistant (192.168.20.194) reads Modbus from 192.168.20.100 (mAP Lite). The mAP Lite changes both src and dst address as per above NAT rules. This should make sure the packet gets to the Inverter (192.168.200.1) I think.
Do I have to have some manual routing here? I think not… ???
You can’t use single mAP. It would have to connect to two APs at the same time. Both APs will likely use different channels and client which has single radio can not deal with it.
I have a similar situation here and solved it differently. The inverter has an STA (station) and AP (access point) like yours and I disabled the STA side here. The AP side has it’s own address and DHCP server. So when I connect I get a IP in the 10.10.100.150/24 range.
I put a cAP near the inverter and have it connect to the inverters AP. In the NAT of the cAP Lite I do the address translation from my local network (192.168.0.0/24) and the traffic is going to a lan cable from the cAP Lite to first switch of my local lan. The PoE injector or the PoE of the switch powers the cAP Liter through the lan cable and it needs at least 18V to have enough power reaching the cAP Liter.
Because the AP has a DHCP your other DHCP in the Unify is going to complain about there being an other DHCP server and you can block the inverter DHCP server in the bridge of the cAP Lite.
If you need the inverter to connect to the internet it could be doable having that happening trough the active connection or use the STA side of the inverter.