About to push
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{{ device.name }} - SwitchBot Temps{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="hero">
|
||||
<div>
|
||||
<p class="eyebrow">Device readings</p>
|
||||
<h1>{{ device.name }}</h1>
|
||||
<p class="muted">{{ device.device_type }}. Local timezone: {{ timezone }}.</p>
|
||||
</div>
|
||||
<a class="button secondary" href="/">Back to dashboard</a>
|
||||
</section>
|
||||
|
||||
<form class="report-form compact" method="get" action="/devices/{{ device.id }}">
|
||||
<label>
|
||||
Day
|
||||
<input type="date" name="date" value="{{ date }}">
|
||||
</label>
|
||||
<button class="button" type="submit">View day</button>
|
||||
</form>
|
||||
|
||||
<section class="cards device-summary">
|
||||
<article class="metric-card">
|
||||
<h2>Samples</h2>
|
||||
<div class="reading-row">
|
||||
<strong>{{ readings|length }}</strong>
|
||||
</div>
|
||||
</article>
|
||||
<article class="metric-card">
|
||||
<h2>Low temp</h2>
|
||||
<div class="reading-row">
|
||||
<strong>{{ "%.1f"|format(stats.low) if stats else "n/a" }}°C</strong>
|
||||
</div>
|
||||
</article>
|
||||
<article class="metric-card">
|
||||
<h2>High temp</h2>
|
||||
<div class="reading-row">
|
||||
<strong>{{ "%.1f"|format(stats.high) if stats else "n/a" }}°C</strong>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<h2>Day graph</h2>
|
||||
<p class="muted">Temperature readings for {{ date }}.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrap">
|
||||
<canvas id="temperatureChart" height="360"></canvas>
|
||||
</div>
|
||||
<script id="chart-data" type="application/json">{{ chart_json|safe }}</script>
|
||||
<script src="{{ url_for('static', filename='chart.js') }}"></script>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<h2>Readings</h2>
|
||||
<p class="muted">Timestamped readings for this device and day.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>Temperature</th>
|
||||
<th>Humidity</th>
|
||||
<th>Battery</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for reading in local_readings %}
|
||||
<tr>
|
||||
<td>{{ reading.timestamp }}</td>
|
||||
<td>{{ "%.1f"|format(reading.temperature) if reading.temperature is not none else "n/a" }}°C</td>
|
||||
<td>{{ reading.humidity if reading.humidity is not none else "n/a" }}%</td>
|
||||
<td>{{ reading.battery if reading.battery is not none else "n/a" }}%</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="4" class="empty">No readings found for this day.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user