OP-BTS Python Script Usage Guide & Tool Reference


OP-BTS Python Script Usage Guide & Tool Reference

1. Script Execution Rules

OP-BTS devices only run compiled .py.o bytecode files. Raw .py source cannot be executed on the device. Always compile your scripts before deployment.

2. Command-Line Workflow (opman CLI)

Tool Overview

opman (@zenovate/opman) is the primary development-machine tool for OP-BTS scripts on macOS (arm64/x64) and Windows x64. Use it to compile Python to .py.o, upload or deploy over serial/BLE, and open a Python REPL. It is scriptable and fits CI or local automation.

Full reference: opman CLI User Guide.

Install

Requires Node.js ≥ 16. Linux is not supported by the published npm package.

npm install -g @zenovate/opman
opman --version

Minimal workflow

# Compile locally
opman compile hello.py

# Compile + upload + run (replace COM3 / baud for your setup)
opman deploy hello.py -p COM3 -b 9600

# Python REPL (optional)
opman python -p COM3 -b 9600

opman’s default serial baud is 115200 if you omit -b. Many optical docks use 9600—pass -b 9600 when needed. On macOS over BLE, prefer --packet-size 50 for upload/deploy.

Scripts on the device must live under /py.

3. Field Upload (OP Manager)

Tool Overview

OP Manager is the app for connecting to OP-BTS devices, uploading compiled .py.o scripts in the field, configuring device parameters, managing Bluetooth, and viewing device information. It is available on iOS, Android, and Windows.

Download

Official download page: OP Manager

Tip: OP Manager is on the App Store and Google Play. On Windows it is also available from the Microsoft Store.

Quick Workflow

  1. Open OP Manager and scan for the target OP-BTS device over Bluetooth, then connect.
  2. Open the device management screen and find Document Upload.
  3. Select a locally compiled .py.o script and upload it.
  4. After a successful upload, view and run the script on the device.

Compile scripts on your PC with opman first (see §2), then use OP Manager for field distribution when needed.

4. OP File Manager (legacy)

OP File Manager (Windows GUI) was previously used for compile/debug workflows. It is now a legacy option: new development should use opman CLI. Existing users can still follow the OP File Manager User Guide.

5. Full Script Development Reference

For OP-BTS-specific Python syntax, device APIs, standard libraries, interactive mode, troubleshooting, and other development details, see the official script manual:

OP-BTS Script Programming Guide

6. Example Scripts Download

We provide a sample script pack for common OP-BTS scenarios: IEC1107 meter reading, ANSI login, and device status checks. The archive includes both .py source files and compiled .py.o bytecode. Upload a .py.o file directly to the device /py directory, or open the .py source, learn from it, modify it, and recompile with opman (opman compile / opman deploy).

Download example scripts (scripts-examples.zip)

Script Description
e650-serial.py Read E650 meter serial number via IEC1107 (300 bps identify + ACK switch to 9600) and display on LCD
e650-date.py IEC1107 read: identify model, switch to 9600, parse 90()/11()/12() for serial, time, and date; LCD display
wasion.py WASION meter ANSI C12.18 login and model read; logs to /py/meter_read.txt
unlock.py Check device unlock status and show result on LCD

Each .py file includes a matching compiled .py.o file ready to use after extraction.

7. Tool Summary

Tool Platform Primary Use Best For
opman CLI macOS, Windows x64 Compile, upload, deploy, REPL, automation Script development and deployment on a PC (preferred)
OP Manager iOS, Android, Windows Device connection, .py.o upload, configuration Field distribution, day-to-day device management
OP File Manager Windows Legacy GUI compile/debug/file management Existing workflows only — see user guide

Additional Notes

  1. All scripts uploaded to the device must be stored in the /py directory. Scripts in other locations will not run correctly.
  2. Install opman with Node.js ≥ 16: npm install -g @zenovate/opman. Linux is not supported by the published package.
  3. For Bluetooth connections, keep the device within 1–2 meters of the terminal. A signal strength better than -65 dBm helps ensure stable transfers.