GithubHelp home page GithubHelp logo

ralfogit / speedwire-router Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 83 KB

A C++ executable to route sma speedwire packets between subnets

License: MIT License

CMake 2.72% C++ 97.28%
speedwire sma emeter inverter sma-emeter sma-inverter router multicast multicast-routing

speedwire-router's Introduction

speedwire-router

A C++ executable to route sma speedwire packets between subnets and to individual hosts residing on different subnets.

The executable opens sockets on all available host interfaces. Each inbound SMA(TM) speedwire unicast and multicast packet on a given host interface is forwarded to each of the other host interfaces. A bounce detecter is implemented to prevent packets bouncing infinitely between subnets.

This is interesting for different use cases

  1. You have speedwire devices residing in two different subnets. A lot of speedwire communication is handled through multicast udp packets. Multicast packets will not pass subnet boundaries. Executing the speedwire-router executable on a host that is connected to both subnets will solve this problem. You can also extend this scheme to three or more subnets; just make sure the bounce detector has enough space for packet history.
  2. You have individual speedwire devices residing in a different subnet or somewhere on the internet. This can be solved by running the speedwire-router executable in your local subnet (where the multicast traffic is originating from) and pre-registering the IP address(es) of the individual devices by calling discoverer.preRegisterDevice("YOUR.IP.ADDRESS.HERE") in main.cpp. Inbound unicast and multicast packets on any of the available host interfaces will be forwarded as unicast packets to the configured individual devices.

As an additional benefit you can modify or patch the packet contents before routing them.

The software comes as is. No warrantees whatsoever are given and no responsibility is assumed in case of failure. There is neither a GUI nor a configuration file. Configurations must be tweaked by modifying main.cpp.

The code is based on a Speedwire(TM) access library implementation https://github.com/RalfOGit/libspeedwire. The libspeedwire library implements a full parser for the sma header and the emeter datagram structure, including obis filtering. In addition, it implements some parsing functionality for inverter query and response datagrams. For convenience you may want to place the libspeedwire/ folder right next to the src/ and include/ folders of this repository.

The accompanied CMakeLists.txt assumes the following folder structure:

speedwire-router
    src
    include
    libspeedwire
        src
        include
        CMakeLists.txt
    ... build path ...
    CMakeLists.txt

Please see the description in https://github.com/RalfOGit/libspeedwire on how to setup this folder structure.

The code has been tested against the following environment:

OS: CentOS 8(TM), IDE: VSCode (TM)
OS: Windows 10(TM), IDE: Visual Studio Community Edition 2019 (TM)

speedwire-router's People

Contributors

ralfogit avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.