nrgpy.cloud_api.export module#
- class nrgpy.cloud_api.export.CloudExport(out_dir: str = '', site_id: str = '', site_number: str = '', logger_sn: str = '', start_date: str = '2014-01-01', end_date: str = '2030-12-31', file_format: str = 'txt', client_id: str = '', client_secret: str = '', url_base: str = 'https://cloud-api.nrgsystems.com/nrgcloudcustomerapi/', nec_file: str = '', export_type: str = 'measurements', interval: str = '', concatenate: bool = True, unzip: bool = True, **kwargs)[source]#
Bases:
CloudApi
Uses NRG hosted web-based API to download data in text format To sign up for the service, go to https://cloud.nrgsystems.com
Note that the site must exist in the NRG Cloud platform, and you must have Contributor or Administrator level access to the site to use these features.
Use the Site Number or NRG Cloud Site ID to choose the site.
Examples
Download 15 days of data with an NEC file applied, and read data
>>> import nrgpy >>> >>> client_id = "go to https://cloud.nrgsystems.com for access" >>> client_secret = "go to https://cloud.nrgsystems.com for access" >>> save_dir = '/path/to/exported/data' >>> >>> exporter = nrgpy.CloudExport( client_id=client_id, client_secret=client_secret, out_dir=save_dir, nec_file='12vbat.nec', site_id=245, start_date="2021-05-01", end_date="2021-05-15", ) >>> exporter.export() >>> # read result >>> reader = nrgpy.sympro_txt_read(exporter.export_filepath) >>> reader.format_site_data() >>> if reader: >>> print(f"Site number : {reader.site_number}") >>> print(f"Site description : {reader.site_description}") >>> reader.interval_check = nrgpy.check_intervals(reader.data) >>> else: >>> print("unable to get reader")
Download 15 days of data files from ZX 300 site
>>> import nrgpy >>> >>> client_id = "go to https://cloud.nrgsystems.com for access" >>> client_secret = "go to https://cloud.nrgsystems.com for access" >>> save_dir = '/path/to/exported/data' >>> file_format = 'zx' >>> >>> exporter = nrgpy.CloudExport( client_id=client_id, client_secret=client_secret, out_dir=save_dir, file_format='zx', site_id=57, start_date="2022-05-01", end_date="2022-05-15", ) >>> exporter.export()
- Attributes:
- out_dirstr (path-like)
path to save exported data
- site_idint
NRG Cloud site identifier (NOT the site number)
- site_numberint
site number
- logger_snint
serial number of data logger
- start_datestr (‘{YYYY}-{MM}-{DD}T{HH}:{MM}:{SS}’)
start date/time of data export
- end_datestr (‘{YYYY}-{MM}-{DD}T{HH}:{MM}:{SS}’)
end date/time of data export
- file_format{‘txt’, ‘rld’, ‘zx’}
whether SymPRO tab-delimited text or binary output or ZX
- client_idstr
available in the NRG Cloud portal
- client_secretstr
available in the NRG Cloud portal
- nec_filestr, optional
path to NEC file for custom export formatting
- export_type{‘measurements’, ‘diagnostic’, ‘events’, ‘communication’}
which type of data to export
- interval{‘oneMinute’, ‘twoMinute’, ‘fiveMinute’, ‘tenMinute’, ‘fifteenMinute’,
‘thirtyMinute’, ‘Hour’, ‘Day’}, optional averaging interval of exported data; must be a multiple of the logger’s statistical interval
- unzipbool
whether to extract the .txt data file from the .zip file
- session_tokenstr
- headersstr
headers passed in API call
- datastr
data passed in API call
- respstr
API response
- export_filepathstr (path-like)
path of export file
- nrgpy.cloud_api.export.cloud_export#
alias of
CloudExport