mhvis / solar

Retrieve model and status data for Samil Power SolarRiver TL, SolarRiver TL-D and SolarLake TL inverters
MIT License
22 stars 11 forks source link

InverterEOFError when connected via WIFI (missing sleep on connect) #24

Closed lwoggardner closed 3 months ago

lwoggardner commented 3 months ago

Hi - thanks for your work on this.

I managed to get output from samil monitor when connected to the inverter via ethernet, but when connected via WIFI it would fail with InverterEOFError as below.

After some tcpdump tracing SolarPower browser (running via wine) I noticed an exactly one second delay between accepting the connection on port 1200 and the app sending the initial 01 03 02 request.

putting a sleep(1.0) in find_inverter after accepting the connection fixed it.

My inverter: SolarRiver 4500 TL-D SolarPower browser 3.2.3.0

Error:

DEBUG:samil.inverter:Sending server broadcast message to <broadcast> 
INFO:samil.inverter:Connected with inverter on address ('192.168.2.204', 64067)
Found inverter on address ('192.168.2.204', 64067)
DEBUG:samil.inverter:Sending 55aa01030200000105
Traceback (most recent call last):
...
  File "samil/samil/inverter.py", line 451, in receive
    msg = super().receive()
  File "samil/samil/inverter.py", line 177, in receive
    return read_message(self.sock_file)
  File "samil/samil/inverter.py", line 343, in read_message
    raise InverterEOFError
samil.inverter.InverterEOFError

TCP dump SolarPower browser: (note 1 second delay)

10:00:54.804156 wlp0s20f3 In  IP 192.168.2.204.62265 > 192.168.2.248.1200: Flags [.], ack 1, win 2896, options [nop,nop,TS val 3575653445 ecr 1309745992], length 0
    0x0000:  4500 0034 25a3 0000 4006 ce0c c0a8 02cc  E..4%...@.......
    0x0010:  c0a8 02f8 f339 04b0 6977 3240 dc51 1e45  .....9..iw2@.Q.E
    0x0020:  8010 0b50 eb60 0000 0101 080a d520 2445  ...P.`........$E
    0x0030:  4e11 2348                                N.#H
10:00:55.806583 wlp0s20f3 Out IP 192.168.2.248.1200 > 192.168.2.204.62265: Flags [P.], seq 1:10, ack 1, win 510, options [nop,nop,TS val 1309747115 ecr 3575653445], length 9
    0x0000:  4500 003d 3f64 4000 4006 7442 c0a8 02f8  E..=?d@.@.tB....
    0x0010:  c0a8 02cc 04b0 f339 dc51 1e45 6977 3240  .......9.Q.Eiw2@
    0x0020:  8018 01fe 8744 0000 0101 080a 4e11 27ab  .....D......N.'.
    0x0030:  d520 2445 55aa 0103 0200 0001 05         ..$EU........