Commit b7e69421 authored by nextime's avatar nextime

Add forced autodetection to REST and admin gui

parent 057d86b3
...@@ -78,7 +78,8 @@ ...@@ -78,7 +78,8 @@
deleted or invalidated. deleted or invalidated.
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Discard</button> <button type="button" class="btn btn-default pull-left" data-dismiss="modal" >Discard</button>
<input type="checkbox" id="forcedetect">Force detection </input>
<button type="button" class="btn btn-danger" data-dismiss="modal" id="startdetection">Start Autodetection</button> <button type="button" class="btn btn-danger" data-dismiss="modal" id="startdetection">Start Autodetection</button>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
...@@ -214,7 +215,10 @@ ...@@ -214,7 +215,10 @@
<script type="text/javascript"> <script type="text/javascript">
$("#startdetection").click( $("#startdetection").click(
function() { function() {
$.get("/rest/v1.2/boards/autodetect/json"); if($('#forcedetect').is(":checked"))
$.get("/rest/v1.2/boards/forceautodetect/json");
else
$.get("/rest/v1.2/boards/autodetect/json");
} }
); );
</script> </script>
......
a:2:{s:9:"timestamp";i:1383439313;s:12:"translations";a:17:{s:4:"home";s:4:"home";s:5:"blind";s:10:"tapparelle";s:8:"cancello";s:8:"cancelli";s:5:"clima";s:5:"clima";s:4:"door";s:5:"porte";s:3:"led";s:3:"led";s:5:"light";s:4:"luci";s:7:"scenari";s:7:"scenari";s:6:"socket";s:5:"prese";s:6:"valvle";s:7:"valvole";s:6:"sensor";s:7:"sensori";s:6:"camera";s:10:"telecamere";s:6:"window";s:8:"finestre";s:4:"user";s:4:"user";s:4:"none";s:15:"Nessuna Sezione";s:5:"phone";s:8:"telefono";s:5:"index";s:4:"Home";}} a:2:{s:9:"timestamp";i:1388713246;s:12:"translations";a:17:{s:4:"home";s:4:"home";s:5:"blind";s:10:"tapparelle";s:8:"cancello";s:8:"cancelli";s:5:"clima";s:5:"clima";s:4:"door";s:5:"porte";s:3:"led";s:3:"led";s:5:"light";s:4:"luci";s:7:"scenari";s:7:"scenari";s:6:"socket";s:5:"prese";s:6:"valvle";s:7:"valvole";s:6:"sensor";s:7:"sensori";s:6:"camera";s:10:"telecamere";s:6:"window";s:8:"finestre";s:4:"user";s:4:"user";s:4:"none";s:15:"Nessuna Sezione";s:5:"phone";s:8:"telefono";s:5:"index";s:4:"Home";}}
\ No newline at end of file \ No newline at end of file
a:2:{s:9:"timestamp";i:1383439313;s:12:"translations";a:9:{s:16:"websection.blind";s:38:"/domotika/mobile/images/tapparelle.jpg";s:19:"websection.cancello";s:36:"/domotika/mobile/images/cancelli.jpg";s:16:"websection.clima";s:33:"/domotika/mobile/images/clima.jpg";s:15:"websection.door";s:33:"/domotika/mobile/images/porte.jpg";s:14:"websection.led";s:31:"/domotika/mobile/images/led.jpg";s:16:"websection.light";s:32:"/domotika/mobile/images/luci.jpg";s:18:"websection.scenari";s:35:"/domotika/mobile/images/scenari.jpg";s:17:"websection.socket";s:33:"/domotika/mobile/images/prese.jpg";s:17:"websection.valvle";s:35:"/domotika/mobile/images/valvole.jpg";}} a:2:{s:9:"timestamp";i:1388713246;s:12:"translations";a:9:{s:16:"websection.blind";s:38:"/domotika/mobile/images/tapparelle.jpg";s:19:"websection.cancello";s:36:"/domotika/mobile/images/cancelli.jpg";s:16:"websection.clima";s:33:"/domotika/mobile/images/clima.jpg";s:15:"websection.door";s:33:"/domotika/mobile/images/porte.jpg";s:14:"websection.led";s:31:"/domotika/mobile/images/led.jpg";s:16:"websection.light";s:32:"/domotika/mobile/images/luci.jpg";s:18:"websection.scenari";s:35:"/domotika/mobile/images/scenari.jpg";s:17:"websection.socket";s:33:"/domotika/mobile/images/prese.jpg";s:17:"websection.valvle";s:35:"/domotika/mobile/images/valvole.jpg";}}
\ No newline at end of file \ No newline at end of file
...@@ -2186,7 +2186,9 @@ class domotikaService(service.Service): ...@@ -2186,7 +2186,9 @@ class domotikaService(service.Service):
def web_on_getDaemonStatus(self): def web_on_getDaemonStatus(self):
return self.daemonstatus return self.daemonstatus
def web_on_startAutoDetection(self): def web_on_startAutoDetection(self, force=False):
if force:
self.resetBoards()
self.autoDetectBoards() self.autoDetectBoards()
return self.daemonstatus return self.daemonstatus
......
...@@ -306,6 +306,12 @@ class BoardRest(RestCore): ...@@ -306,6 +306,12 @@ class BoardRest(RestCore):
self.core.startAutoDetection() self.core.startAutoDetection()
ResponseConversion(request, entity='OK') ResponseConversion(request, entity='OK')
@route("/forceautodetect")
@wrapResponse
def boardForceAutodetect(self, request, *a, **kw):
self.core.startAutoDetection(True)
ResponseConversion(request, entity='OK')
class CronRest(RestCore): class CronRest(RestCore):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment