Metadata-Version: 2.4
Name: bs120xenet
Version: 1.0.0
Summary: Python Ethernet driver for the Bloomy Controls BS120x battery simulator.
Project-URL: homepage, https://github.com/BloomyControls/bs120x-enet-python
Project-URL: source, https://github.com/BloomyControls/bs120x-enet-python
Project-URL: issues, https://github.com/BloomyControls/bs120x-enet-python/issues
Project-URL: documentation, https://github.com/BloomyControls/bs120x-enet-python
Author: Bloomy Controls, Inc.
License: BSD 3-Clause License
        
        Copyright (c) 2026, Bloomy Controls
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.8
Description-Content-Type: text/x-rst

BS120x Ethernet Python Library (bs120xenet)
===========================================

Python Ethernet driver for Bloomy Controls BS120x. For detailed information on Bs120x operation refer to the user manual
available at https://www.bloomy.com/products/battery-management-system-testing/battery-simulator-1201.

.. important::
    Currently, this library only supports BS1201. If you are using BS1200, contact
    Bloomy for firmware updates to support this driver.

Features
--------

- Supports Windows and Linux
- Implements all commands supported by the BS1201
- Implemented as a wrapper around the `the C/C++ library`_ for consistent interface across languages

.. _the C/C++ library: https://github.com/BloomyControls/bs120x-enet

Installation
------------

See `docs/installation.rst <docs/installation.rst>`__ for installation instructions.

Example Usage
-------------

.. code:: python

    from bs120xenet import Bs120xEnet
    from time import sleep

    with Bs120xEnet() as client:
        # connect to the unit
        client.connect(interface_ip, device_ip, udp_port)

        # request configuration information
        client.query_config()

        # wait to receive configuration
        sleep(0.1)
        config = client.get_unit_config()

        print(f"Serial number: {config.get_serial_number()}")
        print(f"Firmware version: {config.get_firmware_version()}")

        # set Cell 0 to 5V, 0.1A sinking and sourcing current limits
        client.set_cell_voltage(0, 5)
        client.set_cell_sink_current(0, 0.1)
        client.set_cell_source_current(0. 0.1)
        client.enable_cell(0, True)

        sleep(0.1)

        # read back Cell 0 voltage
        v = client.get_cell_voltage(0)
        print(f"Cell 0 Voltage: {v} V")

        client.enable_cell(0, False)
        client.disconnect()

Discussion
----------

Please report any bugs on the Github `issue tracker`_.

.. _issue tracker:
    https://github.com/BloomyControls/bs120x-enet-python/issues