Improve soundbox ops dashboard and registry editing
This commit is contained in:
@ -262,6 +262,25 @@ async function triggerRebootCommand({ bundle }) {
|
||||
return result;
|
||||
}
|
||||
|
||||
async function triggerPoweroffCommand({ bundle }) {
|
||||
const result = await reqAdmin(`/admin/devices/${bundle.device.id}/commands`, {
|
||||
method: "POST",
|
||||
body: {
|
||||
command: "device.poweroff",
|
||||
payload: {
|
||||
requested_from: "qf100_smoke"
|
||||
}
|
||||
},
|
||||
_label: "POST /admin/devices/:id/commands poweroff"
|
||||
});
|
||||
|
||||
assert(result.status === "delivered", "poweroff command must be delivered");
|
||||
assert(result.result_payload?.topic === `soundbox/${bundle.device.serial_number}/down`, "poweroff topic must use serial number");
|
||||
assert(result.result_payload?.payload?.header?.category === 5, "poweroff category must be 5");
|
||||
assert(result.result_payload?.payload?.data?.command === "poweroff", "poweroff command payload must be poweroff");
|
||||
return result;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await req("/health", { _label: "GET /health" });
|
||||
const ts = Date.now();
|
||||
@ -294,6 +313,7 @@ async function main() {
|
||||
const dynamicQr = await triggerDynamicMqttQr({ bundle: dynamicBundle, ts });
|
||||
const dynamicQrDisplay = await triggerDynamicQrDisplay({ bundle: dynamicBundle });
|
||||
const rebootCommand = await triggerRebootCommand({ bundle: staticBundle });
|
||||
const poweroffCommand = await triggerPoweroffCommand({ bundle: staticBundle });
|
||||
|
||||
console.log("\nQF100 adapter smoke passed");
|
||||
console.log(`static_sn=${STATIC_SN}`);
|
||||
@ -304,6 +324,7 @@ async function main() {
|
||||
console.log(`dynamic_transaction_id=${dynamicQr.transaction_id}`);
|
||||
console.log(`dynamic_qr_display_command=${dynamicQrDisplay.id || dynamicQrDisplay.command_id}`);
|
||||
console.log(`reboot_command=${rebootCommand.id || rebootCommand.command_id}`);
|
||||
console.log(`poweroff_command=${poweroffCommand.id || poweroffCommand.command_id}`);
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user