value format now .1f
This commit is contained in:
parent
ae7335c3df
commit
704bf29892
|
@ -51,7 +51,7 @@ def handleJson(jsonObj):
|
||||||
if isinstance(jsonObj, list):
|
if isinstance(jsonObj, list):
|
||||||
if 'online-level' in jsonObj:
|
if 'online-level' in jsonObj:
|
||||||
#typ = jsonObj[1]["LevelValues"][0]["Type"]
|
#typ = jsonObj[1]["LevelValues"][0]["Type"]
|
||||||
value = jsonObj[1]["LevelValues"][0]["Values"]
|
value = jsonObj[1]["LevelValues"][0]["Values"][0]
|
||||||
NmtId = jsonObj[1]["NmtId"]
|
NmtId = jsonObj[1]["NmtId"]
|
||||||
time = jsonObj[1]["Time"]
|
time = jsonObj[1]["Time"]
|
||||||
valuestore[NmtId] = value
|
valuestore[NmtId] = value
|
||||||
|
@ -61,9 +61,9 @@ def handleJson(jsonObj):
|
||||||
@app.route('/nmt/<int:id>')
|
@app.route('/nmt/<int:id>')
|
||||||
def nmtid(id):
|
def nmtid(id):
|
||||||
if id in valuestore and datetime.now(timezone.utc) - parser.parse(datestore[id]) < timedelta(seconds=30):
|
if id in valuestore and datetime.now(timezone.utc) - parser.parse(datestore[id]) < timedelta(seconds=30):
|
||||||
return valuestore[id]
|
return format( valuestore[id], '.1f')
|
||||||
else:
|
else:
|
||||||
return "Not Found"
|
return "E_NA" # Entweder out of date oder nicht existent
|
||||||
|
|
||||||
# Gibt eine Liste mit verfuegbaren ids zurueck
|
# Gibt eine Liste mit verfuegbaren ids zurueck
|
||||||
@app.route('/ids')
|
@app.route('/ids')
|
||||||
|
|
Loading…
Reference in a new issue