jbuehl / solaredge

SolarEdge inverter logging data capture
GNU General Public License v3.0
288 stars 60 forks source link

"TypeError: ord() expected string of length 1, but int found" in network.py #169

Open InFerYes opened 2 years ago

InFerYes commented 2 years ago

Hi, I'm having an issue getting semonitor.py to run.

I'm running semonitor.py on Arch Linux with the latest updates:

Linux stripe 5.18.7-1-danctnix #1 SMP PREEMPT_DYNAMIC Mon Jul 11 04:43:57 UTC 2022 aarch64 GNU/Linux

I have given the host a fixed ip and there are no services using port 53:

6: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:e0:4c:36:02:b7 brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.1/24 brd 192.168.100.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever

Running Python 3.10.5.

I run the script with sudo python semonitor.py -vv -t n -n eth0.

The output (with redacted MAC) is

append: False
baudrate: 115200
commands:
datasource: network
follow: False
interface: {17: [{'addr': 'xx:xx:xx:xx:xx:xx', 'broadcast': 'ff:ff:ff:ff:ff:ff'}], 2: [{'addr': '192.168.100.1', 'netmask': '255.255.255.0', 'broadcast': '192.168.100.255'}]}
keyfile: None
logfile: stderr
master: False
outfile: stdout
ports: 22222,22221,80
record: None
slaves:
type: n
updatefile: None
verbose: 2
xerror: False
opening network
starting dhcpThread
Exception in thread dhcpThread:
starting dnsThread
Traceback (most recent call last):
waiting for connection on port 22222
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
waiting for DNS message
waiting for connection on port 22221
    self.run()
waiting for connection on port 80
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/alarm/aur_builds/solaredge/se/network.py", line 248, in dhcp
    clientIpAddrNum = ipAddrNum[0:3] + chr(ord(ipAddrNum[3]) + 1)
TypeError: ord() expected string of length 1, but int found

I started tinkering with it, by removing the ord(), as I read that it is a python2 leftover, but I don't know enough about python to fix the whole script so I stopped after a few hurdles. I read this project was adjusted for python3 so I don't know what is wrong.