Connection issue with OpenEMS
Hi, not sure if someone with OpenEMS (no commercial Fenecon) already sucessfully tested your integration? But I cannot connect to my openEMS instance. Looks like something is wrong with the internal configuration? I configurated in HA like this:
But I received always an "Unknown error". After I created additional websocket on port 8084 (as I had error messages in the log in HA pointing to 8084) I was able to submit the config to my openEMS Server but still was not able to get any data. Using the error message and AI I added my host in openems.py directly:
And now I receive data and all is fine.
I test the integration on a regular base with OpenEMS.
Furthermore, the parameter you changed in the code is used exclusively for internal IDs and naming of devices / entities. It is not relevant while making connections to the OpenEMS system.
So I am a bit confused currently 🤔
Edit: Does your OpenEMS system not have a _host component and a Hostname? This could explain the problem.
In my local OpenEMS system this component always exists by default. I can add an extra fallback logic. But I wonder to what value. Maybe you could first check why this component does not exist.
At the minimum, I can handle to problem better and provide users with a more clear error message in this case.
One more comment regarding the port number: The integration is implemented to work with an OpenEMS system which was set up as described here: https://openems.github.io/openems.io/openems/latest/gettingstarted.html The howto lists the port numbers which are even the default values when setting up an OpenEMS system.
To handle more unique setups, I had explicitly added the WebSocket connection URL option. This should be sufficiently generic. I believe this is also not your problem currently. I guess the missing _host component is the root cause.
Ah, this is the host from openEMS comonent and not from the HA component? The _host in my openEMS seems to be emtpy.
I'll need to check how to configure that. Thanks for the support. I'll try this (probably not before beginning of next week) and give feedback. Have a nice weekend!
The integration takes the value of the _host/Hostname channel and uses it for purposes like internal IDs or even user visible strings to identify the system by a name.
You can query the the channel value also via REST.
For my OpenEMS system, this returns:
{"address":"_host/Hostname","type":"STRING","accessMode":"RO","text":"","unit":"","value":"linuxlaptop"}
I never configured anything in this regard in OpenEMS myself. For me, this works like that just right away, after starting OpenEMS Edge and enabling the REST controller.
it is also filled for me.
Can you please summarize for me what is required? I need one websocket which is the one for the regular UI (in my case on Port 8075).
Do I need anything in addition? Do I also need the "Controller Api REST/JSON Read-Write"? And if so, on which Port?
Thank you and best regards, Rico
I guess you want to connect directly to the OpenEMS edge, not via the backend? Thats the 3rd connection option in the connection dialogue.
For this, I always enable in the Edge Apache Felix Web Console (running by default on port 8080):
- Controller Api Websocket (default config: port 8085)
- Controller Api REST/JSON Read-Only (default config: port 8084)
Thank you!
- Controller Api REST/JSON Read-Only (default config: port 8084)
This was the missing piece. After configuring this in OpenEMS everything works as expected (I still need the custom url, as my UI default port is not 8085 but 8075).
Perhaps you could add a note that the websocket on Port 8085 (or whatever) needs to be active (which is quite clear) but also a Controller Api REST/JSON Read-Only on Port 8084 is mandatory (that was not clear to me). That would help people like me installing everything smoothly :-)
Thank you so much for the integration and also for you support!
I might simply remove the usage of the REST interface for all connection types.
It is already removed for the FEMS online portal (which does not provide the REST API). This seems to be working fine. So I will most likely access the required information in the same way also for the local monitoring.
This will also reduce the overall implementation footprint and avoid the necessity to make the REST port configurable and make the config dialogue even more complex.
Changed as proposed via 073621ad65e96dc3b90b5cea46932ba0dbf07da4. Now it should also work without setting up the the REST controller in OpenEMS.
Could you try it and share feedback?
Edit: This change is now also available in the new pre-release version v1.2.1 Edit2: Please dont switch to v1.2.1 yet. There are some bugs in this version, due to unrelated changes. I will have to fix it as soon as I find time.
Hi. Ok, thanks for your feedback. I'll test it out once it is fixed. Just let me know. Habe a nice week :-)
There is now a v1.2.2 which solves the previous problems and is hopefully not introducing new ones. 🙈
Thank you! I reinstalled everything and now it works fine. Have a nice christmas time :-)