with engine.connect() as conn:
cursor = conn.execute('select value, timestamp from sensors where sensor_id=%s order by timestamp desc limit 1', sensorid)
result = [dict(row) for row in cursor]
- return result[0]['value'], result[0]['timestamp'].strftime('%Y-%m-%d %H:%M')
+ return result[0]['value'], result[0]['timestamp']
@app.route('/api/<version>/sensors/')
def index():
airvalue, airtime = currentairtemperature(apikey, cityid)
watervalue, watertime = currentwatertemperature('0316a21383ff') # config? mainwatertemp?
- watervalue = "{:.1f}".format(watervalue) if isinstance(watervalue, float) else watervalue
return render_template(
'seepark_web.html',
{% endif %}
</p>
<p id="currentwater">
- <strong>Wasser: {{ watervalue }}°C</strong><br />
- <small>({{ watertime }})</small>
+ <strong>Wasser: {{ watervalue|round(1) }}°C</strong><br />
+ <small>({{ watertime.strftime('%Y-%m-%d %H:%M') }})</small>
</p>
</div>