aaronmelton / solark_monitor

A Python script to read memory register(s) from Sol-Ark Inverters and insert them into a database.
10 stars 3 forks source link

No serial use in this code example? #3

Closed TheGuruOfNothing closed 1 week ago

TheGuruOfNothing commented 2 weeks ago

I am trying to use this script for my Solark monitoring and it appears that there is some missing items in the code regarding the usage of RTU with a USB adapter. I am not seeing anywhere in the code that it selects between RTU an TCP but seems to default to TCP when either --pull or --push is selected, which gives erros related to connection to inverter. I have tried to force it to select RTU by changing solark = connect_solark(config.modbus_dict_tcp) to modbus_dict_ser. When I do, it stops logging and may not be even attempting connection. Any guidance as to what I am doing wrong?

aaronmelton commented 2 weeks ago

That is the correct approach based on how I wrote the script. I encountered some compatibility issues with the pymodbus package that sent me back into the IDE to do a minor re-write on the script but I haven't got it to a place where it's suitable for publishing yet. I'll try and polish that up and commit it this week and we'll see if it resolves your issue.

As a test, I cloned the existing project onto a new Linux box and still couldn't get it to run so there's definitely something that has changed with the libraries that needs to get sorted out.

aaronmelton commented 2 weeks ago

@TheGuruOfNothing Great news! I locked the office door, cranked the tunes up and hammered out some code this evening that should resolve the issue. It's working with with Serial and TCP connections. Gonna leave it over-night and give it a fresh look tomorrow but I'll commit something tomorrow that you can test...

TheGuruOfNothing commented 2 weeks ago

That is awesome. I am new enough to coding (hardly in Python) that I could see that it had an issue but couldn't figure out how to change it. I look forward to seeing the commit. I just bought this Solark and I love data! Out of curiosity, what did you do to access the data through TCP connection wise? I didn't see any of that info in the readme

aaronmelton commented 2 weeks ago

@TheGuruOfNothing Check out v0.6.0 and see if this resolves your issue. Let me know if the instructions aren't clear.

TheGuruOfNothing commented 1 week ago

Took me a bit to sort out a few things but I have one error to note. In the database setup file, the very last register - generator_relay_frequency decimal(2,1) unsigned DEFAULT NULL, (2,1) needs to be a (3,1) or it gives out of range error. Other than that, works all fancy like in serial. I think I will be yanking the wifi dongle now that I don't need it. Thank you very much for your work on this project!

aaronmelton commented 6 days ago

The script must be returning a value (for you) for generator_relay_frequency as mine consistently returns 0.0.

I'm assuming you have a generator connected to your system for it to produce a value?

TheGuruOfNothing commented 6 days ago

Lol... I guess I found a bug that you would not have come across in your usage. I actually have my grid power for charging on that input at the moment while I test an tweak and it just happened to be charging when I was doing my final testing. The script it working flawlessly. Thank you!

On Wednesday, September 25, 2024 at 07:26:53 AM MDT, Aaron Melton ***@***.***> wrote:  

The script must be returning a value (for you) for generator_relay_frequency as mine consistently returns 0.0.

I'm assuming you have a generator connected to your system for it to produce a value?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

aaronmelton commented 6 days ago

@TheGuruOfNothing Thanks for keeping me honest!

TheGuruOfNothing commented 6 days ago

We are all in this soup together.....

On Wednesday, September 25, 2024 at 09:25:23 AM MDT, Aaron Melton ***@***.***> wrote:  

@TheGuruOfNothing Thanks for keeping me honest!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>