GithubHelp home page GithubHelp logo

enbility / cemd Goto Github PK

View Code? Open in Web Editor NEW
12.0 9.0 7.0 1.01 MB

Energy management system using the EEBUS protocol

Home Page: https://enbility.net

License: MIT License

Go 100.00%
eebus electric-vehicles emobility energy-management energy-management-systems

cemd's People

Contributors

anjrew avatar damek86 avatar derandereandi avatar kr0llx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.

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

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

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

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.

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?

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.

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.

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 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.

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

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.

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?

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.