Ha_openems: FEMS and OpenEMS integration

I can’t find the ctrlEmergencyCapacityReserve0/IsReserveSocEnabled Where should it be?
Or is it only available if you have an AVU or so?

It’s under the service ctrlEmergencyCapacityReserve0 and you have to enable it manually

I can’t even find the service ctrlEmergencyCapacityReserve0. But it’s also missing from the FEMS GUI itself. I will open a ticket with Fenecon.

So your FEMS system doesn’t have a “Notstromreserve” at all?

See here:

Die Notstromfunktion kann nur von Ihrem Installateur bei der Konfiguration des Speichersystems aktiviert/deaktiviert werden. Dies kann auch nachträglich noch geändert werden, kann aber zu Hardwareänderungen in Ihrer Unterverteilung führen.

So you need to talk to your electrician, not to Fenecon.

Was exactly the same situation for me. My electrician was even able to enable the functionality from remote just a few hours later. There were no changes to the hardware installation required.

It should be enabled by default:

So either you had disabled it manually before, or there is / was a bug which lead to the enitity being disabled when you configured the integration.

However, new users should not be required to manually enable the entity.

Excellent work! Been using it for a while now without any issues!

One item for the wishlist when you work on the code again: It would be great if we could flip the charge mode setting from excess charge to manual charge via Home Assistant as well. That’s one button I would still use in the FEMS app :slight_smile:

Edit: I just noticed you are working on select and enum entries as well, so that will probably enable that feature! Looking forward to it!

I just realised: By adding the option to turn the Wallbox charger on and off I can finally work around the silly bug in Fenecon that the battery will be used as soon as a high power device is turned off! That’s always been bugging me, no checks are in place to ensure the battery is NOT used when charging with excess power is enabled and storage has priority. It will gladly empty the house battery if a high power device is turned off and energy is sold to the grid for a very short time before the system adjusts itself.

My small automation simply enabled the Wallbox for excess charging once the target battery level of 97% is reached. Once that’s the case, the fenecon system correctly detects excess power by looking at battery consumption and grid exports.

Thanks for adding this feature, no more babysitting required by myself and going through the FEMS app until this issue is properly addressed by Fenecon/OpenEMS!

Hi,
this looks really promising.

Unfortunately I cannot get it to run.

I’m running OpenEMS as a Docker Stack with OpenEMS Edge and OpenEMS UI. I tried entering the IP of the OpenEMS Edge as well as UI when configuring the HA integration.

For the UI there is no user in OpenEMS. So I tried “x” as well as “guest”.

It shows “Unknown error occurred” no matter, what I enter.

Any idea what I am doing wrong?

I have published a new pre-release of version 0.4:

  • New feature: Support creation of select entities for string enum component properties and allow updates of them.
  • Switch to port 8085 for WebSocket communication (should from now on work for both: FEMS and OpenEMS).

I have tested the String enums with two properties:

  • ctrlEvcs0/_PropertyChargeMode
  • ctrlEvcs0/_PropertyPriority

@salomonde : Welcome to the home assistant community. The mistake is on my side, not on yours. The integration used port 80 until now for the websocket communication. With version 0.4 I switched to port 8085. This should work for FEMS and OpenEMS users. Can you please try and let me know if it solves the issue for you. If not yet, we can work together in a github issue to resolve the problem.

One comment: Sadly, my OpenEMS MR which would make these properties auto-discoverable, is still not merged. What I did for now, was to manually enhance the OpenEMS config via extra config files. I started to fill the config with all String Enum properties which existed in my personal minimalistic OpenEMS dev setup: enum_options.json
I am sure, there will be more. Users are invited to submit PRs to enhance the config.

I uploaded v0.5 which allows to update number properties.

The integration generates entities only for channels which have limits defined in a dedicated config file. The config is set up currently for the following channels:

  • ctrlEvcs0/_PropertyEnergySessionLimit
  • ctrlEvcs0/_PropertyForceChargeMinPower (note: values are defined per phase. Unlike the regular Fenecon UI, there is no logic in place to calculate the total value → solved with v0.6
  • ctrlEvcs0/_PropertyDefaultChargeMinPower
  • ctrlEmergencyCapacityReserve0/_PropertyReserveSoc

With that, I have added the final piece of functionality which I had in mind for my personal use-cases when I started with this integration.

Next steps:

  • Set up proper logging
  • Create documentation

Once these two aspects are covered in a release, I would call it a first beta version.

2 Likes

Thanks! Enabling and setting the reserve works well. But setting IsEssChargeFromGridAllowed does not work (it shows up but clicking it does not change anything and the switch resets after a short time), is there a specific reason for this?

I can only suspect that its a permission issue. But in this case, there should be an error message in Home Assistant.
This is how it looks to me when I try to be “user”:
grafik

You need to be at least “owner” for updating component configs.

========================================
Update: Wow, thats a tricky one. The property IsEssChargeFromGridAllowed exists in very many components. The one which is created as an entity via the integration is part of the _sum component. Toggling this property does not seem to have any effect.
The one which is in use via the Fenecon UI (and does the job properly) is part of the “_meta” component. These entities are currently ignored by the integration (explanation: see here ). :thinking:

Yep, I also just wanted to write about that, but you were faster. :grinning:
The property that needs to updated is actually _meta/isEssChargeFromGridAllowed.
Maybe you could add a feature that all enities in the const.py that you mentioned are also added/enabled? (to limit the amout of additional entites but still be able to add specific cases)

Hi,

I could use some help. Currently I’m using the Rest API to query the heat pumpt connection:


- resource: "http://1.1.1.1:8084/rest/channel/ctrlIoHeatPump0/.*"
  username: x
  password: user
  authentication: basic
  scan_interval: 60
  sensor:
    - value_template: '{{value_json | selectattr("address", "equalto", "ctrlIoHeatPump0/Status") | map(attribute="value") | first }}'
      name: "FEMS SGReady Aktueller Status"
      state_class: measurement
      unique_id: "fems/ctrlIoHeatPump0/Status"
    - value_template: '{{value_json | selectattr("address", "equalto", "ctrlIoHeatPump0/RecommendationStateTime") | map(attribute="value") | first }}'
      name: "FEMS SGReady Einschaltempfehlung"
      unit_of_measurement: "s"
      device_class: duration
      state_class: measurement
      unique_id: "fems/ctrlIoHeatPump0/RecommendationStateTime"
    - value_template: '{{value_json | selectattr("address", "equalto", "ctrlIoHeatPump0/RegularStateTime") | map(attribute="value") | first }}'
      name: "FEMS SGReady Normalbetrieb"
      unit_of_measurement: "s"
      device_class: duration
      state_class: measurement
      unique_id: "fems/ctrlIoHeatPump0/RegularStateTime"
    - value_template: '{{value_json | selectattr("address", "equalto", "ctrlIoHeatPump0/ForceOnStateTime") | map(attribute="value") | first }}'
      name: "FEMS SGReady Einschaltbefehl"
      unit_of_measurement: "s"
      device_class: duration
      state_class: measurement
      unique_id: "fems/ctrlIoHeatPump0/ForceOnStateTime"
    - value_template: '{{value_json | selectattr("address", "equalto", "ctrlIoHeatPump0/LockStateTime") | map(attribute="value") | first }}'
      name: "FEMS SGReady Sperre"
      unit_of_measurement: "s"
      device_class: duration
      state_class: measurement
      unique_id: "fems/ctrlIoHeatPump0/LockStateTime"

I can’t find these attributes in the this new FEMS integration. The configuration is there (although disabled). But is the state not there? Or under a wildly different name?

Regards,
Robert

Can you post a screenshot of all the services of the FEMS device? (Maybe blur the fems number)
And it is there, could could you also post a screenshot of the service with ctrlIoHeatPump0?

Sure.




These ones?

This problem is caused by a hard-coded behavior to not create entities for non-property channels of components whose names start with “ctrl”.

During the last days I have developed an options flow handler which allows users to select via the UI for which components the integration will create entities. Having this extended flexibility, I have removed the hard-coded limitation I explained above.

This will also solve the problem of the missing _meta channels which were discussed above. Essentially, this new version will allow users to pick every channel which is available in the system.

As of now, development of this extension is in a state in which the targeted behavior is working fine for regular sensors. I still need to do necessary code adjustments for number, select and switch properties. After some more testing, I will make it available for everybody.

Thanks, that sounds great! :+1:

I have published the new version v0.6.0 as a pre-release in this minute.

New option to configure the config entry:

Selection of enabled components:

If there are no problems discovered here, I will set is as the main release by the end of this week.

I expect that users who migrate to v.0.6.0 might lose some personal settings regarding enabled entities. Users will have to re-enable the correct components and entities manually after migrating to the new version. But data should not be lost, as unique_ids are not changed. All of my local tests confirm this.