my name is Dustin and I’m new to this community. Since last year I own a Fenecon System, based on OpenEMS.
Today I’ve started to create a template for the foss NMSZabbix. I want to visualize the data of the EMS in another way and also might need a way to react to certain events, for instance a switch from On-Grid to Off-Grid.
Currently the template is hard-coded, so there is an item for meter0/State and an item for meter2/State. This fits to MY system, but will not fit to others. Zabbix has the possibility to automate item-generation, but i could not find a REST endpoint which creates a list of all channels in the system. this might allow a kind of auto-configuration (called discovery) of the monitoring system.
Do you know if such an endpoint exists?
In addtion, I noticed the meter2 (in my case that seems to be the backup-power), does not return a frequency but null. I reckon this might be because, the system is currently in On-Grid mode and the inverter is turned off, is this assumption correct?
As up to this writing I’ve implemented approximately 100 endpoints manually. Automatic discovery will make things much simpler on systems with more than two meters
I’m going to publish the template as on github once I’ve polished it a bit. If you are already interested, tell me. Unfortunately I can only test it against my FEMS and not against some other OpenEMS systems.
thanks for your initiative and welcome to the Community.
Internally OpenEMS Edge uses an EdgeConfig object, that holds all the information you require. Right now, this is not available via the REST-Api, though. It would be available via a Websocket connection - this is what the local OpenEMS UI does - but that might not be trivial to implement in Zabbix. REST would clearly be better. Let me see if we can implement such a feature… It would require some changes in RestHandler.java. I noted this thread as a reference in our internal Dev-Tasks list.
There has been a bugfix recently that had broken another feature, that you could use to receive all Channels and their values: Rest call of Write_Only channel returns error · Issue #2025 · OpenEMS/openems · GitHub. The REST-Api supports wildcards, so /rest/channel/*/* should work with the latest version of OpenEMS and FEMS (version 2023.1.2). Downside of this approach is, that you cannot automatically identify the purpose of the Channels… you could read the _PropertyAlias Channel though, which might give some indication.
I have never used Zabbix myself, but I am also curious to see your implementation. Are those 100 endpoints read with individual REST calls or in another way? We’ve been thinking about providing a GraphQL-Api for such use-cases…
Stefan, thank you for your nice welcome and and your reply.
the wildcards do not work on my FEMS 2023.1.2 and jetty returns a 404.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr><th>URI:</th><td>/rest/channel/*/*</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
<tr><th>SERVLET:</th><td>-</td></tr>
</table>
<hr/><a href="https://eclipse.org/jetty">Powered by Jetty:// 9.4.49.v20220914</a><hr/>
</body>
</html>
That _PropertyAlias channel is an interesting property.
Currently I’m polling each item with an individual rest call. I fear, this will lead to a stressed system. Unfortunately I do not have access to the OS below to measure CPU-load and memory-consumption.
Ok yes, there is actually a bug in the implementation. First: it’s not a simple asterisk, but a regular expression; second the matching for the Component-ID is wrongly implemented at the moment.
But for now at least this works: http://[Edge-IP]/rest/channel/_sum/.*
Polling so many Channels might cause problems, yes. That’s why I am planning to introduce GraphQL eventually… but it’s not on our high-priority roadmap at the moment unfortunately.
@stefan.feilmeier :
I see in Github that it is not yet possible to request EdgeConfig via the Rest API.
Are there plans to provide this capability on (relatively) short notice?
If not, I consider to implement a tool which is able to access EdgeConfig properties via WebSocket myself.
Before that, I wanted to double-check with you in order to avoid unnecessary efforts on my side.
Note: My use-case and request are fully unrelated with Zabbix. (I want to access ctrlEvcs0/priority in order to show it in Home Assistant. This priority appears to be available exclusively in EdgeConfig.) I use this thread, as you pointed out potential activities in this area above and mentioned it as a reference point for internal development activities.
It should be possible to get EdgeConfig via JSON/REST as long as you configure the Read/Write variant (“Controller Api REST/JSON Read-Write”).
All configuration properties are also available as _Property-Channel, so the information you are looking for is available as ctrlEvcs0/_PropertyPriority.