Skip to main content

An SDK for Victron via Modbus TCP

Project description

Victron SDK for Python

NOTE: This is not an offical Victron SDK.

This Python Package enables you to develop applications with the Victron.

Install:

pip install victron

Example get a value:

from victron import Victron

# Create a configration
config = {
    "grid_limit": device.get(c.CFG_GRID_LIMIT),
    "ess_feed_limit": device.get(c.CFG_ESS_FEED_LIMIT),
    "ess_soc_limit": device.get(c.CFG_ESS_SOC_LIMIT),
}

# Initialize a new Victron connection
victron = victron(
    host="my-Victron.local",
    port=502,
    unit_id=100,
    config=config
)

# get the state of charge
soc = victron.getSoc()

# print
print(soc)

Victron Class

Victron(
    host:str,
    port:int=502,
    unit_id:int=100,
    config:dict={}
)

Victron Config Options

NOTE: The Configuration is to prevent the devices form overloading the grid or other components! Handle with care!

When values are not provided or None the are unused.

{
    "grid_limit": None, # The limit of the grid the deivce is connected to
    "ess_feed_limit": None, # The limit of the feed from ESS to the grid
    "ess_soc_limit": None, # The limit of the state of charge of the ESS
}

Methods

getSoc(address:int=843)

  • Get the state of charge

readSingleHoldingRegisters(self, address:int, parse:bool=True):

  • Read a single holding register
  • Parse = True handles signed values

TODO: Add more methods

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

victron-0.0.5.tar.gz (24.9 kB view details)

Uploaded Source

File details

Details for the file victron-0.0.5.tar.gz.

File metadata

  • Download URL: victron-0.0.5.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.5

File hashes

Hashes for victron-0.0.5.tar.gz
Algorithm Hash digest
SHA256 8010b755e6714dc5ce9e42789bca1b57ede4f5a5e5987120eaa38afcd309f995
MD5 197a6fe36b4b0f3a4824d1a9563328e7
BLAKE2b-256 a5564d50fb0779bab141cede63bffa14d040d04ddca9cdfabff63e6105346b9d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page