Create component from Factory via REST API

Hello,

I am experimenting with configuring OpenEMS Edge entirely via the REST API.

I notice that the API contains the concepts of "components" and "factories" where components are the actually existing components - identified by parameters such as “ess0” etc that are defined when they are created.

I noted the function updateComponentConfig in the docs for the REST API which allows us to update the config of an already running components - e.g changing parameters or activating/deactivating them.

My question is whether it is possible to instantiate components for the first time from factories using JSONRPC calls? E.g if I wanted to create an instance of a component such as Controller.Ess.GridOptimizedCharge because I want my edge system to start using this controller.

If so, what is the syntax for doing this?

Any help would be greatly appreciated :slight_smile:
Thomas

Or to put it a different way - is there any way to instantiate components other than through the Apache Fenix Web Portal?

Hi Thomas,

I love it, when I can just point to already existing documentation… :wink:

https://openems.github.io/openems.io/openems/latest/edge/configuration.html

If your plan is to preseed an Edge device with a default configuration, you could also use a variant of this script:

Regards,
Stefan

1 Like

Thank you Stefan!

Very useful when the method is already documented - seems like you can never read the docs enough!

I think the remote option via JSON-RPC is what we need.

I was not aware of the createComponentConfig method as I didn’t see it in the documentation page for the REST-Api Controller
https://openems.github.io/openems.io/openems/latest/edge/controller.html#_endpoint_jsonrpc

Is there anywhere I can find a complete list of all methods supported by the /jsonrpc endpoint? (Outside of the source code :wink: )

No, unfortunately not. Long term plan is to implement something like https://open-rpc.org/ or Swagger, but nothing has happened in that direction yet.

Glad I could help. :slight_smile: