rjpearce / sofar2mqtt-python

This project provides an integration between Sofar inverters over RS485 and MQTT using Python It allows you to read and write data to Sofar inverters using a prebuilt Docker image or Python script
3 stars 0 forks source link

Question about calling write function in the program #17

Closed Anioz closed 6 months ago

Anioz commented 6 months ago

Im using your library in a docker environment for testing, mqtt broker serial connection everything is up and running, status messages come back for the me3000sp but my question is this, i would like to use the following in compliment with your code and are trying to find the most minimalistic approach of using it without modifying the original code too much: { "registers":[ { "name":"standby_mode", "function": "setmode", "register":"0x100", "write": true }, { "name":"discharge_mode", "function": "setmode", "register":"0x101", "write": true }, { "name":"charge_mode", "function": "setmode", "register":"0x102", "write": true }, { "name":"auto_mode", "function": "setmode", "register":"0x103", "write": true } ] }

Can you tell me where in the code to best put it and how i should call the methods topic string wise as to not conflict with other methods in your original code?

Ive pondered in putting it in the original sofar-me-3000.json but im unsure how to do this in a safe manner (dont want the code to be called along with the status messages by accident continuously for example)

To be more exact once my message has safely arrived in your code for example in onmessage and it doesnt conflict with other code i can safely stitch on from that if you could get me to that point. (I could do it myself as well but i consider that generally more unsafe than asking you directly as the conflicts could put unnecessary stress on the inverter and possibly wear it out faster)

rjpearce commented 6 months ago

You are precisely who I have been looking for :D

I have been wanting to bring write support to the ME3000 and ES inverters for a long time but without having access to a device I would be working in the dark.

sofar-me-3000.json is the correct place and you are on the right lines, I'm more than happy to work with you to make code changes to make this work. Would you be open for a video call so I can take you through the code and we can identify and test some of the changes? Feel free to email me directly or ping me on FB.

Can you confirm a couple of things for me:

  1. If you read 0x100, 0x101, 0x102 and 0x103 what response do you receive is it a string or an int?
  2. What value needs to be written is it a string or an int?
Anioz commented 6 months ago

Wheres your email at? i rather mail you directly or i can add you to skype so you can view my screen and we work trough it, happy to share the code as well

info i found scouring the net details it as this:

SOFAR_FN_STANDBY 0x0100 - send value "true"

SOFAR_FN_DISCHARGE0x0101 - send values in the range 0-3000 (watts)

SOFAR_FN_CHARGE 0x0102 - send values in the range 0-3000 (watts)

SOFAR_FN_AUTO 0x0103 - send value "true" or "battery_save"

Not sure yet tough

Anioz commented 6 months ago

if its u with the profile pic then your added (on skype)

Anioz commented 6 months ago

w00t problem solved, i will close this and mail you the working solution ^^