ecopipeline 0.8.6__py3-none-any.whl → 0.8.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -753,7 +753,7 @@ def pull_egauge_data(config: ConfigManager, eGauge_ids: list, eGauge_usr : str,
753
753
 
754
754
  os.chdir(original_directory)
755
755
 
756
- def tb_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: datetime = None):
756
+ def tb_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: datetime = None, create_csv = True):
757
757
  if endTime is None:
758
758
  endTime = datetime.now()
759
759
  if startTime is None:
@@ -770,7 +770,6 @@ def tb_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: dat
770
770
  df = df.sort_index()
771
771
  df = df.groupby(df.index).mean()
772
772
  return df
773
-
774
773
  url = f'https://thingsboard.cloud/api/plugins/telemetry/DEVICE/{config.api_device_id}/values/timeseries'
775
774
  token = config.get_thingsboard_token()
776
775
  keys = _get_tb_keys(config, token)
@@ -808,8 +807,14 @@ def tb_api_to_df(config: ConfigManager, startTime: datetime = None, endTime: dat
808
807
  df = pd.DataFrame(data)
809
808
  df.index = pd.to_datetime(df.index, unit='ms')
810
809
  df = df.sort_index()
810
+ # save to file
811
+ if create_csv:
812
+ filename = f"{startTime.strftime('%Y%m%d%H%M%S')}.csv"
813
+ original_directory = os.getcwd()
814
+ os.chdir(config.data_directory)
815
+ df.to_csv(filename, index_label='time_pt')
816
+ os.chdir(original_directory)
811
817
  return df
812
-
813
818
  print(f"Failed to make GET request. Status code: {response.status_code} {response.json()}")
814
819
  return pd.DataFrame()
815
820
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ecopipeline
3
- Version: 0.8.6
3
+ Version: 0.8.7
4
4
  Summary: Contains functions for use in Ecotope Datapipelines
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: GNU General Public License (GPL)
@@ -2,7 +2,7 @@ ecopipeline/__init__.py,sha256=d48mO5La6OrQDkRe_qqoY6lUx7x-e8krOH388jmWjwU,218
2
2
  ecopipeline/event_tracking/__init__.py,sha256=q49j46fXMUjNUPzL4FvXEppB93i3lUni-QUZpp61tt0,64
3
3
  ecopipeline/event_tracking/event_tracking.py,sha256=LOCLE7ju320O7CrwnWRIqHRa2uAqoq-KvXZ3zWQ2S74,13224
4
4
  ecopipeline/extract/__init__.py,sha256=gQ3sak6NJ63Gpo-hZXrtZfeKOTHLRyAVXfTgxxRpqPo,675
5
- ecopipeline/extract/extract.py,sha256=Fch2IvqGxMClKGniiJiKqyJhcFDwkckaeiGQRVnUGUg,46708
5
+ ecopipeline/extract/extract.py,sha256=wmvQpPGWWlYnG_gc53R7-hWl8ASyI_MwB0vXmJtMSlc,47039
6
6
  ecopipeline/load/__init__.py,sha256=NLa_efQJZ8aP-J0Y5xx9DP7mtfRH9jY6Jz1ZMZN_BAA,292
7
7
  ecopipeline/load/load.py,sha256=Ptxr0MOjns_HeVSmZsLLApHJGB-z6XOB2m8LNiVaD7E,23860
8
8
  ecopipeline/transform/__init__.py,sha256=hYb4F64fXdXtjBSYCqv6gLFBwKZjjnl0z7s291pFE98,2505
@@ -12,8 +12,8 @@ ecopipeline/transform/transform.py,sha256=DBQD4WqKmdXnGQMAj6tg75HtXiSemIc7c6nZxz
12
12
  ecopipeline/utils/ConfigManager.py,sha256=-g1wtExdvhYO5Y6Q3cRbywa__DxRMFruLrB4YanwaPY,12168
13
13
  ecopipeline/utils/__init__.py,sha256=ccWUR0m7gD9DfcgsxBCLOfi4lho6RdYuB2Ugy_g6ZdQ,28
14
14
  ecopipeline/utils/unit_convert.py,sha256=VFh1we2Y8KV3u21BeWb-U3TlZJXo83q5vdxxkpgcuME,3064
15
- ecopipeline-0.8.6.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- ecopipeline-0.8.6.dist-info/METADATA,sha256=-VzwnJWFOLTa3NoreQAXc0PFJNGn0eJoiRTFf8i1jmc,2329
17
- ecopipeline-0.8.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- ecopipeline-0.8.6.dist-info/top_level.txt,sha256=WOPFJH2LIgKqm4lk2OnFF5cgVkYibkaBxIxgvLgO7y0,12
19
- ecopipeline-0.8.6.dist-info/RECORD,,
15
+ ecopipeline-0.8.7.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ ecopipeline-0.8.7.dist-info/METADATA,sha256=1ztVLR8JPED0dq4uWtJ0rCylEQ2RuP-6l52dja8Ll_k,2329
17
+ ecopipeline-0.8.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ ecopipeline-0.8.7.dist-info/top_level.txt,sha256=WOPFJH2LIgKqm4lk2OnFF5cgVkYibkaBxIxgvLgO7y0,12
19
+ ecopipeline-0.8.7.dist-info/RECORD,,