tobiasfaust / SolaxModbusGateway

Modbus RTU to MQTT Gateway
GNU General Public License v3.0
54 stars 17 forks source link

X3 "nicht-Hybrid" #29

Closed thakikka closed 3 months ago

thakikka commented 10 months ago

Hallo,

ich habe einen Solax X3-8.0-T-D. Klappt es mit dem auch?

Als Laie habe ich nun einen fertigen Adapter eines Users gekauft, die mittels eines Lan-Splitters zusammen mit einem SmartMeter im Zählerschrank an den WR angeschlossen.

Ich bekomme aber leider keine Daten vom WR bzw. in "Raw Data" nur "Undefined".

siehe hier (mit Screenshots): https://www.photovoltaikforum.com/thread/177671-solax-x3-mic-modbus/?pageNo=3

tobiasfaust commented 10 months ago

Ich würde einfach mal behaupten das das Modbus Protokoll des X3 Hybrid sich zu deinem normalen X3 unterscheidet und dein WR nur Müll zurückgibt weil er die Anfrage nicht versteht.

Kannst ja mal zum Test die anderen verfügbaren WR aus der Auswahlliste ausprobieren ob bei einem etwas sinnvolles zurückkommt.

edit: nicht Solax x3 sondern bitte mal Solax MIC auswählen

thakikka commented 10 months ago

image

Klappt leider auch nicht. Spannenderweise wird der Modbusadapter selbst in ioBroker erkannt, aber es kommen einfach keine (lesbaren) Daten an:

image

In der SolaxCloud ist die Bezeichnung des WR übrigens "X3-MIC/PRO". Aber scheint mit "Solax MIC" als Auswahl leider auch nicht zu klappen.

kommando828 commented 10 months ago

You need to ask Solax support for the modbus register for your exact model and firmware and then compare it to the ones already supported by Tobias. Also you may need to go into the inverters settings and turn on Modbus RTU and set the address to 1 as they may not be correctly set by default.

thakikka commented 10 months ago

Thank you for your answers.

In the inverter settings, the address is already set to 1. In the meantime also on test to 2.

I have today written to Solax support with the request for a firmware update. I will write to them again and ask for a suitable modbus register.

kommando828 commented 10 months ago

Tobias has included a selection of the Solax Modbus pdf's

https://github.com/tobiasfaust/SolaxModbusGateway/tree/development/docs

So once you have the one from Solax for your inverter and can check against these to see the closest match.

Their naming on the inverters and the model numbers on the inverters don't always match exactly which causes some confusion. Not including the Generation of the inverter is another issue.

juwild83 commented 5 months ago

Hello everyone,

Has anything already happened on this topic? I also have an X3 inverter without a “hybrid”. Best regards

tobiasfaust commented 5 months ago

Hi, unfortunally - no. you need the right modbus protocol description document before you are able to start

juwild83 commented 5 months ago

Hello, I probably got the relevant protocols from a post from the “Photovoltaikforum”. I just don't know enough about the subject and won't start changing the code now.

Best regards

tobiasfaust commented 5 months ago

Can you Upload it here please?

juwild83 commented 5 months ago

1.On-grid INV-20240125T205749Z-001.zip

Of course I can do that

juwild83 commented 5 months ago

I have the X3-10 myself. In my opinion this should fit: Solax Power X3-MIC three phase inverter Modbus-RTU comms protocolV1.05 - public version

kommando828 commented 5 months ago

Just be aware that Solax have several generations of each inverter but fail to identify the generation in some cases. So in this case the PDF you have pointed to is for a X3-MIC Gen1, in your zip there is also a PDF for the Gen2. So its worth taking a bit longer to do a check which Generation your inverter is.

tobiasfaust commented 5 months ago

As I saw in your documents, all MIC X3 types hold their live dataregister ap from 0x0400 by functioncode 0x04. So if you select Solax-MIC it should be fine basicly. How looks the rawdata page if you select "Solax-MIC"? Please post a screenshot

thakikka commented 5 months ago

You need to ask Solax support for the modbus register for your exact model and firmware and then compare it to the ones already supported by Tobias. Also you may need to go into the inverters settings and turn on Modbus RTU and set the address to 1 as they may not be correctly set by default.

solax.zip

I have now received an e-mail from Solax confirming that the firmware update has been installed as requested. The following files have also been sent to me. Is there anything you can do with them?

thakikka commented 5 months ago

grafik grafik

(I also tried 9600 as Modbus Baudrate. Same result.)

juwild83 commented 5 months ago

same for me

kommando828 commented 5 months ago

The label on the inverter should identify the Gen with the exception of Generation 1, all other Gen's should have on the label G2/G3/G4 and so on. Also check the picture on the title page of PDF matches your inverter. For the X3-MIC there only seems to be Gen 1 and Gen 2 from what I can see but other types are at Gen 4.

tobiasfaust commented 5 months ago

I know that Problem. Your inverter Firmware is too Old that you cannot request 64byte in one Single request. Please try to change it.

please select the Master branch and check it out via gitpod (See Wiki Page) Please change 0x40 to 0x16

"RequestLiveData": [ ["#ClientID", "0x04", "0x04", "0x00", "0x00", "0x16"] ], After that recompile and Upload the new firmware. If it works you can increase 0x16 in small steps

please be sure, your baudrate is in sync with your inverter settings

kommando828 commented 5 months ago

Tips when comms are dead.

  1. Check baud rate is correct, for X3-MIC G1 and G2 this is 9600 but be prepared to try other baud rates.
  2. Swap the two RS485 wires around, not everyone labels them correctly, Janitza is one where this works,
  3. Check the cable you are using is a good quality cable, some are copper plated aluminium, even solid copper fractures internally. I always use 24awg stranded copper wire network cable. This fixed my dead comms with an X1-Boost G3, I then hit the too many registers requested issue.
JMyrng commented 5 months ago

I know that Problem. Your inverter Firmware is too Old that you cannot request 64byte in one Single request. Please try to change it.

Hi, same problem here. I've asked the support for a firmware update but they replied that is was already the latest version.

X3-MIC-10.0 TD

tobiasfaust commented 5 months ago

I know that Problem. Your inverter Firmware is too Old that you cannot request 64byte in one Single request. Please try to change it.

Hi, same problem here. I've asked the support for a firmware update but they replied that is was already the latest version.

X3-MIC-10.0 TD

Please do the described changes to make sure that this is the problem.

JMyrng commented 5 months ago

Please do the described changes to make sure that this is the problem.

I can only find the "RequestLiveData" files in the dev branch, but I compield the new firmware. Is it possible to upload that over the web portal or should I do it via ESP32 Flash download tools?

tobiasfaust commented 5 months ago

If you uses the dev branch, you have to flash via ESP32 flash download tool (see gitpos wiki) If you used the master branch, you can also use the web portal upload. Currently I redesign the file handling, because that there are differences between dev and master

JMyrng commented 5 months ago

I currently only have access via network. So where can I change these settings in the master branch?

thakikka commented 5 months ago

The label on the inverter should identify the Gen with the exception of Generation 1, all other Gen's should have on the label G2/G3/G4 and so on. Also check the picture on the title page of PDF matches your inverter. For the X3-MIC there only seems to be Gen 1 and Gen 2 from what I can see but other types are at Gen 4.

5

thakikka commented 5 months ago

So, ich habe mich da jetzt mal als absoluter Laie versucht durchzukämpfen.

grafik

Die Änderung habe ich für "Solax-Mic" vorgenommen. Danach habe ich unten in der Befehlszeile mittels "platformio run" das Ganze erneut erstellen lassen. Dann habe ich aus dem Ordner .pio/build/ die Datei firmware.bin heruntergeladen und auf den Adapter als Firmware hochgeladen.

grafik

Hat offensichtlich geklappt?

Leider weiterhin keine Daten bei RawData, egal was ich probiere bei den Einstellungen.

grafik

tobiasfaust commented 5 months ago

Wir müssen jetzt rausfinden wo es hängt! Stell mal bitte LogLevel auf 5 (Basis Config) und poste mal bitte das Log welches auf der seriellen Konsole ausgegeben wird. siehe auch: Q&A

thakikka commented 5 months ago

Entschuldige meine Unwissenheit, aber muss ich dafür den Adapter an meinen PC anschließen? Oder lasse ich ihn am Wechselrichter? Ich habe in den FAQ gelesen, dass ich "hterm" installieren soll. Bin gerade offen gesagt etwas überfordert.

tobiasfaust commented 5 months ago

Der ESP muss an den WR (sonst kannst du ja keine Daten empfangen) sowie per USB an den Laptop (damit du siehst (-> über hterm) was vom WR am ESP ankommt).

thakikka commented 5 months ago

Danke für deine Hilfe, aber ich merke leider, dass ich hier an meinem persönlichen Skill Cap angekommen bin. Ich kriege weder auf dem Laptop noch testweise am PC eine Verbindung hin.

Ist der USB-Anschluss, an dem das Ladegerät hängt, auch der USB-Anschluss, den ich mit dem PC/Laptop verbinde? EInen anderen USB-Anschluss konnte ich nicht entdecken.

Unbenannt

tobiasfaust commented 5 months ago

Ja genau, also anstatt usb zum Ladegerät gehts an den Laptop Versuch dich mal mit Google schlau zu machen, da gibt es ganz viele , auch bebilderte, howtos wie man starten kann :)

thakikka commented 5 months ago

output_2024-01-31_15-15-08.txt

Ich habe es geschafft. Danke für deine Geduld.

Dummerweise hatte ich "Timestamps" aktiviert, aber ich denke, es ist trotzdem aufschlußreich. Nämlich das egal was ich währenddessen an unterschiedlichen Einstellungen probiert habe, es nie zu irgendeiner Ausgabe von Daten kam :(

Ich hatte weiter oben die ZIP-Datei hochgeladen, die mir von Solax zugeschickt wurde. Passt das denn so überhaupt mit dem Modregister?

tobiasfaust commented 5 months ago

Dein WR antwortet nicht. "No response" Bitte überprüfe zuerst in den Einstellungen deines WR welche ModbusID und Baudrate dieser verwendet. Danach check auch unbedingt ob du über den RJ Stecker auch die korrekten Pins mit dem Modbussignal abgreifst. Schau dazu in die Doku des WR. Auf der RS485 Platine müssen sowohl RX als auch TX aufblinken. Dazu must du mal alles (siehe dein Bild oben) aus dem Gehäuse herausholen.

thakikka commented 5 months ago

Unbenannt

Ich habe das mir von Solax zugeschickte ZIP nochmal durchgeschaut und meine, dass hier dürfte die für meinen WR passende PDF sein: Solax Power X3-MIC three phase inverter Modbus-RTU comms protocolV1.05 - public version.pdf

Ich weiss nun leider nicht, ob das ggf. eine Hilfe bei der Lösungsfindung sein könnte, aber zumindest konnte ich dem PDF entnehmen, dass die Baudrate wohl 9600 sein sollte. Im WR selbst konnte ich dazu keine Info/Einstellmöglichkeit finden.

Unbenannt

Das habe ich zur der ModbusID finden können. Ich habe irgendwo den Tipp aufgeschnappt, dass ich in Verbindung mit dem Splitter, den ich verwenden muss, weil die Verbindung zu dem Stromzähler zwingend erforderlich bestehen bleiben muss, da ansonsten der WR direkt in einen Fehlermodus geht, die ModbusID im Gateway daher auf 02 stellen müsste.

Ausprobiert habe ich inzwischen aber sämtliche Varianten, also sowohl 01 als auch 02. Stets ohne Erfolg.

Hier zur Veranschaulichung ein Bild von dem Splitter:

Unbenannt-1

Liegt da ggf. der Fehler? Muss ich da etwas gesondert beachten bzw. einstellen, dass die Verbindung endlich klappt?

Die Platine würde ich mir gerne (auch von unten) anschauen, aber noch war es mir nicht möglich, diese aus dem Gehäuse zu lösen. Zur Not muss ich das Gehäuse von unten vorsichtig aufschneiden oder so...

tobiasfaust commented 5 months ago

Ich weiß nicht wie der Splitter funktioniert. Probier erstmal ohne Splitter direkt am WR. Egal ob der WR in einen fehlermodus geht oder nicht. Du musst eine Fehlerquelle erstmal ausschließen.

lexxmm commented 3 months ago

Gibt es hier News? Habe das selber Problem mit einem X3-MIC-4K-G2 und empfange nur

undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined

juwild83 commented 3 months ago

Hallo, ich hab das für mich jetzt anders gelöst. Habe auf ESPHome auf den "Adapter" geflasht. Die Adressen dann mit in die Konfiguration gepackt und kann alles jetzt mit Home Assistant auslesen.

PatrickEscher commented 3 months ago

@juwild83: Hallo, versuche auch verzweifelt meinen X3 Gen1 anzubinden. kannst du genauer erklären was du genau gemacht hast? Danke und Gruß

juwild83 commented 2 months ago

Hi,

ich benutze Home Assistant mit ESPHome und das ist der Code:

esphome:
  name: esphome-web-0ffdc4
  friendly_name: ESPHome Solax RTU

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable Home Assistant API
api:
  encryption:
    key: "--Dein API-Key--"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-C96Ba8"
    password: "Passwort"

substitutions:
  name: solax-x3
  device_description: "Monitor a Solax X3 Boost via RS485"
  tx_pin: GPIO17
  rx_pin: GPIO16

ota:

logger:
  level: DEBUG

# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
# The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt
#mqtt:
#  broker: !secret mqtt_host
#  username: !secret mqtt_username
#  password: !secret mqtt_password
#  id: mqtt_client

# api:

uart:
  id: uart_0
  baud_rate: 9600
  tx_pin: ${tx_pin}
  rx_pin: ${rx_pin}

modbus:
  - id: modbus0
    uart_id: uart_0
#    flow_control_pin: GPIO0

modbus_controller:
  - id: solax0
    address: 0x1
    modbus_id: modbus0
    setup_priority: -10
    update_interval: 15s

#text_sensor:
#  - platform: modbus_controller
#    modbus_controller_id: solax0
#    name: "${name} operation mode"
#    address: 0x40f
#    register_type: read
#    raw_encode: HEXBYTES
#    lambda: |-
#      uint16_t value = modbus_controller::word_from_hex_str(x, 0);
#      switch (value) {
#        case 0: return std::string("Waiting");
#        case 1: return std::string("Checking");
#        case 2: return std::string("Normal");
#        case 3: return std::string("Fault");
#        case 4: return std::string("Permanent Fault");
#        case 5: return std::string("Update");
#        case 6: return std::string("Off-grid waiting");
#        case 7: return std::string("Off-grid");
#        case 8: return std::string("Self Testing");
#        case 9: return std::string("Idle");
#        case 10: return std::string("Standby");
#      }
#      return std::string("Unknown");

sensor:
  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} PV1 input voltage"
    address: 0x400
    register_type: read
    value_type: U_WORD
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} PV2 input voltage"
    address: 0x401
    register_type: read
    value_type: U_WORD
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} PV1 iput crrent"
    address: 0x402
    register_type: read
    value_type: U_WORD
    unit_of_measurement: A
    device_class: current
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} PV2 input current"
    address: 0x403
    register_type: read
    value_type: U_WORD
    unit_of_measurement: A
    device_class: current
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} grid voltage L1"
    address: 0x404
    register_type: read
    value_type: U_WORD
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} grid voltage L2"
    address: 0x405
    register_type: read
    value_type: U_WORD
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} grid voltage L3"
    address: 0x406
    register_type: read
    value_type: U_WORD
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} grid frequency L1"
    address: 0x407
    register_type: read
    value_type: U_WORD
    unit_of_measurement: Hz
    device_class: frequency
    state_class: measurement
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} grid frequency L2"
    address: 0x408
    register_type: read
    value_type: U_WORD
    unit_of_measurement: Hz
    device_class: frequency
    state_class: measurement
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} grid frequency L3"
    address: 0x409
    register_type: read
    value_type: U_WORD
    unit_of_measurement: Hz
    device_class: frequency
    state_class: measurement
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} output current L1"
    address: 0x40A
    register_type: read
    value_type: U_WORD
    unit_of_measurement: A
    device_class: current
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} output current L2"
    address: 0x40B
    register_type: read
    value_type: U_WORD
    unit_of_measurement: A
    device_class: current
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} output current L3"
    address: 0x40C
    register_type: read
    value_type: U_WORD
    unit_of_measurement: A
    device_class: current
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} temperature"
    address: 0x40D
    register_type: read
    value_type: U_WORD
    unit_of_measurement: "°C"
    device_class: temperature
    state_class: measurement
    accuracy_decimals: 0

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} Output power"
    address: 0x40E
    register_type: read
    value_type: U_WORD
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    accuracy_decimals: 0

# Inverter Status 40F
#und weitere

  - platform: modbus_controller
    modbus_controller_id: solax0
    #id: solax0_total_dc_power
    name: "${name} total dc power"
    address: 0x413
    register_type: read
    value_type: U_WORD
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    accuracy_decimals: 0

  - platform: modbus_controller
    modbus_controller_id: solax0
   # id: solax0_power_dc1
    name: "${name} power dc1"
    address: 0x414
    register_type: read
    value_type: U_WORD
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    accuracy_decimals: 0

  - platform: modbus_controller
    modbus_controller_id: solax0
    #id: solax0_power_dc2
    name: "${name} power dc2"
    address: 0x415
    register_type: read
    value_type: U_WORD
    unit_of_measurement: W
    device_class: power
    state_class: measurement
    accuracy_decimals: 0

#  - platform: template
#    id: solax0_total_dc_power
#    name: "${name} total dc power"
#    update_interval: never
#    unit_of_measurement: W
#    device_class: power
#    state_class: measurement
#    accuracy_decimals: 0
#    lambda: |-
#      return (id(solax0_power_dc1).state + id(solax0_power_dc2).state);

  - platform: modbus_controller
    modbus_controller_id: solax0
    id: solax0_fault_value_l1
    name: "${name} Fault value L1"
    address: 0x416
    register_type: read
    value_type: U_WORD
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    id: solax0_fault_value_l2
    name: "${name} Fault value L2"
    address: 0x417
    register_type: read
    value_type: U_WORD
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    id: solax0_fault_value_l3
    name: "${name} Fault value L3"
    address: 0x418
    register_type: read
    value_type: U_WORD
    unit_of_measurement: V
    device_class: voltage
    state_class: measurement
    accuracy_decimals: 1
    filters:
      - multiply: 0.1

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} Fault value frequency L1"
    address: 0x419
    register_type: read
    value_type: U_WORD
    unit_of_measurement: Hz
    device_class: frequency
    state_class: measurement
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} Fault value frequency L2"
    address: 0x41a
    register_type: read
    value_type: U_WORD
    unit_of_measurement: Hz
    device_class: frequency
    state_class: measurement
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} Fault value frequency L3"
    address: 0x41b
    register_type: read
    value_type: U_WORD
    unit_of_measurement: Hz
    device_class: frequency
    state_class: measurement
    accuracy_decimals: 2
    filters:
      - multiply: 0.01

###Hier fehlen noch einige Werte

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} energy total"
    address: 0x423
    register_type: read
    value_type: U_WORD
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    accuracy_decimals: 1
    filters:
      - multiply: 0.001

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} energy total MSB"
    address: 0x424
    register_type: read
    value_type: U_WORD
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    accuracy_decimals: 1
    filters:
      - multiply: 0.001

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} energy today"
    address: 0x425
    register_type: read
    value_type: U_WORD
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    accuracy_decimals: 1
    filters:
      - multiply: 0.001

  - platform: modbus_controller
    modbus_controller_id: solax0
    name: "${name} energy today MSB"
    address: 0x426
    register_type: read
    value_type: U_WORD
    unit_of_measurement: kWh
    device_class: energy
    state_class: total_increasing
    accuracy_decimals: 1
    filters:
      - multiply: 0.001