Skip to main content

Python library to access Studer-Innotec Xcom-232i device through RS-232 over a serial port

Project description

xcom-232i

Python library to access Studer-Innotec Xcom-232i device through RS-232 over a serial port.

NOTE: This lib is still WiP, so functionality is still limited, but feel free to create a pull request if you want to contribute ;)

DISCLAIMER: This library is NOT officially made by Studer-Innotec.

The complete official documentation is available on:
Studer-Innotec Download Center -> Software and Updates -> Communication protocol Xcom-232i

Getting Started

Requirements

Hardware

  • Xcom-232i connected to your installation
  • Xcom-232i connected to PC using USB to RS-232 adapter (1)
  • PC with at least USB2.0 or faster (works on Raspberry Pi 3/4 as well)

(1) I personally am successfully using an adapter with the PL2303 chipset like this one

Software

  • any Linux based OS (x86 / ARM)
  • python3 >= 3.6
  • python3-pip

Installation

pip3 install xcom-232i

important: make sure you select the USB to RS-232 adapter as the socket_device, usually on Linux it is /dev/ttyUSB[0-9]

Examples

Reading values

from xcom_232i import XcomRS232
from xcom_232i import XcomC as c

IO = XcomRS232(socket_device='/dev/ttyUSB0', baudrate=115200)

lademodus = IO.get_value(c.OPERATION_MODE)
batt_phase = IO.get_value(c.BAT_CYCLE_PHASE)
solarleistung = IO.get_value(c.PV_POWER) * 1000 # convert from kW to W
sonnenstunden = IO.get_value(c.NUM_SUN_HOURS_CURR_DAY)
ladestand = IO.get_value(c.STATE_OF_CHARGE) # in %
stromprod = IO.get_value(c.PROD_ENERGY_CURR_DAY)
batt_strom = IO.get_value(c.BATT_CURRENT)
batt_spann = IO.get_value(c.BATT_VOLTAGE)

print(f"LModus: {lademodus} | Batt_Phase: {batt_phase} | Solar_P: {solarleistung} | SonnenH: {sonnenstunden} | Batt_V: {batt_spann} | SOC: {ladestand}")

Writing values

from xcom_232i import XcomRS232
from xcom_232i import XcomC as c

IO = XcomRS232(socket_device='/dev/ttyUSB0', baudrate=115200)

# write into RAM
IO.set_value(c.SMART_BOOST_LIMIT, 100) # set smart boost limit
IO.set_value(c.FORCE_NEW_CYCLE, 1, property_id=c.VALUE_QSP) # force new charge cycle

# explanation for property_id:
c.VALUE_QSP # write into Flash memory (important: you should write into flash only if you *really* need it!)
c.UNSAVED_VALUE_QSP # write into RAM (default)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xcom_232i-0.1.4.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xcom_232i-0.1.4-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file xcom_232i-0.1.4.tar.gz.

File metadata

  • Download URL: xcom_232i-0.1.4.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.10 Linux/5.8.18-050818-generic

File hashes

Hashes for xcom_232i-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d9655d82ee7248eff058b6e8c46ecd9b0d76920062631d852f99b501515e685d
MD5 67e50f02ca9d83c601c9a238bba19483
BLAKE2b-256 1998792a1133ce64c66fde0bda7080a8d8fa0ea16b3db8d67a6b434ebe20f12a

See more details on using hashes here.

File details

Details for the file xcom_232i-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: xcom_232i-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.10 Linux/5.8.18-050818-generic

File hashes

Hashes for xcom_232i-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e86e21c50a381e5abd115486471e3cd52b1c593abdd225363d7e4a5f115dbffa
MD5 7ce47f4a08522419b8b4217de7ba8914
BLAKE2b-256 1a75bce6c4d3624c479133648387cf69ce4536bc331484702208a8ea8a1f7022

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page