Ha_openems: Home Assistant Integration

Hello everybody,

I started with the implementation of a FEMS & OpenEMS integration for Home Assistant.
The current status can be considered a first alpha version which:

  • Can be set up via the Home Assistant UI
  • Retrieves all devices (implementation is ready to handle multi-edge and single-edge configuration. Currently, only single-edge setup is tested)
  • Retrieves every channel from the connected system and creates according entities
  • Currently, there is a hard-coded list of ~50 channels whose entities are enabled by default. All other entities are created, but disabled by default. Every entity can be enabled and disabled via the Home Assistant UI
  • Enabled entities are updated in Home Assistant as soon as OpenEMS pushes updates via the WebSocket connection. Currently, there is no throttling, but it could be easily added if necessary for performance reasons in Home Assistant.
  • There is currently no limitation how many channels can be enabled in parallel. The by default enabled 50 entities represent exactly as what also the WebUI subscribes to after the login. However, be careful with expanding to very large numbers. I don’t know what amount OpenEMS can handle (or if these subscription have a performance relevance at all)

To install, you need to add the following Repo in HACS: GitHub - Lamarqe/ha_openems: Home Assistant Integration for FEMS and OpenEMS
But be warned, this is currently only an alpha version status.

Currently missing / next steps:

  • Proper documentation
  • As I want to control my Wallbox settings via Home Assistant, I am working on the possibility to update component configs (in a generic way). For a generic implementation, it requires an extension to be merged, but I might simply hard-code the missing generic information for the Wallbox use-case.
  • Once this is done, I will most likely re-structure the code to improve the quality and maintainability. The current implementation is mostly a quick hack of 2-3 nights in order to evaluate feasibility and gather some feedback.

I also got started in including the OpenEMS and FEMS logos in Home Assistant. As this is still in progress, the Integration currently shows up without a logo.

Hi,

thanks for your Contribution!

I do not know in which way it is feasable to use the JsonRPC for HA, if OpenEMS UI also uses it aswell - did you test if it works properly if OpenEMS UI and your HA Implementation are using the RPC?

My guess is, that the RPC is pretty overwhelmed everytime 50 Channels are asked for and throw Exceptions if Channels are not active (for example if ess0 has the name ess1 or ess2 or any other name) or is not configured at all.

Also there is a JSON API to get the Channels - maybe use the RPC only ONCE to get all possible channels dynamically and then ask for them in Read Only JSON API which can handle the Requests and is intended to be asked for Data by external Systems aswell.

Just my 2 Words and thoughts :slight_smile:

Greetings

The entire communication is based on websockets and there is only a single subscription message sent to openems. Afterwards, openems sends updates itself.

This is fully identical to how the regular webui or fenecon2mqtt communicate with openems. Having that said, its 100% certain that 50 channels are absolutely no problem. So everything is working fine. There is no problem to be solved here.

The point is: the integration exposes the list of all openems channels to home assistant. For my local installation, this means 1700 channels. This is why by default 1650 are disabled, meaning the integration does not subscribe for updates of these.

Theoretically, users could enable all of these. How openems can handle this large number of subscribed channels in its update push implementation, is unknown and should be used with caution.

1 Like