https://github.com/pb82/sunny
Mirror of https://gitlab.com/bboehmke/sunny
https://github.com/pb82/sunny
Last synced: over 1 year ago
JSON representation
Mirror of https://gitlab.com/bboehmke/sunny
- Host: GitHub
- URL: https://github.com/pb82/sunny
- Owner: pb82
- License: apache-2.0
- Created: 2024-10-12T17:57:08.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-13T08:39:59.000Z (almost 2 years ago)
- Last Synced: 2025-01-21T13:08:26.449Z (over 1 year ago)
- Language: Go
- Size: 188 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/pb82/sunny/pipelines)
[](https://github.com/pb82/sunny)
[](https://godoc.org/github.com/pb82/sunny)
[](https://goreportcard.com/report/github.com/pb82/sunny)
# Sunny
Sunny is a library to get actual data from SMA inverters and energy meters
via Ethernet (Speedwire).
> Note: SMA & Speedwire are registered trademarks by
> [SMA Solar Technology AG](https://www.sma.de/en/company/about-sma.html)
An example application can be found [here](https://github.com/pb82/sunny-monitor).
## Usage
> The password in the following function is the one of the user account which
> is by default "0000".
To discover reachable devices call:
```go
devices, err := sunny.DiscoverDevices(password)
```
This will return a list of device instances that can be used for additional
communication.
To directly connect to a device use:
```go
device, err := sunny.NewDevice(address, password)
```
Where address is the IP address of the device.
To get all current values from a device use `GetValues()`:
```go
values, err := device.GetValues()
```
`values` will be a `map[string]interface{}` with the values of the device.
The values differs from device to device:
* Energy Meter: Every value that is provided.
See [Energy Meter Protocol](https://www.sma.de/fileadmin/content/global/Partner/Documents/SMA_Labs/EMETER-Protokoll-TI-en-10.pdf)
* Inverters: Provided values that are decrypted.
See `valuesDef` in [values.go](values.go)
> Note: The data from energy meters are broadcasted only once a second.
## Speedwire Protocol
The base protocol is implemented based on the information provided SMA
in the documentation of the
[Energy Meter Protocol](https://www.sma.de/fileadmin/content/global/Partner/Documents/SMA_Labs/EMETER-Protokoll-TI-en-10.pdf)
and the
[Speedwire device discovery](https://www.sma.de/fileadmin/content/global/Partner/Documents/sma_developer/SpeedwireDD-TI-en-10.pdf).
For the core functionality of the protocol are no public information available.
Because the missing information the main protocol structure is based on
own packet analyses and some existing projects:
* https://github.com/erijo/energy-utils
* https://github.com/SBFspot/SBFspot
* https://github.com/Rincewind76/SMAInverter
* https://gitlab.com/volkerkettenbach/FHEM-SMA-Speedwire
* https://github.com/pvlog/pvlib