openinverter-can-tool


Nameopeninverter-can-tool JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/davefiddes/openinverter-can-tool
SummaryTool to configure and operate OpenInverter systems over CAN
upload_time2025-08-03 11:34:06
maintainerNone
docs_urlNone
authorDavid J. Fiddes
requires_python<4,>=3.9
licenseMIT License
keywords openinverter canopen
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OpenInverter CAN tool

[![Build status](../../actions/workflows/test.yml/badge.svg)](../../actions/workflows/test.yml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openinverter-can-tool)
![PyPI - License](https://img.shields.io/pypi/l/openinverter-can-tool)

A tool to allow configuration and operating of OpenInverter systems for
electric vehicles over a CAN connection.

## Features

* Display all available modifiable parameters and read-only values supported by a given inverter firmware version
* Read a specified parameter/value
* Write a new value to a specified parameter
* Display the current value of each parameter/value on a given device
* Log a list of parameters to a CSV file at regular intervals
* Save and load all parameters to and from a JSON file
* Manage parameter to custom [CAN message mappings](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/can-mapping.md):
  * Create, remove and list parameter mappings on a device
  * Support maps with standard CAN 2.0a and extended CAN 2.0b frames
  * Export and import mappings to a local JSON file
  * Export mappings to DBC allowing easier debugging with [SavvyCAN](https://savvycan.com/)
* Upgrade firmware or recover devices over CAN
* Display the inverter serial number
* Command the inverter to:
  * Start
  * Stop
  * Load parameters from flash
  * Save parameters to flash
  * Revert parameters to their default values
  * Reset
* Scan a CAN bus for possible nodes
* Runs on Linux, Windows and MacOS with python 3.9+
* Support [shell completion](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/shell-completion.md) for commands and options for bash, zsh and fish shells
* Works with any CAN adapter supported by [python-can](https://pypi.org/project/python-can/)
* Supports [stm32-sine](https://github.com/jsphuebner/stm32-sine) 5.24.R or later
* Automatic parameter database download and caching (requires stm32-sine 5.27.R or later)
* Works with [Foccci/Clara](https://github.com/uhi22/ccs32clara) CCS controller and [Stm32-vcu](https://github.com/damienmaguire/Stm32-vcu) (a.k.a. Zombieverter VCU)

## Installation

To avoid any clashes with other software the tool is best is best installed using the [pipx](https://pipx.pypa.io/) package manager. Install this following the [pipx installation guide](https://pipx.pypa.io/stable/installation/) for your platform.

### Initial Install

The most recent release may be installed using:

```text
    pipx install openinverter_can_tool
```

### Upgrading

Upgrading to the most recent release is carried out using pip:

```text
    pipx upgrade openinverter_can_tool
```

## Configuration

Before the tool can be used the CAN interface adapter needs to be configured. To do this create `~/.canrc` on Linux and MacOS or `%USERPROFILE%/can.conf` on Windows. Details on interfaces supported and the configuration file format can be found in the [python-can](https://python-can.readthedocs.io/en/stable/configuration.html) documentation.

An example configuration file for a [SocketCAN](https://python-can.readthedocs.io/en/stable/interfaces/socketcan.html) compatible adapter on Linux would look like:

```text
[default]
interface = socketcan
channel = can0
bitrate = 500000
```

Note: Before the tool can on Linux run the SocketCAN network interface needs to be started:

```text
    sudo ip link set can0 up type can bitrate 500000
```

An example configuration file for a [SLCAN](https://python-can.readthedocs.io/en/stable/interfaces/slcan.html) adapter such as [GVRET](https://github.com/collin80/GVRET) on Windows would look like:

```text
[default]
interface = slcan
channel = COM8
bitrate = 500000
```

### Tested interfaces

* [Innomaker USB2CAN](https://www.inno-maker.com/product/usb2can-cable/) CAN interface in Linux using `socketcan`
* [GVRET](https://github.com/collin80/GVRET) CAN interface using `slcan` in Linux
* [MKS CANable V2.0 Pro](https://github.com/makerbase-mks/CANable-MKS) using `slcan` in Windows and Linux
* [FYSETC UCAN](https://www.ebay.co.uk/itm/267167770235) using `slcan` in MacOS

Let me know if you have used a particular CAN interface successfully and I can expand this list.

The many CANable clone devices on eBay or AliExpress can be swapped from `socketcan` to `slcan` firmware (or vice versa) using the [web firmware updater](https://canable.io/updater/canable1.html).

### Incompatible interfaces

These python-can drivers are known to have problems with openinverter_can_tool:

* [Geschwister Schneider and candleLight](https://python-can.readthedocs.io/en/stable/interfaces/gs_usb.html) using `gs_usb` on Windows or Linux. This prevents Innomaker USB2CAN from working with Windows.

## Command Line Usage

To get the usage information for the tool run the `oic` command with no parameters:

```text
    Usage: oic [OPTIONS] COMMAND [ARGS]...

    OpenInverter CAN Tool allows querying and setting configuration of inverter
    parameters over a CAN connection

    Options:
    -d, --database FILE       Override the OpenInverter JSON parameter database
                                to use
    -c, --context TEXT        Which python-can configuration context to use
    -n, --node INTEGER RANGE  The CAN SDO node ID to communicate with  [env var:
                                OIC_NODE; default: 1; 1<=x<=127]
    -t, --timeout FLOAT       Response timeout in seconds  [default: 1.0]
    --debug                   Enable detailed debugging messages
    --version                 Show the version and exit.
    --help                    Show this message and exit.

    Commands:
    cache       Parameter database cache management commands
    can         Manage parameter to CAN message mappings on a device
    cmd         Execute a command on a device
    dumpall     Dump the values of all available parameters and values
    listparam   List the definition of PARAM
    listparams  List all available parameters and values
    load        Load all parameters from json IN_FILE
    log         Log the value of PARAMS from the device periodically in CSV...
    read        Read the value of PARAM from the device
    save        Save all parameters in json to OUT_FILE
    scan        Scan the CAN bus for available nodes
    serialno    Read the device serial number.
    upgrade     Upgrade the device firmware.
    write       Write the value to the parameter PARAM on the device
```

To scan for OpenInverter devices on a CAN network:

```text
    $ oic scan
    Scanning for devices. Please wait...

    Found possible OpenInverter node: 1
    Found possible OpenInverter node: 3
```

To read the current value of a parameter:

```text
    $ oic read brakeregen
    brakeregen          : -50
```

Values may be changed using symbolic names:

```text
    oic write potmode DualChannel
    oic write pinswap PWMOutput13,PWMOutput23
```

Firmware on devices may be easily upgraded:

```text
    $ oic upgrade stm32_sine.bin
    Device upgrade started for 87193029
    Upgrading: 15.3% complete
```

## Experimental GUI

An experimental GUI version of the tool exists which can be started by running the `oic-gui` command:

![Screenshot of the OpenInverter CAN Tool showing the Parameters tab on a Linux GNOME desktop](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/openinverter_can_tool_tkinter_gui_parameters.png)

Further details can be found in the [user documentation](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/gui-readme.md).

## Development and Contributing

If you are interested in contributing to the tool please check the [contributing guidelines](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/CONTRIBUTING.md).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/davefiddes/openinverter-can-tool",
    "name": "openinverter-can-tool",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": "openinverter, canopen",
    "author": "David J. Fiddes",
    "author_email": "D.J@fiddes.net",
    "download_url": "https://files.pythonhosted.org/packages/11/a4/3ec599109ebeefd815540184c10221a742bd53a8fbfeb44807bc944b7e49/openinverter_can_tool-0.4.0.tar.gz",
    "platform": null,
    "description": "# OpenInverter CAN tool\n\n[![Build status](../../actions/workflows/test.yml/badge.svg)](../../actions/workflows/test.yml)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openinverter-can-tool)\n![PyPI - License](https://img.shields.io/pypi/l/openinverter-can-tool)\n\nA tool to allow configuration and operating of OpenInverter systems for\nelectric vehicles over a CAN connection.\n\n## Features\n\n* Display all available modifiable parameters and read-only values supported by a given inverter firmware version\n* Read a specified parameter/value\n* Write a new value to a specified parameter\n* Display the current value of each parameter/value on a given device\n* Log a list of parameters to a CSV file at regular intervals\n* Save and load all parameters to and from a JSON file\n* Manage parameter to custom [CAN message mappings](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/can-mapping.md):\n  * Create, remove and list parameter mappings on a device\n  * Support maps with standard CAN 2.0a and extended CAN 2.0b frames\n  * Export and import mappings to a local JSON file\n  * Export mappings to DBC allowing easier debugging with [SavvyCAN](https://savvycan.com/)\n* Upgrade firmware or recover devices over CAN\n* Display the inverter serial number\n* Command the inverter to:\n  * Start\n  * Stop\n  * Load parameters from flash\n  * Save parameters to flash\n  * Revert parameters to their default values\n  * Reset\n* Scan a CAN bus for possible nodes\n* Runs on Linux, Windows and MacOS with python 3.9+\n* Support [shell completion](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/shell-completion.md) for commands and options for bash, zsh and fish shells\n* Works with any CAN adapter supported by [python-can](https://pypi.org/project/python-can/)\n* Supports [stm32-sine](https://github.com/jsphuebner/stm32-sine) 5.24.R or later\n* Automatic parameter database download and caching (requires stm32-sine 5.27.R or later)\n* Works with [Foccci/Clara](https://github.com/uhi22/ccs32clara) CCS controller and [Stm32-vcu](https://github.com/damienmaguire/Stm32-vcu) (a.k.a. Zombieverter VCU)\n\n## Installation\n\nTo avoid any clashes with other software the tool is best is best installed using the [pipx](https://pipx.pypa.io/) package manager. Install this following the [pipx installation guide](https://pipx.pypa.io/stable/installation/) for your platform.\n\n### Initial Install\n\nThe most recent release may be installed using:\n\n```text\n    pipx install openinverter_can_tool\n```\n\n### Upgrading\n\nUpgrading to the most recent release is carried out using pip:\n\n```text\n    pipx upgrade openinverter_can_tool\n```\n\n## Configuration\n\nBefore the tool can be used the CAN interface adapter needs to be configured. To do this create `~/.canrc` on Linux and MacOS or `%USERPROFILE%/can.conf` on Windows. Details on interfaces supported and the configuration file format can be found in the [python-can](https://python-can.readthedocs.io/en/stable/configuration.html) documentation.\n\nAn example configuration file for a [SocketCAN](https://python-can.readthedocs.io/en/stable/interfaces/socketcan.html) compatible adapter on Linux would look like:\n\n```text\n[default]\ninterface = socketcan\nchannel = can0\nbitrate = 500000\n```\n\nNote: Before the tool can on Linux run the SocketCAN network interface needs to be started:\n\n```text\n    sudo ip link set can0 up type can bitrate 500000\n```\n\nAn example configuration file for a [SLCAN](https://python-can.readthedocs.io/en/stable/interfaces/slcan.html) adapter such as [GVRET](https://github.com/collin80/GVRET) on Windows would look like:\n\n```text\n[default]\ninterface = slcan\nchannel = COM8\nbitrate = 500000\n```\n\n### Tested interfaces\n\n* [Innomaker USB2CAN](https://www.inno-maker.com/product/usb2can-cable/) CAN interface in Linux using `socketcan`\n* [GVRET](https://github.com/collin80/GVRET) CAN interface using `slcan` in Linux\n* [MKS CANable V2.0 Pro](https://github.com/makerbase-mks/CANable-MKS) using `slcan` in Windows and Linux\n* [FYSETC UCAN](https://www.ebay.co.uk/itm/267167770235) using `slcan` in MacOS\n\nLet me know if you have used a particular CAN interface successfully and I can expand this list.\n\nThe many CANable clone devices on eBay or AliExpress can be swapped from `socketcan` to `slcan` firmware (or vice versa) using the [web firmware updater](https://canable.io/updater/canable1.html).\n\n### Incompatible interfaces\n\nThese python-can drivers are known to have problems with openinverter_can_tool:\n\n* [Geschwister Schneider and candleLight](https://python-can.readthedocs.io/en/stable/interfaces/gs_usb.html) using `gs_usb` on Windows or Linux. This prevents Innomaker USB2CAN from working with Windows.\n\n## Command Line Usage\n\nTo get the usage information for the tool run the `oic` command with no parameters:\n\n```text\n    Usage: oic [OPTIONS] COMMAND [ARGS]...\n\n    OpenInverter CAN Tool allows querying and setting configuration of inverter\n    parameters over a CAN connection\n\n    Options:\n    -d, --database FILE       Override the OpenInverter JSON parameter database\n                                to use\n    -c, --context TEXT        Which python-can configuration context to use\n    -n, --node INTEGER RANGE  The CAN SDO node ID to communicate with  [env var:\n                                OIC_NODE; default: 1; 1<=x<=127]\n    -t, --timeout FLOAT       Response timeout in seconds  [default: 1.0]\n    --debug                   Enable detailed debugging messages\n    --version                 Show the version and exit.\n    --help                    Show this message and exit.\n\n    Commands:\n    cache       Parameter database cache management commands\n    can         Manage parameter to CAN message mappings on a device\n    cmd         Execute a command on a device\n    dumpall     Dump the values of all available parameters and values\n    listparam   List the definition of PARAM\n    listparams  List all available parameters and values\n    load        Load all parameters from json IN_FILE\n    log         Log the value of PARAMS from the device periodically in CSV...\n    read        Read the value of PARAM from the device\n    save        Save all parameters in json to OUT_FILE\n    scan        Scan the CAN bus for available nodes\n    serialno    Read the device serial number.\n    upgrade     Upgrade the device firmware.\n    write       Write the value to the parameter PARAM on the device\n```\n\nTo scan for OpenInverter devices on a CAN network:\n\n```text\n    $ oic scan\n    Scanning for devices. Please wait...\n\n    Found possible OpenInverter node: 1\n    Found possible OpenInverter node: 3\n```\n\nTo read the current value of a parameter:\n\n```text\n    $ oic read brakeregen\n    brakeregen          : -50\n```\n\nValues may be changed using symbolic names:\n\n```text\n    oic write potmode DualChannel\n    oic write pinswap PWMOutput13,PWMOutput23\n```\n\nFirmware on devices may be easily upgraded:\n\n```text\n    $ oic upgrade stm32_sine.bin\n    Device upgrade started for 87193029\n    Upgrading: 15.3% complete\n```\n\n## Experimental GUI\n\nAn experimental GUI version of the tool exists which can be started by running the `oic-gui` command:\n\n![Screenshot of the OpenInverter CAN Tool showing the Parameters tab on a Linux GNOME desktop](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/openinverter_can_tool_tkinter_gui_parameters.png)\n\nFurther details can be found in the [user documentation](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/gui-readme.md).\n\n## Development and Contributing\n\nIf you are interested in contributing to the tool please check the [contributing guidelines](https://github.com/davefiddes/openinverter-can-tool/blob/main/docs/CONTRIBUTING.md).\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Tool to configure and operate OpenInverter systems over CAN",
    "version": "0.4.0",
    "project_urls": {
        "Bug Reports": "https://github.com/davefiddes/openinverter-can-tool/issues",
        "Homepage": "https://github.com/davefiddes/openinverter-can-tool",
        "Source": "https://github.com/davefiddes/openinverter-can-tool"
    },
    "split_keywords": [
        "openinverter",
        " canopen"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "fde80cbf6cb5f7500d36660074825301b19cb18c659345f76888a7eaf27f03ff",
                "md5": "596f4f7c096e99acceb85dc55aec0a42",
                "sha256": "d414e1b5e618293734d4d76e50271614fbee7f78af9917242b337c138c3964ce"
            },
            "downloads": -1,
            "filename": "openinverter_can_tool-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "596f4f7c096e99acceb85dc55aec0a42",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 362769,
            "upload_time": "2025-08-03T11:34:04",
            "upload_time_iso_8601": "2025-08-03T11:34:04.865295Z",
            "url": "https://files.pythonhosted.org/packages/fd/e8/0cbf6cb5f7500d36660074825301b19cb18c659345f76888a7eaf27f03ff/openinverter_can_tool-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "11a43ec599109ebeefd815540184c10221a742bd53a8fbfeb44807bc944b7e49",
                "md5": "1ebce98cc7af65ae6307098b294162d7",
                "sha256": "9f9afd6f0517c1930e65dfde260a1afd8516c55ece91376ef5e2682f98c7e0a8"
            },
            "downloads": -1,
            "filename": "openinverter_can_tool-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1ebce98cc7af65ae6307098b294162d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 380258,
            "upload_time": "2025-08-03T11:34:06",
            "upload_time_iso_8601": "2025-08-03T11:34:06.475477Z",
            "url": "https://files.pythonhosted.org/packages/11/a4/3ec599109ebeefd815540184c10221a742bd53a8fbfeb44807bc944b7e49/openinverter_can_tool-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-03 11:34:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "davefiddes",
    "github_project": "openinverter-can-tool",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "openinverter-can-tool"
}
        
Elapsed time: 0.49346s