The info on this page is for OED version 1.0.0. See "Help versions" menu at top of page for other versions.
Note: These features are only available to select people who oversee the OED site (called admins) so these features are not usually of interest to a general user.
This page describes the process of importing meters into OED via a CSV file. See the general CSV import page for an overview and information common to all CSV imports.
The information needed to upload meters is the same whether done via the web page or direct file upload. The web page looks as follows:
csvFile
parameter on direct file upload):
This gives the location of the CSV file containing the meter information. On the web page it is via a file
picker popup. See below on the file format.gzip
parameter on direct
file upload with default value
of yes. ): Note this is the Gnu zip format and not a standard .zip file format. Note that gzip
files are smaller in size for upload and also have internal validation to protect
against corruption so they are preferred.headerRow
parameter on
direct file upload): Is the first row of the CSV file header information and not an actual meter
(see below for format). The default value is no.update
parameter on direct file
upload): Each row is new information for the meter so it will be update with any provided values and
others are left as currently set. The default value is no.meterName
parameter on direct file
upload): This is only used if you want to change the name of a meter (not identifier). The meter
name provided is used as the name to update and the meter name value in the CSV is used as the new name.
Note you can only update a single meter name at a time meaning that the CSV can only have one row of meter
information.Meters in OED store a lot of information about them so there are many possible values. If the CSV file has a
header
row then it should be:
name,url,enabled,displayable,type,timezone,gps,identifier,note,area,cumulative,reset,reset start,reset
end,gap,variation,duplicates,timesort,end only,reading,start time,end time,previous end,unit,default graphic
unit,area unit,reading freq.
Currently OED does not use the header row so the names are not crucial but OED may do so in the future so using
these column header names is a good idea. Detailed information on the columns/values are described on the admin meter creating page. The order of the items is somewhat different
than those specified for the header row above.
Each following line should contain the values for one meter in exactly the order listed for the header row
example above. The column can be blank where the default value
for OED will be used if the meter creation information does not indicate it is required. Information needed for
CSV
upload compared to the meter creation page information are:
Many spreadsheet programs automatically format text that looks like a time or date into a different format. In general, to avoid this, one should set those fields to be text rather than a time or date. If this is not done then you will likely get a format error or unexpected data when you upload a CSV file.
If you upload a CSV that has missing or incorrect values then it could cause issues. However, some values will be noted with red boxes when you edit this meter and then it can be corrected. For example, if you put in an area but not a unit this will happen. If you have any doubts then it is a good idea to look at the values on the meters page to verify they are what you wanted.
Below are the lines for a CSV meter import file with a header row and available in this meters.csv file. It will import two meters (Meter 1 and My
Place (identifier) or Meter
2 (name)) where the meters are not enabled but are displayable. Please note that "3,5" is a pair of values
separated by a comma that would be in a single column of the CSV file and input without the quotes, i.e., 3,5.
The quotes are added when such a CSV is saved to make it clear that the comma is not a new column. Most
values that are optional and unspecified so the
default values are used for Meter 1 but are provided for the second meter. Also note that values that are "yes"
on
dropdown menus for meter creation must be "true" and values that are "no" must be "false" in this file (but not
the curl command). This file
can be loaded
using the curl command of:
curl https://myoedserver.com:3000/api/csv/meters -X POST -F 'headerRow=yes' -F 'gzip=no' -F 'email=csvuser@myorg.com' -F 'password=csvuserpassword' -F 'csvfile=@meters.csv'
assuming the shown URL, user email and password. (See admin
reading sample files for more information on URL, email and password.) You need to reload the OED web
page so your browser is aware of the new meters after a curl import but you will get an empty graphic if used
since they don't have
any data yet.
name,url,enabled,displayable,type,timezone,gps,identifier,note,area,cumulative,reset,reset start,reset end,gap,variation,duplicates,timesort,end only,reading,start time,end time,previous end,unit,default graphic unit,area unit,reading freq. Meter 1,,false,yes,other,,,,,,,,,,,,,,,,,,,Electric_Utility,,, Meter 2,127.0.0.0,false,true,obvius,Pacific/Galapagos,"3,5",My Place,special note,123,true,true,11:50,12:10,5,10,2,decreasing,true,,,,,Electric_Utility,kWh,meters,13:00
What follows are the common messages returned from a meter upload along with their meaning:
<h1>SUCCESS</h1>Successfully inserted the meters.
<h1>FAILURE</h1>CSVPipelineError: Failed to upload meters due to internal OED Error: Meter name of
pipe41
seems to exist when inserting new meters and got DB error of: duplicate key value violates unique constraint
"meters_name_key"
<h1>FAILURE</h1>CSVPipelineError: Failed to upload meters due to internal OED Error: Meter name of
pipe42
does not seem to exist with update for meters and got DB error of: No data returned from the query.
<h1>SUCCESS</h1>Successfully inserted the meters.<h1>FAILURE</h1>CSVPipelineError: Failed to
upload meters due to internal OED Error: Meter name provided (pipe40) in request with update for meters but
more than one meter in CSV so not processing
You need to reload your web browser pages as described here.