Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Graphs with EmonCMS
EmonCMS is a powerful open-source web-app for processing, logging and visualising energy, temperature and other environmental data.
EmonCMS provides interactive web elements that can be used for displaying data graphs. The web controls also include basic drill-in functionality to view detailed data views (see examples Image 1):
Image 1: Datafeed Examples with EmonCMS.
Create Input Feed from OpenRemote Sensors
Values from OpenRemote sensors can be recorded to your EmonCMS server. To enable EmonCMS support in your OpenRemote installation, follow the steps below.
EmonCMS support is still in development phase and not released as part of downloadable OpenRemote binaries. Therefore you will need to manually include the required files into your OpenRemote Controller install as described below.
1 Open "applicationContext.xml" configuration file located in your controller's /webapps/controller/WEB-INF/classes/ directory. You can use your favorite text or XML editor to do this:
cd OpenRemote-Controller/webapps/controller/WEB-INF/classes nano applicationContext.xml
2 Add the following XML snippet at the end of your "applicationContext.xml" file.
Replace the [EmonCMS Server URL] section in the XML snippet below with the HTTP URL that points to your EmonCMS server.
Include your EmonCMS API key in place of the [YourAPIKey] in the XML snippet below.
In the property "sensors", update the element with values of your OpenRemote sensor names ('YourSensor1', 'YourSensor2', etc.) – the values from these sensors will be processed and sent to EmonCMS server.
3 Modify the EventProcessorChain configuration in the "applicationContext.xml" file by adding a reference to the "emonCMSLogger" XML snippet you added in step 2 above. The XML element to add a reference looks like the following:
You will need to add the reference shown above in the "eventProcessorChain" XML snippet in the "applicationContext.xml" file. Search for the string "EVENT PROCESSING CHAIN" and add the "emonCMSLogger" reference as shown below:
<-- EVENT PROCESSING CHAIN ==================================================== | | | +--> <bean id = "eventProcessorChain" class = "org.openremote.controller.statuscache.EventProcessorChain"> <property name = "eventProcessors"> <list> <bean class = "org.openremote.controller.statuscache.rules.RuleEngine"/> <ref bean = "emonCMSLogger"/> </list> </property> </bean>
4 Save the "applicationContext.xml" file and exit the editor.
5 Finally, download new class file EmonDataLogger.class and save it into OpenRemote-Controller/webapps/controller/WEB-INF/classes/org/openremote/controller/statuscache/emoncms/ directory (you may have to create the directory if it does not exist yet).
6 Restart your OpenRemote Controller.
Add EmonCMS Graphs to Your Control Panels
To add graphs generated by EmonCMS into OpenRemote control panels, we need to add a Web View widget to the panel screen design.
First make sure you switch to User Interface Design View in OpenRemote Designer: Create a new panel and drag the Webview wiget on your panel.
You can set some properties like width, height, and set the URL property to your EMoCMS graph.
Here is an EmonCMS MultiGraph into my iPAD panel
Create Input Feed from External Sources
You can create an input from some external sources (none OpenRemote Ressources) sending a JSON HTTP request to EmonCMS. In my installation, I'm using Datalogger from Resol to monitor my heat solar installation. Since this device doesn't send notification or provide info that OpenRemote can't directly parse, I've created a small PHP script to parse the datalogger info and send JSON HTTP request to EmonCMS. sample:
Will add the value 252.4 to the "power" input and 15.4 to the "temperature" input