suaveolent / hoymiles-wifi

Library to communicate with Hoymiles DTUs and HMS-XXXXW-2T microinverters via protobuf.
MIT License
52 stars 10 forks source link

Two WLAN-Devices and two HMS-800W-2T on one Raspi #27

Closed Jo-Bl closed 1 month ago

Jo-Bl commented 1 month ago

I have two WLAN-Devices on one Raspi: the internal device and the other one is an USB-Stick, which is native supported by the RaspiOS. Both devices works well with RaspiOS as wlan0 and wlan1.

I can connect one of the devices to the AP of HMS-800W-2T#1 and the other device to the AP of HMS-800W-2T#2. This works well.

The wlan0 device get the ip 10.10.100.151, the wlan1 device get the ip 10.10.100.152, This works well.

But both AP of HMS-800W-2T have the same server-ip 10.10.100.254. So it is not possible to use the --host IP parameter of hoymiles-wifi alone to sepatate the micro-inverters.

In this case it is necessary to also name the interface that is to be addressed: wlan0 wlan1

Please add this if possible. (--device or so...)

Thanks for your work.

Please note: I do not use the hoymiles-cloud and do not want to change the micro-inverters from Ap mode to client mode as a part of my network.

Somewhere in async_send_request in dtu.py it would have to be added:

` async def async_send_request( .... address = (self.host, dtu_port)

    async with self.mutex:
        try:
            reader, writer = await asyncio.open_connection(*address)

`

suaveolent commented 1 month ago

Added with v0.2.4. You should now be able to use --local_addr parameter to bind to the specific interface.

e.g.

hoymiles_wifi --host 10.10.100.254 --local_addr 10.10.100.151 get-real-data-new hoymiles_wifi --host 10.10.100.254 --local_addr 10.10.100.152 get-real-data-new

Jo-Bl commented 1 month ago

Thanks.

But sorry, this doesn't work. Independent from the setting at "--local_addr" it requests server every time on wlan1 (10.10.100.151 -> 10.10.100.254) but sadly never wlan0 (10.10.100.150 -> 10.10.100.254)

Not working (wlan0, requests wlan1 instead): ./hoymiles-wifi --host 10.10.100.254 --local_addr 10.10.100.150 --as-json get-real-data-new

working (wlan1); ./hoymiles-wifi --host 10.10.100.254 --local_addr 10.10.100.151 --as-json get-real-data-new