Hi Darren,
I’m so glad I came across this contribution by yourself. I wanted to couple my solis ginlong inverter with openhab, but couldn’t find any binding for it. For other inverters (e.g. SMA) there are already 2.0 bindings.
However, with your script I should be able to perfectly read all variables from my inverter. I’m not a linux nor python expert however and so far have not used MQTT, so I need a bit of guidance.
Following is what I did already:
- Logged into my inverter and was able to add a second IP option. I pointed that to the internal IP address of my Rapsberry PI (192.168.2.20). Added port 9999 and chose protocol SolarMAN-1.
Tested it, which gave an OK tickmark
-
Python was already installed on my PI. I understood the following modules are already part of the standard installation: socket, binascii, time, sys, string.
-
Added the python module paho-mqtt:
sudo pip install paho-mqtt
Which installed fine
- I then installed Mosquitto on my PI:
sudo apt-get install mosquitto mosquitto-clients python-mosquitto
And then added a mosquitto.conf file in the /etc/mosquitto/conf.d directory with following content:
user ginlong
max_queued_messages 200
message_size_limit 0
allow_zero_length_clientid true
allow_duplicate_messages false
listener 1883
autosave_interval 900
autosave_on_changes false
persistence true
persistence_file mosquitto.db
allow_anonymous true
password_file /etc/mosquitto/passwd
Then did a restart
sudo systemctl restart mosquito
And finally ran mosquitto:
Mosquitto
If I now run mosquitto again, It sais:
1518956001: mosquitto version 1.3.4 (build date 2017-05-29 22:25:09+0000) starting
1518956001: Using default config.
1518956001: Opening ipv4 listen socket on port 1883.
1518956001: Error: Address already in use
So it seems Mosquitto is listening on port 1883.
- I copied your files to a directory of my PI, but renamed your config.ini-default to config.ini
I then ran the python script to see if it is working.
Python ginglong-listen.py
I get following:
waiting for a connection
Finally
waiting for a connection
Then nothing happens… When I press CTRL^C I get following:
^CTraceback (most recent call last):
File "ginlong-listen.py", line 57, in <module>
conn,addr = sock.accept()
File "/usr/lib/python2.7/socket.py", line 202, in accept
sock, addr = self._sock.accept()
KeyboardInterrupt
I’m a bit stuck now… Could you give me some guidance on what to do next? I guess the next thing I need to do is to run the python script as a service (daemon). Don’t really know how to do that. However, before doing that, I first need to make sure that the script is actually finding a connection, which doesn’t seem to be the case now…
Thanks for your help! I think I’m pretty close already to the solution…