Compare commits

..

1 Commits

Author SHA1 Message Date
Arnaud Nelissen
7782725c5a Added "label" to device model 2025-10-08 18:20:47 +02:00

View File

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