All Projects → svalouch → python-rctclient

svalouch / python-rctclient

Licence: GPL-3.0 license
Python client for RCTs Serial Communication Protocol

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to python-rctclient

solar-logger
A datalogger for a solar inverter. Stores data in influxdb and displays it in grafana. Has load diverting capability, to use the inverter's excess power
Stars: ✭ 53 (+96.3%)
Mutual labels:  solar, inverter
opensolar
Opensolar is a platform powered by openx for funding smart solar infrastructure using the Stellar blockchain.
Stars: ✭ 20 (-25.93%)
Mutual labels:  solar
GoodWeLogger
ESP8266 based logger for GoodWe inverters. Can upload to pvoutput and publishes MQTT topics
Stars: ✭ 79 (+192.59%)
Mutual labels:  inverter
ha skyfield
See the apparent positions of the Sun, Moon, and planets in this home assistant custom component
Stars: ✭ 26 (-3.7%)
Mutual labels:  solar
MPPT Buck Converter Synchronous
See video:
Stars: ✭ 25 (-7.41%)
Mutual labels:  solar
sunraster
A SunPy-affiliated package which provides tools to analyze data from spectral data from any solar mission.
Stars: ✭ 19 (-29.63%)
Mutual labels:  solar
3D-PV-Locator
Repo for "3D-PV-Locator: Large-scale detection of rooftop-mounted photovoltaic systems in 3D" based on Applied Energy publication.
Stars: ✭ 35 (+29.63%)
Mutual labels:  solar
Three.js-Solar-Exploration
🚀 Exploration the solar system created by Three.js
Stars: ✭ 24 (-11.11%)
Mutual labels:  solar
PVMismatch
An explicit Python PV system IV & PV curve trace calculator which can also calculate mismatch.
Stars: ✭ 51 (+88.89%)
Mutual labels:  solar
Essential-Solar-Energy-and-Storage-Software-Resources
Curated links to APIs, SDKs, paltforms and tools relevant to solar energy and battery storage
Stars: ✭ 44 (+62.96%)
Mutual labels:  solar
spacehunter
❤🍳 Space Hunter is a PWA (Progressive Web App) in which the user can have access to information regarding the universe.
Stars: ✭ 15 (-44.44%)
Mutual labels:  solar
SkyeTracker
Dual Axis solar tracker
Stars: ✭ 31 (+14.81%)
Mutual labels:  solar
ioBroker.plenticore
ioBroker Adapter for the KOSTAL Plenticore
Stars: ✭ 15 (-44.44%)
Mutual labels:  inverter
solarshed
A Python library to help monitor solar charge controllers typically used in off the grid applications.
Stars: ✭ 63 (+133.33%)
Mutual labels:  solar
sOS
Solar Operating System - The ASCII OS nobody asked for.
Stars: ✭ 11 (-59.26%)
Mutual labels:  solar
pygoodwe
Python library for querying Goodwe API
Stars: ✭ 20 (-25.93%)
Mutual labels:  solar
tonatiuh
A Monte Carlo ray tracer for the optical simulation of solar concentrating systems
Stars: ✭ 46 (+70.37%)
Mutual labels:  solar
imrc-datetime-picker
(Improved) React component datetime picker by momentjs 📆
Stars: ✭ 21 (-22.22%)
Mutual labels:  solar
shamsi date
A Flutter and Dart package for using Jalali (Shamsi, Solar, Persian or Jalaali) calendar. You can convert, format and manipulate Jalali and Gregorian (Miladi) date and times.
Stars: ✭ 59 (+118.52%)
Mutual labels:  solar
solar-forecasting-RNN
Multi-time-horizon solar forecasting using recurrent neural network
Stars: ✭ 29 (+7.41%)
Mutual labels:  solar

rctclient - Python implementation of the RCT Power GmbH "Serial Communication Protocol"

This Python module implements the "Serial Communication Protocol" by RCT Power GmbH, used in their line of solar inverters. Appart from the API, it also includes a registry of object IDs and a command line tool. For development, a simple simulator is included.

This project is not in any way affiliated with or supported by RCT Power GmbH.

Documentation

Below is a quickstart guide, the project documentation is on Read the Docs.

Installing

Install and update using pip:

$ pip install -U rctclient

To install the dependencies required for the CLI tool:

$ pip install -U rctclient[cli]

Example

Let's read the current battery state of charge:

import socket, select, sys
from rctclient.frame import ReceiveFrame, make_frame
from rctclient.registry import REGISTRY as R
from rctclient.types import Command
from rctclient.utils import decode_value

# open the socket and connect to the remote device:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('192.168.0.1', 8899))

# query information about an object ID (here: battery.soc):
object_info = R.get_by_name('battery.soc')

# construct a frame that will send a read command for the object ID we want, and send it
send_frame = make_frame(command=Command.READ, id=object_info.object_id)
sock.send(send_frame)

# loop until we got the entire response frame
frame = ReceiveFrame()
while True:
    ready_read, _, _ = select.select([sock], [], [], 2.0)
    if sock in ready_read:
        # receive content of the input buffer
        buf = sock.recv(256)
        # if there is content, let the frame consume it
        if len(buf) > 0:
            frame.consume(buf)
            # if the frame is complete, we're done
            if frame.complete():
                break
        else:
            # the socket was closed by the device, exit
            sys.exit(1)

# decode the frames payload
value = decode_value(object_info.response_data_type, frame.data)

# and print the result:
print(f'Response value: {value}')

Reading values from the command line

The module installs the rctclient command (requires click). The subcommand read-values reads a single value from the device and returns its output. Here is a call example using the object ID with verbose output:

$ rctclient read-value --verbose --host 192.168.0.1 --id 0x959930BF
#413 0x959930BF battery.soc         SOC (State of charge)              0.29985150694847107

Without --verbose, the only thing that's printed is the received value. This is demonstrated below, where the --name parameter is used instead of the --id:

$ rctclient read-value --host 192.168.0.1 --name battery.soc
0.2998138964176178

This makes it suitable for use with scripting environments where one just needs some values. If --debug is added before the subcommands name, the log level is set to DEBUG and all log messages are sent to stderr, which allows for scripts to continue processing the value on stdout, while allowing for observations of the inner workings of the code.

Generating the documentation

The documentation is generated using Sphinx, and requires that the software be installed to the local environment (e.g. via virtualenv). With a local clone of the repository, do the following (activate your virtualenv before if so desired):

$ pip install -e .[docs,cli]
$ cd docs
$ make clean html

The documentation is put into the docs/_build/html directory, simply point your browser to the index.html file.

The documentation is also auto-generated after every commit and can be found at https://rctclient.readthedocs.io/.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].