Compare commits

..

1 Commits

Author SHA1 Message Date
Arnaud Nelissen
a1d7a7452a Added "label" to device model 2025-10-08 17:55:22 +02:00

View File

@@ -14,7 +14,7 @@ const deviceUsesPrograms = function(device) {
default: break;
}
if (device.programs != undefined && device.programs.programs != undefined && device.programs.programs.programs != undefined) { return true; }
if (device.programs != undefined) { return true; }
if (device.programs == undefined && device.slots == undefined) { return true; }
return false;
@@ -33,7 +33,7 @@ const deviceUsesSlots = function(device) {
default: break;
}
if (device.slots != undefined && device.slots.slots != undefined && device.slots.slots.slots != undefined) { return true; }
if (device.slots != undefined) { return true; }
if (device.programs == undefined && device.slots == undefined) { return true; }
return false;
@@ -70,22 +70,22 @@ const getRequestToDo = async function (msn) {
///// Programs
if (child.programmingTimestamp != undefined && deviceUsesPrograms(child)) {
timestamp = child.programmingTimestamp || -1
if ((device.programs == undefined) || (timestamp > device.programs.timestamp)) { todo.programs = 2 }
else if (timestamp < device.programs.timestamp) { todo.programs = 1 }
if ((device.programs == undefined) || (timestamp < device.programs.timestamp)) { todo.programs = 1 }
else if (timestamp > device.programs.timestamp) { todo.programs = 2 }
}
///// Configuration
if (child.configurationTimestamp != undefined) {
timestamp = child.configurationTimestamp || child.relayConfigurationTimestamp || -1
if ((device.configuration == undefined) || (timestamp > device.configuration.timestamp)) { todo.configuration = 2 }
else if (timestamp < device.configuration.timestamp) { todo.configuration = 1 }
if ((device.configuration == undefined) || (timestamp < device.configuration.timestamp)) { todo.configuration = 1 }
else if (timestamp > device.configuration.timestamp) { todo.configuration = 2 }
}
///// Slots
if (child.programmingTimestamp != undefined && deviceUsesSlots(child)) {
timestamp = child.programmingTimestamp || -1
if ((device.slots == undefined) || (timestamp > device.slots.timestamp)) { todo.slots = 2 }
else if (timestamp < device.slots.timestamp) { todo.slots = 1 }
if ((device.slots == undefined) || (timestamp < device.slots.timestamp)) { todo.slots = 1 }
else if (timestamp > device.slots.timestamp) { todo.slots = 2 }
}
///// Status