Giter Site home page Giter Site logo

j0b10 / sma-speedwire Goto Github PK

View Code? Open in Web Editor NEW
17.0 3.0 2.0 749 KB

SMA-Speedwire is an api for communicating with SMA products over Ethernet using the speedwire interface.

License: MIT License

Java 100.00%
sma speedwire energy-meter smart-meter solar sma-em sma-solar multicast udp

sma-speedwire's Introduction

SMA-Speedwire

Java Version Maven Central Javadoc GitHub ๐Ÿ—๏ธ Build & Deploy

This library is not affiliated, associated, authorized, endorsed by, or in any way officially connected with SMA Solar Technology AG, or any of its subsidiaries or its affiliates.

SMA-Speedwire is an api for communicating with SMA products over Ethernet using the speedwire interface.

It allows listening for exchanged data between your devices and logging meter readings.

Technical documents covering Speedwire can be found under:

Supported Products

  • SMA Energy Meter

  • Sunny Home Manager (2.0)

  • ...

I'm looking into implementing more products, but I need your help for this!
Contribute a Telegram implementation for your device by opening a Pull Request or help in the development process by sharing packet captures. Open an issue with your device to get started.

Known issues

Speedwire uses UDP as transport protocol for sending packets to multicast groups.
Therefore, you will need to make sure that routers between the device you want to communicate with, and your device have multicast forwarding enabled.
Some cheap switches are also known to cause problems with multicast (like blocking random groups or not allowing it at all), so make sure your hardware supports it.

I would advise you to first test establishing a connection using the DeviceDiscovery sample.

Usage

Reading incoming data from an SMA Energy Meter / SMA Sunny Home Manager:

        Speedwire speedwire = new Speedwire();
        speedwire.onError(Exception::printStackTrace);
        speedwire.onTimeout(() -> System.err.println("speedwire timeout"));
        speedwire.onData(data -> {
            if (data instanceof EnergyMeterTelegram) {
                EnergyMeterTelegram em = (EnergyMeterTelegram) data;
        
                //device information
                int SUSyID = em.getSUSyID();
                long SerNo = em.getSerNo().longValueExact();
                String ip = em.getOrigin().getHostAddress();
                System.out.printf("Device %d %d on port %s%n", SUSyID, SerNo, ip);
        
                //current power draw (in W)
                Quantity<Power> w = em.getData(EnergyMeterChannels.TOTAL_P_IN).to(Units.WATT);
                System.out.printf("Ingress Power: %s%n", w);
        
                //energy meter total power reading (in kWh)
                Quantity<Energy> powerReading = em.getData(EnergyMeterChannels.TOTAL_P_IN_SUM)
                .to(MetricPrefix.KILO(Units.WATT).multiply(Units.HOUR).asType(Energy.class));
                System.out.printf("Total power reading: %s%n", powerReading);
            }
        });
        speedwire.start();

For more information read the well documented javadoc or have a look at the samples.

Maven configuration

This library is available on maven central, just add the following to your dependencies:

<dependency>
    <groupId>io.github.joblo2213</groupId>
    <artifactId>sma.speedwire</artifactId>
    <version>1.0.2</version>
</dependency>

Libraries

These open source libraries were used to create this api:

sma-speedwire's People

Contributors

dependabot[bot] avatar j0b10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jannes67 wimleers

sma-speedwire's Issues

Integrate more devices

You have a device that is using the speedwire interface to send data but isn't currently supported by this api?

One way you can help is by writing an implementation yourself and creating a pull request.
Let me know what you are working on and I'll help you where I can!

You have a unsupported device but are not able to implement it on your own?
You can help by capturing the packets the device sends using Wireshark and sending me them so I can try Implementing the device even though I don't have it. I'll guide you through the process just let me know in this issue.

Devices to implement

  • SMA Sunny Tripower 8.0-10.0
  • ...

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.