Skip to main content

Python library implementing Studer-Innotec Xcom protocol used by Xcom-232i and Xcom-LAN

Project description

xcom-protocol

Python library implementing Studer-Innotec Xcom protocol for Xcom-232i and Xcom-LAN.

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 or Xcom-LAN connected to your installation
  • Xcom-232i connected to PC using USB to RS-232 adapter (1)
  • or PC in same subnet as Xcom-LAN device
  • 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.9
  • python3-pip

Installation

TODO

important:

  • make sure you select the USB to RS-232 adapter as the serialDevice, usually on Linux it is /dev/ttyUSB[0-9]
  • when using Xcom-LAN make sure it is set up properly and reachable via a static IP in the local network

Examples

Reading values

from xcomProto import XcomP as param
from xcomProto import XcomRS232
from xcomProto import XcomLAN

xcom = XcomRS232(serialDevice="/dev/ttyUSB0", baudrate=115200)
# OR
xcom = XcomLAN("192.168.178.110")

boostValue = xcom.getValue(param.SMART_BOOST_LIMIT)

pvmode = xcom.getValue(param.PV_OPERATION_MODE)
pvpower = xcom.getValue(param.PV_POWER) * 1000 # convert from kW to W
sunhours = xcom.getValue(param.PV_SUN_HOURS_CURR_DAY)
energyProd = xcom.getValue(param.PV_ENERGY_CURR_DAY)

soc = xcom.getValue(param.BATT_SOC)
battPhase = xcom.getValue(param.BATT_CYCLE_PHASE)
battCurr = xcom.getValue(param.BATT_CURRENT)
battVolt = xcom.getValue(param.BATT_VOLTAGE)

print("|".join(
    [boostValue, pvmode, pvpower, sunhours, energyProd, soc, battPhase, battCurr, battVolt]
))

Writing values

IMPORTANT: setValue() has an optional named parameter propertyID which you can pass either:

  • XcomC.QSP_UNSAVED_VALUE: writes value into RAM only (default when not specified)
  • XcomC.QSP_VALUE: writes value into flash memory; you should write into flash only if you really need it, write cycles are limited!
from xcomProto import XcomP as param
from xcomProto import XcomC
from xcomProto import XcomRS232
from xcomProto import XcomLAN

xcom = XcomRS232(serialDevice="/dev/ttyUSB0", baudrate=115200)
# OR
xcom = XcomLAN("192.168.178.110")

xcom.setValue(param.SMART_BOOST_LIMIT, 100) # writes into RAM
xcom.setValue(param.FORCE_NEW_CYCLE, 1, propertyID=XcomC.QSP_VALUE) # writes into flash memory

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_proto-0.2.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

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

xcom_proto-0.2.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file xcom_proto-0.2.0.tar.gz.

File metadata

  • Download URL: xcom_proto-0.2.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-75-generic

File hashes

Hashes for xcom_proto-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3d4ff01c00d7aed6ceed3147f4704ac8ff2dc804247d56c03469db8ac41e98ee
MD5 dd1329bc3d2c81d7312190c36d275e25
BLAKE2b-256 6e03477ee9ee0c1f1623601a89fa8d0bc94f2141a66875c15dcb06d3559ffdad

See more details on using hashes here.

File details

Details for the file xcom_proto-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: xcom_proto-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-75-generic

File hashes

Hashes for xcom_proto-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4743cf6bcf99b20a9ef3ed4a04c2427b6da66e84223b8f0bbb7008eb63fbfeb3
MD5 f78a86e1fd30d2c90891a4422c3cd1c7
BLAKE2b-256 a013b96d8882d5957276b581a3e04c65d2a61a181c82bc5765d7a6a990565e24

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