Skip to content

Commit

Permalink
Merge branch 'release/v0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
DerAndereAndi committed May 18, 2024
2 parents 1bae87b + a62a3bc commit 116a560
Show file tree
Hide file tree
Showing 229 changed files with 3,478 additions and 25,954 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,42 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ^1.18
go-version: ^1.21

- name: Build
run: go build -v ./...

- name: Lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@master
with:
version: latest
skip-pkg-cache: true
skip-build-cache: true
args: --timeout=3m --issues-exit-code=0 ./...

- name: Test
run: go test -race -v -coverprofile=coverage.out -covermode=atomic ./...
run: go test -race -v -coverprofile=coverage_temp.out -covermode=atomic ./...

- name: Remove mocks and cmd from coverage
run: grep -v -e "/eebus-go/mocks/" -e "/eebus-go/cmd/" coverage_temp.out > coverage.out

- name: Send coverage
uses: shogo82148/actions-goveralls@v1
uses: coverallsapp/github-action@v2
with:
file: coverage.out

- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
# we let the report trigger content trigger a failure using the GitHub Security features.
args: '-no-fail -fmt sarif -out results.sarif ./...'
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
path-to-profile: coverage.out
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif
58 changes: 58 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
run:
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m

# include test files or not, default is true
tests: true

# by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
# to go.mod are needed. This setting is most useful to check that go.mod does
# not need updates, such as in a continuous integration and testing system.
# If invoked with -mod=vendor, the go command assumes that the vendor
# directory holds the correct copies of dependencies and ignores
# the dependency descriptions in go.mod.
modules-download-mode: readonly

# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
formats:
- format: colored-line-number

linters:
enable:
- bodyclose
- errcheck
- errorlint
- gocheckcompilerdirectives
- gochecknoinits
- gochecksumtype
- goconst
- gofmt
- gosimple
- gosec
- govet
- nilerr
- nilnil
- staticcheck
- typecheck
- unused
- whitespace

issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- errcheck
- goconst
- gosec

# checking for errors in defers seldom makes sense...
- source: "^\\s*defer\\s"
linters:
- errcheck
- staticcheck
10 changes: 10 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
with-expecter: True
inpackage: false
dir: "{{ .InterfaceDir }}/../mocks"
mockname: "{{.InterfaceName}}"
outpkg: "mocks"
filename: "{{.InterfaceName}}.go"
all: True
packages:
github.com/enbility/eebus-go/api:
github.com/enbility/eebus-go/features:
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT license

Copyright (c) 2022 Andreas Linde & Timo Vogel
Copyright (c) 2023-2024 Andreas Linde

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
168 changes: 18 additions & 150 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
# eebus-go

[![Build Status](https://github.com/enbility/eebus-go/actions/workflows/default.yml/badge.svg?branch=dev)](https://github.com/enbility/eebus-go/actions/workflows/default.yml/badge.svg?branch=dev)
[![Build Status](https://github.com/enbility/eebus-go/actions/workflows/default.yml/badge.svg?branch=main)](https://github.com/enbility/eebus-go/actions/workflows/default.yml/badge.svg?branch=main)
[![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4)](https://godoc.org/github.com/enbility/eebus-go)
[![Coverage Status](https://coveralls.io/repos/github/enbility/eebus-go/badge.svg?branch=dev)](https://coveralls.io/github/enbility/eebus-go?branch=dev)
[![Coverage Status](https://coveralls.io/repos/github/enbility/eebus-go/badge.svg?branch=main)](https://coveralls.io/github/enbility/eebus-go?branch=main)
[![Go report](https://goreportcard.com/badge/github.com/enbility/eebus-go)](https://goreportcard.com/report/github.com/enbility/eebus-go)
[![CodeFactor](https://www.codefactor.io/repository/github/enbility/eebus-go/badge)](https://www.codefactor.io/repository/github/enbility/eebus-go)

This library provides a complete foundation for implementing [EEBUS](https://eebus.org) use cases. The use cases define various functional scenarios for different device categories, e.g. energy management systems, charging stations, heat pumps, and more.
This library provides a foundation for implementing [EEBUS](https://eebus.org) use cases in [go](https://golang.org). It uses the SHIP implementation [ship-go](https://github.com/enbility/ship-go) and the SPINE implementation [spine-go](https://github.com/enbility/spine-go). Both repositories started as part of this repository, before they were moved into their own separate repositories and go packages.

Basic understanding of the EEBUS concepts SHIP and SPINE to use this library is required. Please check the corresponding specifications on the [EEBUS downloads website](https://www.eebus.org/media-downloads/).

## Introduction

The supported functionality contains:

- Support for SHIP 1.0.1
- Support for big parts of SPINE 1.1.1
- (De-)serialization for EEBUS specific JSON format requirements
- Support for SHIP 1.0.1 via [ship-go](https://github.com/enbility/ship-go)
- Support for SPINE 1.3.0 via [spine-go](https://github.com/enbility/spine-go)
- Certificate handling
- mDNS Support, incl. avahi support (recommended)
- mDNS Support, incl. avahi support
- Connection (websocket) handling, including reconnection and double connections
- Support for handling pairing of devices

Basic understanding of the EEBUS concepts SHIP and SPINE to use this library is required. Please check the corresponding specifications on the [EEBUS downloads website](https://www.eebus.org/media-downloads/).
## Packages

An open source SDK written in go providing the foundation to use EEBUS in your projects. Contains support for SHIP and SPINE communication.
- `api`: global API interface definitions and eebus service configuration
- `features`: provides feature helpers with the local SPINE feature having the client role and the remote SPINE feature being the server for easy access to commonly used functions
- `service`: central package which provides access to SHIP and SPINE. Use this to create the EEBUS service, its configuration and connect to remote EEBUS services
- `util`: package with various useful helper functions

## Usage

Expand Down Expand Up @@ -85,158 +90,21 @@ If no certfile or keyfile are provided, they are generated and printed in the co
- Double connection handling is not implemented according to SHIP 12.2.2. Instead the connection initiated by the higher SKI will be kept. Much simpler and always works
- PIN Verification is _NOT_ supported other than SHIP 13.4.4.3.5.1 _"none"_ PIN state is supported!
- Access Methods SHIP 13.4.6 only supports the most basic scenario and only works after PIN verification state is completed.
- Supported registration mechanisms (SHIP 5):
- auto accept (without any interaction mechanism!)
- user verification

This approach has been tested with:

- Elli Charger Connect
- Porsche Mobile Charger Connect
- SMA Home Energy Manager 2.0

## Roadmap - Spine specification implementation

### General request processing

- [X] Request and process full data
- [ ] Request partial data
- [ ] Delete Selectors
- [ ] Update Selectors
- [ ] Elements
- [ ] Send
- [X] Full data
- [ ] Partial data
- [X] Process partial data
- [X] Delete Selectors
- [X] Update Selectors
- [X] Elements
- [ ] Request types
- [X] Read
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [ ] Partial Delete
- [X] Receive
- [X] Full Request
- [X] Partial Request
- [X] Partial Delete
- [X] Reply
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [ ] Partial Delete
- [X] Receive
- [X] Full Request
- [X] Partial Request
- [X] Partial Delete
- [X] Notify
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [ ] Partial Delete
- [X] Receive
- [X] Full Request
- [X] Partial Request
- [X] Partial Delete
- [X] Write
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [ ] Partial Delete
- [X] Receive
- [X] Full Request
- [X] Partial Request
- [X] Partial Delete
- [X] Result message handling
- [X] Handle incoming error results
- [X] Handle incoming success results
- [X] Respond with error result when processing failed
- [X] Acknowledgement support
- [X] Request
- [X] Respond
- [x] Use maximum response delay to timeout requests

### Node Management

- [ ] Detailed Discovery
- [ ] Read Messages
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [X] Receive
- [X] Full Request
- [X] Partial Request
- [ ] Reply Messages
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [X] Receive
- [X] Full Request
- [X] Partial Request
- [ ] Notify Messages
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [X] Receive
- [X] Full Request
- [X] Partial Request
- [ ] Destination List
- [ ] Request and process full data
- [X] Response full data
- [ ] Request and process partial data
- [ ] Response partial data
- [ ] Notify subscribers
- [ ] Binding
- [ ] Send Requests
- [X] Add Binding
- [ ] Delete Binding
- [X] Receive Requests
- [X] Add Binding
- [X] Delete Binding
- [ ] Subscription
- [ ] Send Requests
- [X] Add Subscription
- [ ] Delete Subscription
- [X] Receive Requests
- [X] Add Subscription
- [X] Delete Subscription
- [X] Notify subscribers
- [ ] Use Case Discovery
- [ ] Read Messages
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [X] Receive
- [X] Full Request
- [X] Partial Request
- [ ] Reply Messages
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [X] Receive
- [X] Full Request
- [X] Partial Request
- [ ] Notify Messages
- [ ] Send
- [X] Full Request
- [ ] Partial Request
- [X] Receive
- [X] Full Request
- [X] Partial Request

### General feature implementation

- [ ] Hearbeat Support
- [X] Send hearbeats
- [ ] Receive hearbeats

### Partial, selector, elements support

All list types do support processing of incoming partial messages, including selectors and elements. Sending partial messages is possible but there is no special support implemented right now.

## Interfaces

### Verbose logging

Use `SetLogger` on `Service` to set the logger which needs to conform to the `logging.Logging` interface.
Use `SetLogger` on `Service` to set the logger which needs to conform to the `logging.Logging` interface of [ship-go](https://github.com/enbility/ship-go).

Example:

Expand Down
Loading

0 comments on commit 116a560

Please sign in to comment.