diff --git a/sensors/collector/templates/collector/index.html b/sensors/collector/templates/collector/index.html
index 72b7fc7..ae2681c 100644
--- a/sensors/collector/templates/collector/index.html
+++ b/sensors/collector/templates/collector/index.html
@@ -8,7 +8,20 @@
-
{% block section_title %}Environment Sensors{% endblock %}
+
Temperature
{% autoescape off %}
{{ plot_temp }}
diff --git a/sensors/collector/tests/test_views.py b/sensors/collector/tests/test_views.py
index 6cb50df..85737fe 100644
--- a/sensors/collector/tests/test_views.py
+++ b/sensors/collector/tests/test_views.py
@@ -12,3 +12,8 @@ def test_index_temperature():
response = Client().get('/')
assert response.status_code == 200
+
+def test_history_view():
+ response = Client().get('/history/36')
+ assert response.status_code == 200
+
diff --git a/sensors/collector/urls.py b/sensors/collector/urls.py
index f3dac1b..f8bc05b 100644
--- a/sensors/collector/urls.py
+++ b/sensors/collector/urls.py
@@ -5,4 +5,5 @@ from . import views
urlpatterns = [
path('', views.index_view, name='index'),
+ path('history/', views.history_view, name='history'),
]
diff --git a/sensors/collector/views.py b/sensors/collector/views.py
index b25422a..489fe0c 100644
--- a/sensors/collector/views.py
+++ b/sensors/collector/views.py
@@ -11,3 +11,14 @@ def index_view(request):
context={'plot_temp': plot_temp,
'plot_humidity': plot_humidity,
'plot_pressure': plot_pressure})
+
+
+def history_view(request, hours):
+ start_time = datetime.now() - timedelta(hours=hours)
+ plot_temp = plot.temperature(start_time)
+ plot_humidity = plot.humidity(start_time)
+ plot_pressure = plot.pressure(start_time)
+ return render(request, "collector/index.html",
+ context={'plot_temp': plot_temp,
+ 'plot_humidity': plot_humidity,
+ 'plot_pressure': plot_pressure})