- Updated Python version requirement from ">=3.8,<4.0" to ">=3.9,<3.14" in pyproject.toml and requirements.txt. - Added additional development dependencies: poetry, ipython, flake8, yapf, and pyinstaller. - Configured multiple package sources for dependency resolution in pyproject.toml. - Added formatting configurations for yapf and black to maintain code style consistency.
Xnergy Charger Control Demo
How to use code
Please use python3
pip3 install -r requirements.txtpython3 app.py PORT
packaging
poetry install --no-root --all-groups
poetry run nuitka --standalone --onefile --windows-icon-from-ico="C:\PATH\TO\xnergy_favicon.ico" .\app.py
poetry run pyinstaller --onefile --icon="C:\PATH\TO\xnergy_favicon.ico" .\app.py
pyinstaller will be faster than nuitka, but sometimes the executable file generated by pyinstaller may be treated as a virus by some antivirus software.
English Instructions
The Xnergy Charger Control Demo is a tool designed to control Xnergy chargers via RS485 serial communication. This program allows users to set the interval time and repetition count for charging cycles, making it ideal for testing and demonstration purposes.
Command Syntax
xnergy-example.exe [-h] [-i INTERVAL] [-r REPEAT] [-q] [-v] port
Positional Arguments
- port (Required): The serial port device (e.g., COM3, /dev/ttyUSB0) connected to the Xnergy RCU.
Optional Arguments
-h, --help: Show this help message and exit.-i INTERVAL, --interval INTERVAL: Time interval (in seconds) between charger on/off cycles. Default is 1800 seconds (30 minutes).-r REPEAT, --repeat REPEAT: Number of times to repeat the charging cycle. Default is 1.-q, --quiet: Quiet mode. Suppress all output messages.-v, --version: Show program version number and exit.
Usage Examples
-
Basic usage:
xnergy-example.exe COM3
Controls the charger via COM3 using default interval and 1 repetition. -
Custom interval and repeats:
xnergy-example.exe -i 3600 -r 5 COM5
Controls the charger via COM5 with a 1-hour interval and 5 repetitions. -
Quiet mode:
xnergy-example.exe -q COM5
Runs on COM5 without displaying any output.
Xnergy充电器控制演示程序说明
中文说明
Xnergy充电器控制演示程序是一个用于控制Xnergy充电器的工具,通过RS485串口与充电器通信。该程序允许用户设置充电周期的间隔时间和重复次数,适用于测试和演示场景。
命令格式
xnergy-example.exe [-h] [-i INTERVAL] [-r REPEAT] [-q] [-v] port
参数说明
- port(必需):连接到Xnergy RCU的串口设备名称(如COM3、/dev/ttyUSB0)。
可选参数
-h, --help:显示此帮助信息并退出。-i INTERVAL, --interval INTERVAL:充电器开关切换的间隔时间(秒),默认1800秒(30分钟)。-r REPEAT, --repeat REPEAT:充电周期的重复次数,默认1次。-q, --quiet:安静模式,抑制所有输出信息。-v, --version:显示程序版本号并退出。
使用示例
-
基本用法:
xnergy-example.exe COM3
通过COM3端口控制充电器,使用默认间隔时间和1次重复。 -
自定义间隔和重复次数:
xnergy-example.exe -i 3600 -r 5 COM5
通过COM5端口控制充电器,设置间隔为1小时,重复5次。 -
安静模式:
xnergy-example.exe -q COM5
在COM5端口上运行,不显示任何输出信息。