Kilometerstand abfragen, kW-Preis abfragen, Dateinamen abfragen
This commit is contained in:
+7
-7
@@ -11,19 +11,19 @@ def send_request(vdat):
|
|||||||
# GET http://homeassistant.local:8123/api/history/period
|
# GET http://homeassistant.local:8123/api/history/period
|
||||||
response = ''
|
response = ''
|
||||||
# vondatum = "2024-06-20T14:08:00.0000+00:00"
|
# vondatum = "2024-06-20T14:08:00.0000+00:00"
|
||||||
bisdatum = vdat
|
# bisdatum = vdat
|
||||||
vdat = '"' + vdat + '"'
|
# vdat = '"' + vdat + '"'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
hostaddress="http://homeassistant.local:8123/api/history/period/"
|
||||||
|
|
||||||
|
url=hostaddress+vdat
|
||||||
|
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
url="http://homeassistant.local:8123/api/history/period",
|
url=url, #"http://homeassistant.local:8123/api/history/period",
|
||||||
params={
|
params={
|
||||||
vdat: "null",
|
vdat: "null",
|
||||||
"filter_entity_id": "sensor.id_4_pro_performance_150_kw_204_ps_odometer",
|
"filter_entity_id": "sensor.id_4_odometer",
|
||||||
"minimal_response": "null",
|
|
||||||
"end_time": bisdatum,
|
|
||||||
"no_attributes": "null"
|
|
||||||
},
|
},
|
||||||
headers={
|
headers={
|
||||||
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI1ZmNhNDVkZWQ1Mzg0MDZmOTY0NWVjOTI0MDNmYTEwNiIsImlhdCI6MTcxODk3Nzg5NiwiZXhwIjoyMDM0MzM3ODk2fQ.BGuVaCR9UM4O_LqYlcLd4LRLM8F_Vwnb9oU_xwh0Wew",
|
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI1ZmNhNDVkZWQ1Mzg0MDZmOTY0NWVjOTI0MDNmYTEwNiIsImlhdCI6MTcxODk3Nzg5NiwiZXhwIjoyMDM0MzM3ODk2fQ.BGuVaCR9UM4O_LqYlcLd4LRLM8F_Vwnb9oU_xwh0Wew",
|
||||||
|
|||||||
+9
-2
@@ -5,12 +5,15 @@ import api_call
|
|||||||
import datum_umrechnen
|
import datum_umrechnen
|
||||||
|
|
||||||
|
|
||||||
kosten_pro_kwh = ''
|
kosten_pro_kwh = input("Kosten pro kW/h in Euro (z.B. 0.31)")
|
||||||
# kosten_pro_kwh = input('Kosten pro kWh (0.31) ')
|
# kosten_pro_kwh = input('Kosten pro kWh (0.31) ')
|
||||||
if kosten_pro_kwh == '':
|
if kosten_pro_kwh == '':
|
||||||
kosten_pro_kwh = 0.31
|
kosten_pro_kwh = 0.31
|
||||||
|
|
||||||
filename = '/Users/sven/Downloads/Eve Connect Export 28.06.2024.csv'
|
filename=input("Dateinamen angeben")
|
||||||
|
|
||||||
|
if filename == "":
|
||||||
|
filename = '/Users/sven/Downloads/Eve.csv'
|
||||||
|
|
||||||
# Datei öffnen
|
# Datei öffnen
|
||||||
file = open(filename, 'r')
|
file = open(filename, 'r')
|
||||||
@@ -29,6 +32,9 @@ verbrauch_gesamt = 0
|
|||||||
for zeile in inhalt:
|
for zeile in inhalt:
|
||||||
spalte = zeile.strip().split(',')
|
spalte = zeile.strip().split(',')
|
||||||
if counter > 0:
|
if counter > 0:
|
||||||
|
rfidkarte = spalte[0].strip()
|
||||||
|
if rfidkarte != '04D56A2A577484':
|
||||||
|
rfidkarte = '04D56A2A577484'
|
||||||
# Kosten pro Ladevorgang ermitteln
|
# Kosten pro Ladevorgang ermitteln
|
||||||
verbrauch = spalte[4].strip()
|
verbrauch = spalte[4].strip()
|
||||||
verbrauch = verbrauch.replace('kWh','')
|
verbrauch = verbrauch.replace('kWh','')
|
||||||
@@ -65,3 +71,4 @@ strkostenkwh = str(kosten_pro_kwh)
|
|||||||
print("Kosten pro kWh: " + strkostenkwh + " €")
|
print("Kosten pro kWh: " + strkostenkwh + " €")
|
||||||
verbrauch_gesamt = str(verbrauch_gesamt)
|
verbrauch_gesamt = str(verbrauch_gesamt)
|
||||||
print("Verbrauch Gesamt: " + verbrauch_gesamt)
|
print("Verbrauch Gesamt: " + verbrauch_gesamt)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user