Edge - different config handling in Felix console and UI

We are currently experiencing some problems with UI widgets that cannot parse parameters properly.

After some digging it turns out, that OpenEMS has a different handling of component configurations, depending on whether they initially come via the Felix Console or the OpenEMS UI.

Felix - (Create) a new component configuration via Felix may contain Integer and Boolean Values like in this example config output file:


Creating/modifying such a component via OpenEMS UI leads to the following output:
OpenEMS UI - (Create)


Note the missing “Typeanchor” I and B above.

OpenEMS UI - (Modify)


The different handling of the configuration generates errors in some OpenEMS UI widgets. Because e.g. in Javascript the parameter “verbose” is handled as string “false” and not as boolean ‘false’.

Digging further, leads us to JsonUtils:getAsBestType. Fixing this, would fix the OpenEMS UI (Modify). But this method is probably not responsible for OpenEMS UI (Create). We are still evaluating this.

Just want to take the opportunity to inform you about this behavior.
This is neither easy to find nor easy to test. But it may have a huge impact on customers experience.

@c.lehne Thanks for reporting. I just had a similar problem today with a value being updated via OpenEMS UI, which lead to an Integer value without "Typeanchor” I. Afterwards the Component could anymore read the Config properly during @Activate.

There have been updates to Apache Bundles recently. Could these have caused the issues? I never found the missing Typeanchor to be a problem before.


I am still not sure, where it comes from. We are still using org.apache.felix:org.apache.felix.scr version 2.2.6. So I don’t think that the library has to do with it. I checked all our library updates of the last 3 months but can’t find an obvious candidate.

We did several checks and it looks like OpenEMS edge and OpenEMS backend can handle both versions of boolean true, so it really seems to be now issue (same for Integer/Numbers).

So in the end we changed the UI widget to something like that

if ((typeof myvar == "boolean" && myvar == true) || myvar == 'true') {
  // handle true condition

And now it works, no matter if we use a felix configuration or a configuration via OpenEMS UI.

I did not feel very comfortable with that. But changing JSON Handling within OpenEMS Edge looks like it has a huge impact on a large number of different modules. And I did not feel very comfortable with that too.