diff options
author | Dennis Eriksen <d@ennis.no> | 2023-02-04 14:18:18 +0100 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2023-02-04 14:18:18 +0100 |
commit | eb5e90aded9a7259ddecc94d9244393fa5abd2e6 (patch) | |
tree | 8e166a3bec6435c1490cff04cd704ae847b47eba /scripts/elvia.py | |
parent | queue sleep as variable (diff) | |
download | energyscripts-eb5e90aded9a7259ddecc94d9244393fa5abd2e6.tar.gz |
moving some variables around
Diffstat (limited to 'scripts/elvia.py')
-rw-r--r-- | scripts/elvia.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/scripts/elvia.py b/scripts/elvia.py index 6e4bc9f..2248238 100644 --- a/scripts/elvia.py +++ b/scripts/elvia.py @@ -8,13 +8,11 @@ from datetime import timedelta from tzlocal import get_localzone import requests -from common import dbi +import common apiKey = os.environ['el_elvia_token'] apiUrl = "https://elvia.azure-api.net/customer/metervalues/api/v1/metervalues" -pg_table = "elvia" - startTime = datetime.now(get_localzone()) - timedelta(days = 2) startTime = startTime.isoformat('T') endTime = datetime.now(get_localzone()).isoformat('T') @@ -53,4 +51,4 @@ for item in data['meteringpoints'][0]['metervalue']['timeSeries']: # Count new rows and insert -dbi("INSERT INTO " + pg_table + " VALUES(%s,%s,%s,%s,%s,%s) ON CONFLICT (startTime,endTime) DO NOTHING", values, verbose=True) +common.dbi(common.sql[common.name], values, verbose=True) |