Skip to content

Commit 7f824a5

Browse files
committed
fixed a bug in timer sync; added missing rooms to device site page;
1 parent b57475d commit 7f824a5

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

www/device-site.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,19 @@ <h3>Device Local Site</h3>
7878
{ "value": "kitchen", "name": "Kitchen" },
7979
{ "value": "bedroom", "name": "Bedroom" },
8080
{ "value": "bath", "name": "Bath" },
81-
{ "value": "study", "name": "Study room" },
8281
{ "value": "office", "name": "Office" },
82+
{ "value": "study", "name": "Study room" },
8383
{ "value": "childsroom", "name": "Child's room" },
8484
{ "value": "garage", "name": "Garage" },
8585
{ "value": "basement", "name": "Basement" },
8686
{ "value": "garden", "name": "Garden" },
8787
{ "value": "sunroom", "name": "Winter garden" },
88-
{ "value": "shack", "name": "Shack" },
88+
{ "value": "terrace", "name": "Terrace" },
89+
{ "value": "balcony", "name": "Balcony" },
8990
{ "value": "hallway", "name": "Hallway" },
91+
{ "value": "entrance", "name": "Entrance" },
92+
{ "value": "shack", "name": "Shack" },
93+
{ "value": "attic", "name": "Attic" },
9094
{ "value": "other", "name": "Other" }
9195
],
9296
updates: [

www/scripts/sepiaFW.ui.events.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ function sepiaFW_build_events(){
293293
var SyncSchedulers = {};
294294

295295
var lastTimeEventsCheck = 0;
296+
var timeEventsCheckTimer;
296297

297298
//----------------- Broadcasting -------------------
298299

@@ -308,7 +309,10 @@ function sepiaFW_build_events(){
308309
}
309310
//prevent multiple consecutive calls in short intervall...
310311
var now = new Date().getTime();
311-
if (forceNew || (now - lastTimeEventsCheck) > 10*1000){ //interval: 10s
312+
var timePassedSinceLastCheck = (now - lastTimeEventsCheck);
313+
var targetTime = 10*1000; //at least 10s
314+
if (forceNew || timePassedSinceLastCheck > targetTime){ //interval: 10s
315+
clearTimeout(timeEventsCheckTimer);
312316
lastTimeEventsCheck = now;
313317

314318
//reset ids tracking timeEvents - basically just reload all active background time events to 'timeEventNotificationIds'
@@ -342,8 +346,11 @@ function sepiaFW_build_events(){
342346
SepiaFW.client.sendCommand(dataset2, options);
343347
});
344348
}else{
345-
SepiaFW.debug.log("Events: skipped time events update because requests came too quickly!");
346-
//TODO: buffer calls and schedule update for later
349+
SepiaFW.debug.log("Events: Delayed time events update because requests came too quickly!");
350+
//buffer calls and schedule update for later
351+
timeEventsCheckTimer = setTimeout(function(){
352+
Events.setupTimeEvents();
353+
}, (targetTime - timePassedSinceLastCheck + 2000));
347354
}
348355
}
349356

0 commit comments

Comments
 (0)