openenergymonitor / emonhub

Python service linking and decoding input to MQTT & Emoncms
90 stars 83 forks source link

SNA Solar - Bad Address Errors #185

Open delboy711 opened 1 year ago

delboy711 commented 1 year ago

Hi, I have been using @stuartpittaway 's original SMASolar code for many years, but am now building a new emoncms system based on a VM running on an x86_64 server. All is well so far apart from getting SMASolar working with emonhub.

Bluetooth works OK and I can connect to my inverter with bluetoothctl but emonhub is failing when trying to initialise the connection.

2022-12-02 13:36:18,606 INFO     SMASolar   Opening bluetooth address 00:80:25:32:30:55
2022-12-02 13:36:19,635 DEBUG    SMASolar   initaliseSMAConnection
2022-12-02 13:36:19,670 ERROR    SMASolar   Bluetooth Error
2022-12-02 13:36:19,671 ERROR    SMASolar   [Errno 14] Bad address

I assume the bad address refers to the Inverters Bluetooth address, but if I change it to any other address I get a message [Errno 112] Host is down so the address seems to OK.

Any suggestions as to what could be the problem?

By The Way: There is a little bug EmonHubSMASolarInterfacer.py at line 145 decoding error codes

errCode = eval(err[0])[0]

Python objects to the line because err is not subscriptable.

My Python skills are dreadful so I did not attempt to fix this bug so I just replaced the line with


                errCode = err
                print(err)```

which reveals the error codes
delboy711 commented 1 year ago

Ok I think I have found the problem. There seems to be an issue with Pybluez release 0.23 causing the error. Pybluez-0.22 is Ok

I now have emonhub and SMASolarInterface working perfectly on a Debian 10(Buster) VM. I will try again with Debian 11 and a compiled version of PyBluez-0.22