Home Information - Your home, your data, organized.
Python
Bugfix/151 min max temp (#156)
Tony C64b91fb79d6e
diff --git a/src/hi/apps/console/templates/console/panes/hi_grid_side.html b/src/hi/apps/console/templates/console/panes/hi_grid_side.htmlindex 77b79cfd..833cd185 100644--- a/src/hi/apps/console/templates/console/panes/hi_grid_side.html+++ b/src/hi/apps/console/templates/console/panes/hi_grid_side.html@@ -11,8 +11,8 @@{% include "weather/panes/weather_alerts.html" %}{% include "weather/panes/weather_overview.html" %}-- <div class="d-flex justify-content-center my-2">++ <div class="d-flex justify-content-center border-top my-2 pt-2">{% if camera_control_display_list %}<div class="col-6">{% include "console/panes/camera_controls.html" %}@@ -24,7 +24,7 @@</div><div class="my-2"><a href="{% url 'event_history' %}"- class="btn btn-primary btn-control" role="button"+ class="btn btn-outline-secondary btn-control" role="button"data-async="true" >TRIGGER HISTORY</a>diff --git a/src/hi/apps/weather/daily_weather_tracker.py b/src/hi/apps/weather/daily_weather_tracker.pyindex c32f8861..a3ad8ac5 100644--- a/src/hi/apps/weather/daily_weather_tracker.py+++ b/src/hi/apps/weather/daily_weather_tracker.py@@ -83,7 +83,7 @@ class DailyWeatherTracker:and weather_conditions_data.temperature.quantity_ave is not None ):temp_celsius = weather_conditions_data.temperature.quantity_ave.to('degree_Celsius').magnitudetemp_timestamp = weather_conditions_data.temperature.source_datetime or datetimeproxy.now()-+self._record_field_value(location_key=location_key,field_name='temperature',diff --git a/src/hi/apps/weather/templates/weather/modals/conditions_details.html b/src/hi/apps/weather/templates/weather/modals/conditions_details.htmlindex 21ee2aab..a3bb9158 100644--- a/src/hi/apps/weather/templates/weather/modals/conditions_details.html+++ b/src/hi/apps/weather/templates/weather/modals/conditions_details.html@@ -16,10 +16,13 @@ Current Conditions{% with weather_conditions_data.stations as station_list %}{% if station_list %}-<div class="h5">Weather Sources</div>+<div class="h5">Sources</div>{% for station in station_list %}<div>- {{ station.source.label }} <small>{{ station.name }} ({{ station.station_id }})</small>+{{ station.source.label }}+ <ul>+ <small>{{ station.name }} ({{ station.station_id }})</small>+ </ul></div>{% endfor %}{% endif %}diff --git a/src/hi/apps/weather/templates/weather/modals/radar.html b/src/hi/apps/weather/templates/weather/modals/radar.htmldeleted file mode 100644index 1fba40e6..00000000--- a/src/hi/apps/weather/templates/weather/modals/radar.html+++ /dev/null@@ -1,9 +0,0 @@-{% extends "modals/action_ok.html" %}--{% block title_text %}-Weather Radar-{% endblock %}--{% block body %}-<div class="alert alert-info">Weather radar not yet available.</div>-{% endblock %}diff --git a/src/hi/apps/weather/templates/weather/panes/conditions.html b/src/hi/apps/weather/templates/weather/panes/conditions.htmlindex 01da5709..83c53d85 100644--- a/src/hi/apps/weather/templates/weather/panes/conditions.html+++ b/src/hi/apps/weather/templates/weather/panes/conditions.html@@ -44,7 +44,7 @@<div>Min:{% if conditions.temperature_min_today is not None %}- {{ conditions.temperature_min_today.quantity|format_magnitude:1 }}+ {{ conditions.temperature_min_today.quantity|format_magnitude:0 }}<small>{{ conditions.temperature_min_today.quantity|format_units }}</small>{% else %}-- °@@ -53,25 +53,13 @@<div class="pl-1">Max:{% if conditions.temperature_max_today is not None %}- {{ conditions.temperature_max_today.quantity|format_magnitude:1 }}+ {{ conditions.temperature_max_today.quantity|format_magnitude:0 }}<small>{{ conditions.temperature_max_today.quantity|format_units }}</small>{% else %}-- °{% endif %}</div></div>- <div>- Wind:- {% if conditions.windspeed %}- {{ conditions.windspeed.quantity|format_magnitude:1 }}- <small>{{ conditions.windspeed.quantity|format_units }}</small>- {% else %}- --- {% endif %}- {% if conditions.wind_direction %}- {{ conditions.wind_direction.quantity|format_compass }}- {% endif %}- </div><div>Humidity:{% if conditions.relative_humidity %}@@ -84,7 +72,9 @@</div>+{% if conditions.temperature.source %}<div class="text-muted">- <small><em>{{ conditions.temperature.source_datetime |localtime }}, {{ conditions.temperature.source.abbreviation }} </em></small>+ <small><em>At {{ conditions.temperature.source_datetime |localtime|date:"g:i A" }} from {{ conditions.temperature.source.abbreviation }} </em></small></div>+{% endif %}{% endtimezone%}diff --git a/src/hi/apps/weather/templates/weather/panes/weather_alerts.html b/src/hi/apps/weather/templates/weather/panes/weather_alerts.htmlindex d3d8856d..f2ea19df 100644--- a/src/hi/apps/weather/templates/weather/panes/weather_alerts.html+++ b/src/hi/apps/weather/templates/weather/panes/weather_alerts.html@@ -26,7 +26,7 @@</div>{% endfor %}{% else %}- <div class="text-center">+ <div class="text-center border-bottom"><div class="">{% now "l, F jS" %}</div>@@ -34,7 +34,6 @@{% now "g:i a" %}</div></div>- <hr />{% endif %}</div>{% endtimezone %}diff --git a/src/hi/apps/weather/templates/weather/panes/weather_overview.html b/src/hi/apps/weather/templates/weather/panes/weather_overview.htmlindex cd12b6e6..968fe839 100644--- a/src/hi/apps/weather/templates/weather/panes/weather_overview.html+++ b/src/hi/apps/weather/templates/weather/panes/weather_overview.html@@ -2,17 +2,15 @@<a class="clickable-card" href="{% url 'weather_current_conditions_details' %}" data-async="modal">{% include "weather/panes/conditions.html" with conditions=weather_overview_data.current_conditions_data %}</a>- <div class="border-top">+ <div class=""><a class="clickable-card" href="{% url 'weather_todays_astronomical_details' %}" data-async="modal">{% include "weather/panes/astronomical_brief.html" with astronomical_data=weather_overview_data.todays_astronomical_data %}</a></div><div class="d-flex justify-content-around my-2"><div><a role="button" href="{% url 'weather_forecast' %}"- class="btn btn-sm btn-primary" data-async="modal">FORECAST</a></div>- <div><a role="button" href="{% url 'weather_radar' %}"- class="btn btn-sm btn-primary" data-async="modal">RADAR</a></div>+ class="btn btn-sm btn-outline-primary" data-async="modal">FORECAST</a></div><div><a role="button" href="{% url 'weather_history' %}"- class="btn btn-sm btn-primary" data-async="modal">HISTORY</a></div>+ class="btn btn-sm btn-outline-primary" data-async="modal">HISTORY</a></div></div></div>diff --git a/src/hi/apps/weather/templates/weather/tests/ui/home.html b/src/hi/apps/weather/templates/weather/tests/ui/home.htmlindex 5d252c15..6c3dd399 100644--- a/src/hi/apps/weather/templates/weather/tests/ui/home.html+++ b/src/hi/apps/weather/templates/weather/tests/ui/home.html@@ -28,9 +28,6 @@<li><a href="{% url 'weather_tests_ui_forecast' %}"data-async="modal">Weather Forecast</a></li>- <li><a href="{% url 'weather_tests_ui_radar' %}"- data-async="modal">Weather Radar- </a></li><li><a href="{% url 'weather_tests_ui_history' %}"data-async="modal">Weather History</a></li>diff --git a/src/hi/apps/weather/tests/test_views.py b/src/hi/apps/weather/tests/test_views.pyindex 8f1abfb3..cc8ef241 100644--- a/src/hi/apps/weather/tests/test_views.py+++ b/src/hi/apps/weather/tests/test_views.py@@ -211,49 +211,6 @@ class TestForecastView(DualModeViewTestCase):self.assertEqual(response.status_code, 405)-class TestRadarView(DualModeViewTestCase):- """- Tests for RadarView - demonstrates simple modal view testing.- This view displays weather radar information.- """-- def test_get_radar_sync(self):- """Test getting weather radar with synchronous request."""- url = reverse('weather_radar')- response = self.client.get(url)-- self.assertSuccessResponse(response)- self.assertHtmlResponse(response)- self.assertTemplateRendered(response, 'weather/modals/radar.html')-- def test_get_radar_async(self):- """Test getting weather radar with AJAX request."""- url = reverse('weather_radar')- response = self.async_get(url)-- self.assertSuccessResponse(response)- self.assertJsonResponse(response)-- # HiModalView returns JSON with modal content for AJAX requests- data = response.json()- self.assertIn('modal', data)-- def test_radar_context_empty(self):- """Test that radar view has empty context."""- url = reverse('weather_radar')- response = self.client.get(url)-- self.assertSuccessResponse(response)- # Radar view has minimal context - just checks that it renders correctly-- def test_post_not_allowed(self):- """Test that POST requests are not allowed."""- url = reverse('weather_radar')- response = self.client.post(url)-- self.assertEqual(response.status_code, 405)--class TestHistoryView(DualModeViewTestCase):"""Tests for HistoryView - demonstrates weather history testing.diff --git a/src/hi/apps/weather/tests/ui/urls.py b/src/hi/apps/weather/tests/ui/urls.pyindex bf20c1f1..38976983 100644--- a/src/hi/apps/weather/tests/ui/urls.py+++ b/src/hi/apps/weather/tests/ui/urls.py@@ -21,10 +21,6 @@ urlpatterns = [views.TestUiForecastView.as_view(),name='weather_tests_ui_forecast'),- re_path( r'^radar$',- views.TestUiRadarView.as_view(),- name='weather_tests_ui_radar'),-re_path( r'^history$',views.TestUiHistoryView.as_view(),name='weather_tests_ui_history'),diff --git a/src/hi/apps/weather/tests/ui/views.py b/src/hi/apps/weather/tests/ui/views.pyindex 709cc705..2fe58101 100644--- a/src/hi/apps/weather/tests/ui/views.py+++ b/src/hi/apps/weather/tests/ui/views.py@@ -44,14 +44,6 @@ class TestUiForecastView( View ):return render(request, "weather/modals/forecast.html", context )-class TestUiRadarView( View ):-- def get(self, request, *args, **kwargs):- context = {- }- return render(request, "weather/modals/radar.html", context )--class TestUiHistoryView( View ):def get(self, request, *args, **kwargs):diff --git a/src/hi/apps/weather/urls.py b/src/hi/apps/weather/urls.pyindex 43059485..03b8c1c1 100644--- a/src/hi/apps/weather/urls.py+++ b/src/hi/apps/weather/urls.py@@ -17,10 +17,6 @@ urlpatterns = [views.ForecastView.as_view(),name='weather_forecast'),- re_path( r'^radar$',- views.RadarView.as_view(),- name='weather_radar'),-re_path( r'^history$',views.HistoryView.as_view(),name='weather_history'),diff --git a/src/hi/apps/weather/views.py b/src/hi/apps/weather/views.pyindex 572b09de..9ca0cbc4 100644--- a/src/hi/apps/weather/views.py+++ b/src/hi/apps/weather/views.py@@ -65,17 +65,6 @@ class ForecastView( HiModalView, WeatherMixin ):return self.modal_response( request, context )-class RadarView( HiModalView, WeatherMixin ):-- def get_template_name( self ) -> str:- return 'weather/modals/radar.html'-- def get(self, request, *args, **kwargs):- context = {- }- return self.modal_response( request, context )--class HistoryView( HiModalView, WeatherMixin ):def get_template_name( self ) -> str:diff --git a/src/hi/apps/weather/weather_manager.py b/src/hi/apps/weather/weather_manager.pyindex a5205cbd..2d04bca1 100644--- a/src/hi/apps/weather/weather_manager.py+++ b/src/hi/apps/weather/weather_manager.py@@ -131,8 +131,8 @@ class WeatherManager( Singleton, SettingsMixin, AlertMixin ):def get_weather_overview_data(self) -> WeatherOverviewData:return WeatherOverviewData(- current_conditions_data = self._current_conditions_data,- todays_astronomical_data = self._todays_astronomical_data,+ current_conditions_data = self.get_current_conditions_data(),+ todays_astronomical_data = self.get_daily_astronomical_data,)def get_hourly_forecast(self) -> HourlyForecast:diff --git a/src/hi/settings/development.py b/src/hi/settings/development.pyindex a8bf6066..005c85ce 100644--- a/src/hi/settings/development.py+++ b/src/hi/settings/development.py@@ -80,39 +80,39 @@ LOGGING = {'level': 'INFO','propagate': False,},- 'hi.apps.notify': {+ 'hi.services.hass': {'handlers': ['console' ],'level': 'INFO','propagate': False,},- 'hi.apps.monitor': {+ 'hi.integrations': {'handlers': ['console' ],'level': 'INFO','propagate': False,},- 'hi.apps.sense': {+ 'hi.apps.monitor': {'handlers': ['console' ],'level': 'INFO','propagate': False,},- 'hi.apps.security': {+ 'hi.apps.notify': {'handlers': ['console' ],'level': 'INFO','propagate': False,},- 'hi.apps.weather': {+ 'hi.apps.security': {'handlers': ['console' ],'level': 'INFO','propagate': False,},- 'hi.integrations': {+ 'hi.apps.sense': {'handlers': ['console' ],'level': 'INFO','propagate': False,},- 'hi.services.hass': {+ 'hi.apps.weather': {'handlers': ['console' ],- 'level': 'INFO',+ 'level': 'DEBUG','propagate': False,},'hi.services.zoneminder': {