Connecting Xantrex inverter via RS232 to home assistant

Hi,
I’m looking to connect my Xantrex GT2800 solar inverter to home assistant running on a PC running Hass OS. The inverter is connected directly to a 9 pin serial port on the back of the PC

I have managed to get the port configured in the configuration. Yaml file with this

  • platform: serial
    serial_port: /dev/ttyS0
    baudrate: 9600

However now not sure about getting the data into home assistant

I found this link on how to get it working with an ESP8266, however I want to connect directly with the serial connection

https://www.google.com/url?sa=t&source=web&rct=j&url=https://thehomeautomator.com.au/xantrex-logging/amp/&ved=2ahUKEwjUjY2z9rf9AhWsA7cAHWpXCmoQFnoECAkQAQ&usg=AOvVaw13PSkVebzCpXZKkkUN0IAh

Does anyone have any ideas on how to convert this process to work with the serial RS232

I note that it has a xantrex.h file associated to the esp home configuration file

Thanks Danny

hey guys, does anyone have any knowledge on this?

Hi Danny,

I wrote the ESPHome code that example you found was based on. Here’s my github GitHub - clockbrain/xantrex: ESP8266 esphome configuration to read Xantrex GT2.8 data via serial port.

Of course TheHomeAutomator website has done a much better job of documenting the setup than me.

I don’t think what you want to do with Home Assistant Serial platform is going to work. The Xantrex inverter doesn’t continuously report its values. It needs prompting for each value and that is why an ESP8266 is used and what much of the xantrex.h code does. It cycles through sending a serial prompt for each value (such as kWh, volts, current, etc) and waiting 2 seconds for the Xantrex inverter to respond on the serial port.

From what I can tell, the Home Assistant Serial platform is read only and doesn’t offer a mechanism to prompt the Xantrex. I don’t have any experience with the Serial platform though so can’t really help in that regard.

Best of luck.
Don

INFO ESPHome 2023.5.5
INFO Reading configuration /config/esphome/xantrex.yaml…
INFO Generating C++ source…
INFO Compiling app…
Processing xantrex (board: d1_mini; framework: arduino; platform: platformio/[email protected])

HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
Dependency Graph
|-- ESPAsyncTCP-esphome @ 1.2.3
|-- ESPAsyncWebServer-esphome @ 2.1.0
| |-- ESPAsyncTCP-esphome @ 1.2.3
| |-- Hash @ 1.0
| |-- ESP8266WiFi @ 1.0
|-- DNSServer @ 1.1.1
|-- ESP8266WiFi @ 1.0
|-- ESP8266mDNS @ 1.2
|-- noise-c @ 0.1.4
| |-- libsodium @ 1.10018.1
Compiling /data/xantrex/.pioenvs/xantrex/src/main.cpp.o
Compiling /data/xantrex/.pioenvs/xantrex/FrameworkArduino/core_esp8266_phy.cpp.o
Compiling /data/xantrex/.pioenvs/xantrex/FrameworkArduino/core_esp8266_postmortem.cpp.o
Compiling /data/xantrex/.pioenvs/xantrex/FrameworkArduino/core_esp8266_si2c.cpp.o
Compiling /data/xantrex/.pioenvs/xantrex/FrameworkArduino/core_esp8266_sigma_delta.cpp.o
In file included from src/main.cpp:41:
src/xantrex.h: In member function ‘virtual void Xantrex::setup()’:
src/xantrex.h:39:5: error: ‘setTimeout’ was not declared in this scope; did you mean ‘set_timeout’?
39 | setTimeout(30);
| ^~~~~~~~~~
| set_timeout
src/xantrex.h: In member function ‘virtual void Xantrex::loop()’:
src/xantrex.h:51:18: error: ‘readStringUntil’ was not declared in this scope
51 | line = readStringUntil(’\r’);
| ^~~~~~~~~~~~~~~
Compiling /data/xantrex/.pioenvs/xantrex/FrameworkArduino/core_esp8266_spi_utils.cpp.o
Compiling /data/xantrex/.pioenvs/xantrex/FrameworkArduino/core_esp8266_timer.cpp.o
Compiling /data/xantrex/.pioenvs/xantrex/FrameworkArduino/core_esp8266_vm.cpp.o
Compiling /data/xantrex/.pioenvs/xantrex/FrameworkArduino/core_esp8266_waveform_phase.cpp.o
Compiling /data/xantrex/.pioenvs/xantrex/FrameworkArduino/core_esp8266_waveform_pwm.cpp.o
*** [/data/xantrex/.pioenvs/xantrex/src/main.cpp.o] Error 1
========================== [FAILED] Took 3.22 seconds ==========================

I’ve answered this one in your other post ESP Home - Java script issue - #6 by clockbrain