Commit 81cd16464440d47181924da096f76fb2d4e916a8
1 parent
ecca856b
Exists in
dev
weather_config prototype without database
- Parse PLC status in colibri-new-fixed-2.json - Return template with sensors list - http://127.0.0.1:8000/dashboard/weather/config
Showing
3 changed files
with
7 additions
and
7 deletions
Show diff stats
src/dashboard/views.py
... | ... | @@ -167,19 +167,19 @@ def weather_current(request): |
167 | 167 | raise Http404("No WeatherWatch matches the given query.") |
168 | 168 | |
169 | 169 | def weather_config(request): |
170 | - """ PM 20180926 prototype whithout database | |
170 | + """ PM 20180926 prototype without database | |
171 | 171 | http://127.0.0.1:8000/dashboard/weather/config |
172 | 172 | """ |
173 | 173 | try: |
174 | - #import os | |
174 | + # Import PLC status sensor parser | |
175 | 175 | from src.monitoring.plc_checker import PlcChecker |
176 | - #cur_dir = os.path.abspath(".") | |
176 | + # Parse PLC status in colibri-new-fixed-2.json | |
177 | 177 | colibri_json = open("../simulators/plc/colibri-new-fixed-2.json") |
178 | 178 | colibri_struct = json.load(colibri_json) |
179 | 179 | plc_status = colibri_struct["statuses"][1]["entities"][0] |
180 | 180 | plc_checker = PlcChecker(plc_status) |
181 | - plc_checker.scan_captors() | |
182 | - | |
181 | + plc_checker.scan_sensors() | |
182 | + # Return template with sensors list | |
183 | 183 | return render(request, 'dashboard/config_weather.html', {'weather_config' : plc_checker.captors_conf, 'base_template' : "base.html"}) |
184 | 184 | except Config.DoesNotExist: |
185 | 185 | return render(request, 'dashboard/config_weather.html', {'weather_info' : None}) | ... | ... |
src/monitoring/plc_checker.py
src/monitoring/try_plc_checker.py