https://github.com/spali/go-rscp
Go library to communicate with a E3DC system implementing the RSCP (Remote Storage Control Protocol)
https://github.com/spali/go-rscp
battery binary client command-line commandline e3-dc e3dc go go-e3dc go-rscp golang hauskraftwerk json quattroporte rscp s10 smart smarthome solar speicher
Last synced: 6 months ago
JSON representation
Go library to communicate with a E3DC system implementing the RSCP (Remote Storage Control Protocol)
- Host: GitHub
- URL: https://github.com/spali/go-rscp
- Owner: spali
- License: mit
- Created: 2020-11-17T07:49:02.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2026-02-02T19:26:25.000Z (6 months ago)
- Last Synced: 2026-02-03T09:47:07.668Z (6 months ago)
- Topics: battery, binary, client, command-line, commandline, e3-dc, e3dc, go, go-e3dc, go-rscp, golang, hauskraftwerk, json, quattroporte, rscp, s10, smart, smarthome, solar, speicher
- Language: Go
- Homepage: https://github.com/spali/go-rscp
- Size: 397 KB
- Stars: 29
- Watchers: 6
- Forks: 10
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# go-rscp & e3dc command line utility
[](https://github.com/spali/go-rscp/actions/workflows/build.yml?query=branch%3Amaster)
[](https://codecov.io/gh/spali/go-rscp)
[](https://github.com/spali/go-rscp/actions?query=workflow%3A%22CodeQL%22)
[](https://goreportcard.com/report/github.com/spali/go-rscp)
[](https://pkg.go.dev/github.com/spali/go-rscp)
[](https://github.com/spali/go-rscp/blob/master/LICENSE)
Go library (rscp) and command line utility (e3dc) to communicate with a E3DC system implementing the RSCP (Remote Storage Control Protocol).
Please be gentle with me, this is my first real go project and it's bigger than I thought ;)
There is still a lot to improve to be a good reusable library, but most works for my specific usecase using it as a command line utility.
Contributions are very welcome, see also the check [TODO](#TODO) or search in the code for `TODO:` comments.
## Usage
All arguments can also be set as `E3DC_` prefixed environment variable or in a config file like:
```
host 127.0.0.1
user myuser
password mypassword
key mykey
```
### rscp library
See [cmd/example](https://github.com/spali/go-rscp/blob/master/cmd/example/e3dc.go) for a small example with different requests and responses.
### e3dc command line utility
Request sent, is always last argument or can be piped through `stdin` as json string.
See the examples below for more information.
#### Examples
**\*Note**: top element has always to be an array\*
**\*Note**: these examples assume you have the default `.config` file setup or exported the environment variables.\*
**\*Note**: all example use the default output format, check the help `./e3dc -help` for other formats.\*
- Short tag only notation just request some information
```sh
./e3dc '[["EMS_REQ_START_MANUAL_CHARGE",0]]' | jq
```
Output:
```json
{
"EMS_START_MANUAL_CHARGE": true
}
```
- Short tag only notation just request some information
```sh
./e3dc '["INFO_REQ_MAC_ADDRESS", "INFO_REQ_UTC_TIME"]' | jq
```
Output:
```json
{
"INFO_MAC_ADDRESS": "00:00:00:00:00:00",
"INFO_UTC_TIME": "1970-01-01T00:00:00.000000Z"
}
```
- Tuple notation of tag's to request information
```sh
./e3dc '[["INFO_REQ_MAC_ADDRESS"], ["INFO_REQ_UTC_TIME"]]' | jq
```
Output:
```json
{
"INFO_MAC_ADDRESS": "00:00:00:00:00:00",
"INFO_UTC_TIME": "1970-01-01T00:00:00.000000Z"
}
```
- Tuple notation of tag's and values to send information (data type is inferred by the tag)
```sh
./e3dc '[["EMS_REQ_START_MANUAL_CHARGE", 3000]]' | jq
```
Output:
```json
{
"EMS_START_MANUAL_CHARGE": true
}
```
- Tuple notation of tag's and values to send information (with explicit data type)
_Note: data type of the tag can be overriden by the user_
```sh
./e3dc '[["INFO_REQ_MAC_ADDRESS","None",""], ["INFO_REQ_UTC_TIME"]]' | jq
```
Output:
```json
{
"INFO_MAC_ADDRESS": "00:00:00:00:00:00",
"INFO_UTC_TIME": "1970-01-01T00:00:00.000000Z"
}
```
## TODO
- [ ] more testing
- [ ] more documentation
- [ ] check the generic data type logic (i.e. pointer vs value in interface), this should do a pro ;)
- [ ] `cmd/e3dc`
- [x] read config file (security)
- [x] read from environment variables (security)
- [x] streamline logging
- [x] optional experimental mode which accepts any custom message (including tag, datatype and value)
- [ ] implement optional (by flag) pair output (same as the tuple input without datatype)
- [ ] `rscp`
- [ ] cleanup API
- [x] probably expose `Message` as interface and make the struct internal (would allow to move the complete cmd/e3dc specific json stuff out)
- [ ] streamline logging
- [ ] client: improve implementation to make it stable for keeping stable and connected when used in a service
- [x] move `cmd/e3dc` specific json marshalling out of `rscp` to command line utility `cmd/e3dc`
- [x] move `cmd/e3dc` specific json unmarshaling out of `rscp` to command line utility `cmd/e3dc`