Git Product home page Git Product logo

cemd's Introduction

cemd

Build Status GoDoc Coverage Status Go report CodeFactor

The goal is to provide an EEBUS CEM implementation

IMPORTANT NOTICE

This repository will NOT be continued as of 16th June 2024. Instead all use case implementations, fixes and improvements are being moved into the eebus-go library and are then useable by any type of service.

As of June 29th 2024 all the use case implementations are part of the eebus-go starting with its release v0.6.0

This repository is now deprecated.

Introduction

This library provides a foundation to implement energy management solutions using the eebus-go library. It is designed to be included either directly into go projects, or it will be able to run as a daemon for other systems interact with (to be implemented).

Packages

  • api: API interface definitions
  • cem: Central CEM implementation which needs to be used by a HEMS implementation
  • cmd: Example project
  • uccevc: Use Case Coordinated EV Charging V1.0.1
  • ucevcc: Use Case EV Commissioning and Configuration V1.0.1
  • ucevcem: Use Case EV Charging Electricity Measurement V1.0.1
  • ucevsecc: Use Case EVSE Commissioning and Configuration V1.0.1
  • ucevsoc: Use Case EV State Of Charge V1.0.0 RC1
  • uclpc: Use Case Limitation of Power Consumption V1.0.0 as a Energy Guard
  • uclpcserver: Use Case Limitation of Power Consumption V1.0.0 as a Controllable System
  • ucmgcp: Use Case Monitoring of Grid Connection Point V1.0.0
  • ucmpc: Use Case Monitoring of Power Consumption V1.0.0 as a Monitoring Appliance
  • ucopev: Use Case Overload Protection by EV Charging Current Curtailment V1.0.1b
  • ucoscev: Use Case Optimization of Self Consumption During EV Charging V1.0.1b
  • ucvabd: Use Case Visualization of Aggregated Battery Data V1.0.0 RC1 as a Visualization Appliance
  • ucvapd: Use Case Visualization of Aggregated Photovoltaic Data V1.0.0 RC1 as a Visualization Appliance
  • util: various internal helpers

Usage

Run the following command to see all the options:

Usage: go run cmd/main.go

Example certificate and key files are located in the keys folder. If no certificate and key are provided in the options, new ones will be generated in the current folder.

Explanation

The remoteski is from the eebus service to connect to. If no certfile or keyfile are provided, they are generated and printed in the console so they can be saved in a file and later used again. The local SKI is also printed.

cemd's People

Contributors

anjrew avatar damek86 avatar derandereandi avatar kr0llx avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cemd's Issues

Integrate pairing process

The new pairing process API should be supported and used. The service using CEMd should be able to decide to use the pairing process or define that the added SKI is locally already paired and no UI flow needed.

Add usecase for heatpumps

It would be great if you could think of adding support for heat pumps like the ones from Vailant, which are talking eebus and could a some benefit to manage self consumption of local generated power

Connectivity problem

I'm trying to use your software but got an error connecting to VW Elli Wallbox:

go run cmd/main.go 12345 b90d2c1a3597dd416c5418dc28ff022f50a63a5d keys/hems.crt keys/hems.key enp0s31f6
2023-04-08T11:33:43+02:00: INFO Local SKI:  23ef43d7a6487fb9a44c7fbb0d2b840514b8faa6
2023-04-08T11:33:43+02:00: DEBUG mdns: start search
2023-04-08T11:33:43+02:00: DEBUG ski: b90d2c1a3597dd416c5418dc28ff022f50a63a5d name: Elli-Wallbox-2144A1R0AH brand: Elli model: Wallbox typ: Wallbox identifier: Elli-Wallbox-2144A1R0AH register: false host: wallbox-2144A1R0AH.local. port: 4712 addresses: [192.168.105.241]
2023-04-08T11:33:43+02:00: DEBUG delaying connection to b90d2c1a3597dd416c5418dc28ff022f50a63a5d by 2.123s to minimize double connection probability
2023-04-08T11:33:45+02:00: DEBUG trying to connect to b90d2c1a3597dd416c5418dc28ff022f50a63a5d at 192.168.105.241
2023-04-08T11:33:45+02:00: DEBUG initiating connection to b90d2c1a3597dd416c5418dc28ff022f50a63a5d at 192.168.105.241:4712
2023-04-08T11:33:46+02:00: DEBUG connection to b90d2c1a3597dd416c5418dc28ff022f50a63a5d failed:  tls: failed to parse certificate from server: x509: invalid basic constraints b
2023-04-08T11:33:46+02:00: DEBUG trying to connect to b90d2c1a3597dd416c5418dc28ff022f50a63a5d at wallbox-2144A1R0AH.local.
2023-04-08T11:33:46+02:00: DEBUG initiating connection to b90d2c1a3597dd416c5418dc28ff022f50a63a5d at wallbox-2144A1R0AH.local.:4712
2023-04-08T11:33:46+02:00: DEBUG connection to b90d2c1a3597dd416c5418dc28ff022f50a63a5d failed: tls: failed to parse certificate from server: x509: invalid basic constraints b
2023-04-08T11:33:46+02:00: DEBUG restarting mdns search

any ideas what could be wrong?

Nil Pointer Dereference on EVSE Disconnected

Description

When cemd is connected to an EVSE and the EVSE disconnects the following function is called.

cemd/ucevsecc/events.go

Lines 57 to 59 in e18d426

func (e *UCEVSECC) evseDisconnected(ski string, entity spineapi.EntityRemoteInterface) {
e.eventCB(ski, entity.Device(), entity, EvseDisconnected)
}

Here the entity is accessed to get the Device however the enitity is nil causing the exception.

Add mechanism to forward Heartbeat status for LPC/LPP usecases to CEM

Depending on if the Heartbeats are correctly received by a Controlbox for an interval determines different states that the system needs to go into.
Therefor we need to inform the CEM about the current Heartbeat status so the same is able to handle missing heatbeats and inform other entities to go into failsafe state.

CEM: differentiate device and entity callbacks

Currently, Cem and use cases share the same EventHandlerCB callback type. Together with #23 I'd propose to update as follows:

type DeviceEventCallback func(device spineapi.DeviceRemoteInterface, event EventType)

and

type EntityEventCallback func(entity spineapi.EntityRemoteInterface, event EventType)

Happy to provide a PR.

call eventCB api.EntityEventCallback in a go func

while debugging LPC usecase, i was able to close the underlining websocket if the callback get stuck, e.g. while waiting for a long running task.

example code to reproduce

func (s *cem) entityEventCB(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event api.EventType) {
time.Sleep(120 * time.Second)
}

expected behavior:
- callback doesn't affect the spine lib itself

CEM: simplify event handlers

Creating CEM UCs requires

type EventHandlerCB func(ski string, device spineapi.DeviceRemoteInterface, entity spineapi.EntityRemoteInterface, event EventType)

Given that spineapi.EntityRemoteInterface includes Device() it seems the device parameter is not necessary? Same should apply to SKI via device?

Improve event data handling in usecases

Right now the event code in all usecases checks the complete stored dataset for the needed functionality. Instead it should use the provided data set from the payload only.

This way it can be made sure that events are only fired if the last incoming dataset really includes the data point for the message. If the remote service uses partial messages, this will work better with this change.

Add write checks and API

For use cases implemented with server features that accept writes:

  • Add default checks which reject writes e.g. when no heartbeat is available
  • Add an API which the application has to use to allow an incoming write
  • Set the write timeouts for automatic declines per use case as defined in the specs

Add an event driven API

As EEBUS is event driven and all devices can act as server or client for different functionality, the API should reflect that as well. Hence an event driven API should be used, also considering a future Websocket based API to leverage the same style as Go based CEM systems that use this library.

Detect supported use cases and scenarios

Currently an SKI has to be registered to the supported use cases category, e.g. emobility or grid. Instead this should be detected on the fly using the returned DetailedDiscoveryData and UseCaseInformation.

Refactor and improve usability

  • Remote services should not be hard wired to a solution, instead they should "automatically work" if the remote device supports the same usecases and provides the required features and data
  • It may (!!) be better to individually register each supported usecase, instead of working with solutions that need to be configured, if not all usecases should be supported

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.