mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 18:34:25 +01:00
display: Add request_status timer
This will cyclically reset the status to Open/Close, independent of incoming messages Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
parent
a6e117ffd9
commit
56ac823852
@ -220,6 +220,7 @@ class AuthenticationForm(FlaskForm):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@socketio.on('request_status')
|
||||||
@socketio.on('connect')
|
@socketio.on('connect')
|
||||||
def on_connect():
|
def on_connect():
|
||||||
logic.emit_status()
|
logic.emit_status()
|
||||||
|
@ -5,7 +5,12 @@
|
|||||||
<script type="text/javascript" src="static/socket.io.slim.js"></script>
|
<script type="text/javascript" src="static/socket.io.slim.js"></script>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<script type="text/javascript" charset="utf-8">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
function request_status() {
|
||||||
|
socket.emit('request_status');
|
||||||
|
}
|
||||||
|
|
||||||
var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port);
|
var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port);
|
||||||
|
var timer = setInterval(request_status, 120000);
|
||||||
|
|
||||||
socket.on('connect', function() {
|
socket.on('connect', function() {
|
||||||
socket.emit('connected');
|
socket.emit('connected');
|
||||||
@ -13,6 +18,8 @@
|
|||||||
socket.on('status', function(status) {
|
socket.on('status', function(status) {
|
||||||
$('#led').attr('src', status.led);
|
$('#led').attr('src', status.led);
|
||||||
$('#message').html(status.message);
|
$('#message').html(status.message);
|
||||||
|
clearInterval(timer);
|
||||||
|
timer = setInterval(request_status, 120000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user