Create a custom button

Hello fellows. Could anyone help to create a custom button ?

Maybe some of you guys had the similar idea…
Here is the plan:

  1. I need change Parameter InternetGatewayDevice.WIFI.NeighboringWiFiDiagnostic.DiagnosticsState to Request
  2. Pull every WLAN !

autoprovisioning is working and i get …

PROVISION A


function hasTag(name) {
    const result = declare(`Tags.${name}`, {value: 1});
    return result.value !== undefined;
}

//declare("Tags.EVEnT", null, {value: true});

let serial_number=declare("DeviceID.SerialNumber",{value:1}).value[0];
let speed_test=declare("InternetGatewayDevice.DownloadDiagnostics.DiagnosticsState",{value:1}).value[0];

if (hasTag('SNR-CPE')) {
  let wlan_diagnose=declare("InternetGatewayDevice.WIFI.NeighboringWiFiDiagnostic.DiagnosticsState",{value:1}).value[0];
  if (wlan_diagnose == "Requested"|"Complete"){
  declare('InternetGatewayDevice.WiFi.NeighboringWiFiDiagnostic.Result')
  log('Wifi Diagnostic ...' + serial_number);
  declare("Tags.WLAN_Diag", null, {value: true});
}
  1. After I need to create also button to clear THAT. I can just add the Tag and Push Summon Button (to refresh some parameters)
    For that tag, provision script is starting to remove parameters for me.

PROVISION B


declare("Tags.DIAG_End", null, {value: false});
let now = Date.now();
declare("InternetGatewayDevice.WiFi.NeighboringWiFiDiagnostic.Result.*", null,{value: 0});
declare("InternetGatewayDevice.WiFi.NeighboringWiFiDiagnostic.Result",{path: now},{value: 1});
declare("InternetGatewayDevice.WIFI.NeighboringWiFiDiagnostic.ResultNumberOfEntries",{path: now},{value: 1});

Maybe i can just create a Button which could put Tag on device, and automatically Declare some parameters or Just Summon button.
P.S. Sometimes after 10x pushing the “Summon button” PROVISION B script is tired and dont give a …