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:
- Speedwire-TI-en-11.pdf - Speedwire technical information
- EMETER-Protokoll-TI-en-10.pdf - SMA Energy Meter Protocol
- SpeedwireDD-TI-en-10.pdf - Speedwire device discovery
-
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.
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.
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.
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>
These open source libraries were used to create this api:
- unitsofmeasurement/indriya licensed under the following license