Giter VIP home page Giter VIP logo

modbussma's Introduction

modbusSMA

C++ library for accessing the the modbus interface of SMA inverters.

See https://mensinda.github.io/modbusSMA/ for documentation.

Features

  • Easy to use
  • Connect to a SMA inverter via TCP and RTU
  • Uses a sqlite3 database for the modbus register information of the inverters
  • Automatically convertes the raw modbus registers to usable formats

Install

Dependencies

Furthermore meson (https://mesonbuild.com/index.html) and ninja are required to build the library. Both can be installed with pip install ninja meson.

Build

git clone https://github.com/mensinda/modbusSMA
git submodule update --init --recursive
cd modbusSMA
meson build
ninja -C build
ninja -C build install # Only to install the library

Code Sample

#include <modbusSMA/ModbusAPI.hpp>
#include <vector>

using namespace modbusSMA;
using namespace std;

int main() {
  ModbusAPI mapi("127.0.0.1", 502); // Create the main API object

  // Call further configuration functions here.

  ErrorCode err = mapi.setup();        // Connect to the modbus interface with ModbusAPI::setup()
  auto      reg = mapi.getRegisters(); // Get a pointer to the RegisterContainer where all registers are stored.

  // Use the shared RegisterContainer pointer (reg) to get a list of supported registers.
  vector<uint16_t> toFetch = {30051, 30053, 30529, 30535, 30538};

  err = mapi.updateRegisters(toFetch); // Fetch the values of the registers and store them in the RegisterContainer

  // The fetched register values can now be retrieved from the shared RegisterContainer
  vector<Register> registersWithValues = reg->getRegisters(toFetch);
  return 0;
}

modbussma's People

Contributors

mensinda avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

mhaag

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.