Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


The documentation for this plugin are no longer accessible on the internet so its mirrored here.

Current Cost 3P Plugin

Getting Started

This is a HS3 replacement of a HS2 plugin for the Current Cost Envi/EnviR hardware ( A lot of the code has been changed and optimised from the HS2 version and it is not possible to upgrade an older database. Once downloaded from the updater then the plugin should install and install all of the files into the HomeSeer directories. Once the log says that they have been installed then in the HS3 web interface click Plug-Ins > Manage and then it should find an entry called Current Cost 3P. Using the drop down box select the COM port that the Envi is currently connected to (can be found in Windows device manager) and then click enable.

If the COM port is found and opened then there should be an appropriate entry in the HomeSeer log, please note that the Envi meter is relatively dumb and the plugin does not know that it has an Envi meter connected to it, as such please ensure that you are selecting the correct COM port. Five base devices should be then created in HomeSeer, these devices will hold information about the port status, the number days to log live data, the current kWh unit cost, the receiver temperature and receiver time. The devices will show the following:

Port Status - This will show ‘Connected’ or ‘Disconnected’ depending on whether or not the COM port has been opened successfully. This device will have a value of 100 and 0 for both statuses respectively. Days To Log Live - The plugin will record it’s own live electricity usage in addition to that recorded inside the Envi database. This can be used to show a more granular trend throughout a day. This device is how many days of that data to store, the higher the value the more data and the bigger the database. kWh Unit Cost - This figure is a representation of how much in your respective currency a kWh unit of electricity costs. This figure is used to perform calculations of how much it is costing at your present consumption figure.

Temperature - The Envi meter has a temperature sensor inside it (it is not installed at the current clamp sensor), this device reports that figure. Opinion varies as to the accuracy of this device. Receiver Time - The Envi meter also has an internal clock, this clock also suffers from accuracy issues and the only purpose of this is to establish the time of day to record data against. It is advisable to keep the time on the meter roughly accurate to your current time but it is not essential to have it precise.

Once the plugin starts to receive data from the Envi meter then it will create a set of ten devices per sensor, it will create these on the basis of live received data and these devices will be created automatically. If you have two sensors, Sensor 0 and Sensor 4 paired to Envi then it will create a block of devices for Sensor 0 and 4, it will not create any others. If you remove the pairing of a device in the Envi then it is then up to you to delete the ten devices from HomeSeer and they will not be deleted automatically. The instant data from the Envi device will then update these devices. These devices are relatively self explanatory, the breakdown of the wattage readings is on the basis that each sensor can have up to three current clamps connected to it. The total wattage from the unit is the sum of all of these channels. The ‘Now Estimated Cost’ is a value of the current figure of total wattage for that sensor multiplied by the kWh cost. The ‘Today Estimated Cost’ and ‘Today Estimated Use’ are calculated from a midnight-midnight logging of live data from the unit, this is a rough estimate. The ‘Pulse Count’ device is only for OptiSmart sensors, ignore this for the majority of applications. The energy summary is a device that will show either ‘Low’, ‘Medium’ or ‘High’ depending on the total wattage readings. The values are by default set to be:

Low - 0 Watts to 299 Watts Medium - 300 Watts to 4000 Watts High - 4001 Watts to 40000 Watts

As this amount is going to be relative to your typical usage you are welcome to adjust these values in the devices ‘Status Graphics’ tab. You can then change the range of the device to suit, if you wish to change this then look at the value column on the left hand side of the page and change the values.


Every two hours the Envi device will output data from its own internal database. This data is stored by the plugin into another SQLite database on your HS server. This database is then used by a charts and data table web page, to look at the charts click Plug-Ins > Current Cost 3P > Charts & Data. You will then get four tab pages of data, some historic charts on the first page, a chart on the second page with data taken every minute from midnight to the current time and then two pages of day/month data stored in a table form. If no data appears in these charts then you made need to leave the plug in for a number of hours until the next history download has taken place.

Example Charts:

Remote Connections

It is possible to run this plugin remotely on another computer. For this to happen the contents of the HTML folder should be left in the HomeSeer HTML directory, the following files should go onto the remote computer preferably in their own folder. Please also ensure on this computer you have the Visual C++ runtime redistributable installed HSPI_CCOST3P.exe HSPI_CCOST3P.exe.config \Bin\System.Data.SQLite.dll - You must create the \Bin\ folder for these two files \Bin\SQLite.Interop.dll HSCF.dll - Ensure same version as in the HS main directory Scheduler.dll - Ensure same version as in the HS main directory HomeSeerAPI.dll - Ensure same version as in the HS main directory The plugin should then be run by passing the IP address and COM port to the plugin like this: C:\Plugin\HSPI_CCOST3P.exe server= port=COM7

Energy API

The plugin logs data to the HomeSeer Energy API, this is in addition to the data that the plugin already logs. The plugin does this in a similar fashion to the devices that log the estimated use for the current day, this means that the values from the devices are logged on a minute timer interval and a kilowatt-hour figure calculated from these values. This data will be slightly more inaccurate owing to the fact the data is logged only every minute rather than every six seconds when new data arrives from the device itself, this is to eliminate excessive data being logged to the Energy API and to limit the system overhead. The current API exposes a number of calls that at the present time of writing do not appear to be actually in any charting, it may be that further work is done in the future with respect to this. By default all devices are created by the plugin with the default values of the fact the Current Cost sensors will be used to measure energy consumption and they will be monitoring an electricity meter. The Energy API allows you to also measure energy production, it may be that you have a Current Cost sensor on the output of a solar array which is measuring energy inputted into your respective system. In this case you will need to change the energy settings on the device that is measuring the respective data (please note that only the total wattage and channel one to three devices will have this option available). If say Sensor 9 was being used to monitor a solar array then go into the Sensor 9 Total Wattage device and you will now have a tab on the top of the device with the plugin name in it, enter this page.

You will have a number of options in this page, the first option is simply to not log data to the Energy API. This will not remove the device from the energy web page but instead it will no longer log data when the timer runs. The second option is the direction of the energy, the only options here are to either produce energy or consume energy. If you are producing energy on this device then select ‘Produced’ rather than ‘Consumed’. The last option is that to specify what this device should represent, there appears to be no actual guidance on this at this minute but you can specify if this device is a solar panel, wind turbine or other sort of energy producer. This also has options if you have set this device as an energy consumer, options available are appliance, light, meter service or other.

Note: There appears to be some issues with adding devices to the Energy API, it appears that several restarts of the plugin may sometimes be required to allow correct registration. If the devices do not appear then please restart the plugin and also restart HS.

Scripting Calls

The only relevant scripting calls that the plugin supports are those to produce a HTML extract of the charts. Making a call to the following functions via the hs.pluginfunction command will return a complete Javascript entry between and including the <script type="text/javascript"> and </script> tags. The following are the procedures to call:

bbarchart12m - 12 month bar chart (pass the sensor number as a single digit) blivelinetoday - Live line chart for today (no parameters required) blivelinehour - Live line chart for the last hour (pass the sensor number as above) bbarchart7d - 7 day bar chart (pass the sensor number as above) bbarchartlwc - Last week vs. this week bar chart (pass the sensor number as above) bbarchartlmc - Last month vs. this month bar chart (pass the sensor number as above) bbarchart30d - 30 day bar chart (pass the sensor number as above) bbarchartyear - Yearly comparison bar chart (pass the sensor number as above) bbarchart24h - 24 hour bar chart (pass the sensor number as above) An example call would be: hs.PluginFunction("Current Cost 3P", "", "bBarChart12M", New Object() {0}) to return the Javascript chart for the 12 month bar chart for sensor 0 which may look like this;

One method of getting these charts into HSTouch is detailed here,

Miscellaneous Functions

Three settings are available by creating a file called ccost3p.ini in the HS ‘Config’ directory, I anticipate that these functions will be rarely used and as such there is no option in the GUI to alter them. If you wish to change these settings the plugin will need to be re-started. Once you have created the file then add a line marked ‘[Options]’ and then below that you can add either or both of the following:

EnergyUpdateInterval - This is the timer interval to update the Energy API database, by default this timer runs at once a minute and I do not suggest going below this figure. If you wish you can increase this amount however be aware that the logged data will be less accurate the higher this figure is. This is a value in minutes, EnergyUpdateInterval=2 will log data every two minutes. EnergyEnabled - If you do not wish to log any data at all to the Energy API then please add a line to say EnergyEnabled=False and restart the plugin, if this is set to false then the timer will not start and the data will not be logged.

TimerDayEnabled - If you do not wish to log any data for the ‘Todays Estimated Use’ and ‘Todays Estimated Cost’ device (and in turn the live line chart for the day/hour) then you are welcome to set this value to false and the corresponding timer for that function will also not start. With this set to true the only data logged to the cc.db3 database will be the history data downloads.

OptionalCSSHeader - If you wish to specify your own CSS style to the page then this is an option INI file setting that will allow you to do this. It will add whatever is here to the header of the page. CSS is only used in the data tables page and the following are used in the plugin; tblCCHeader tblCCRowEven tblCCRowOdd

If you are happy with the way that the tables are presented then I would suggest avoiding this parameter.

JSON API & Charts

As of HS3 version there is now a method to query plugins for specific functions by a call that will return a plugin functions return in a JSON type response. You could possibly use this to embed the charts in your own external web pages. This is an example; Using that you will return something similar to; { "Response":"<script type="text/javascript">google.load("visualization", "1", {packages:["corechart"]});google.setOnLoadCallback(drawChart);function drawChart() {var data = google.visualization.arrayToDataTable('Day', 'This Week', 'Last Week'],['Fri', 7.179, 8.476],['Sat', 7.5, 6.898],['Sun', 7.218, 6.476],['Mon', 5.906, 7.234],['Tue', 7.117, 6.968],['Wed', 7.804, 7.085],['Thu', 6.257, 5.835);var options = {title: 'This Week vs. Last Week',orientation: 'horizontal',legend: {position: 'bottom'},series: {0:{color: '#2ca25f', visibleInLegend: true},1:{color: '#99d8c9', visibleInLegend: true}}};var chart = new google.visualization.BarChart(document.getElementById('bbarchartlwc_0'));chart.draw(data, options);}</script>" } Which you can then use in a web page.

Linux Support

As of version plugin version .36 I now support Linux. The plugin is not in the HS updater and as such it requires a manual installation and please see the main thread for this. In the main plugin link you will find a separate version for Linux that requires a specific version of SQLite supported on Linux. Extract the contents of the zip file into your main HS working directory and enable the plugin in the normal way remembering to pass the correct Linux serial port to it. If you have any issues with the plugin please post them here:

/data/webs/external/dokuwiki/data/pages/historic/homeseer_current_cost_ccost3p_plug-in.txt · Last modified: 2019/07/17 15:39 by genadmin

Was this page helpful?-11+1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki