Missing_scopes when using Homey.zigBee.runCommand

I want to have a HomeyScript running every x minutes, that will check if all Router devices in my zigbee mesh are still online. Some smart bulbs still have a standard wallswitch in place that just cuts the power. Until they’re all replaced by smart switches, my better half sometimes forgets not to use them… and gone is my Router…:smiley:

So i created this HomeyScript that will send me a push notification when a router device is no longer online. However, this only works after i manually refresh the ZigBee network from the developer/zigbee tools page. That way, the status changes to online = false in the Homey.zigBee.getState() result.

So, to refresh the network from script, i tried using:
await Homey.zigBee.runCommand({command: 'UPDATE_NODES', opts: undefined})

But that throws me a missing_scopes error, telling me not enough permissions to do this…

Any ideas on how to make this work? Can i elevate permissions or is there another way to refresh the zigbee mesh state?

With the current permissions HomeyScript has this will never work, and I think Athom won’t add any additional either, you can always try to ask them of course, but I only give it a very very small chance to it happening.

Maybe this is of any use

Hej @Peter_Kawa , thanks for your suggestion.
Although this is very interesting for checking on my sensors, checking the Homey.devices however wont work for this situation, because a zigbee Router device (not a motion sensor, but e.g. a lightbulb) can easily be unused for several hours, so i cannot determine it is offline just by looking at the last reporting datetime. I want to know when the router has been removed from my zigbee mesh network by accidental power cut (from using wallswitch).

The AVD however seems very powerfull. Any idea if i can run HomeyScript with elevated permissions from there maybe?

YW!
Yeah the script is aimed at sensors which ‘at random’ stop sending changes.
I think HomeyScript has the same permissions on Homey, where-ever you use it.

The web-api playground however, seems to have more permissions. But that is only useful for manually running some code.

Here’s a ‘bad route’ detection script which might be of any use:

A year has passed, trying to give this a go again.
Since the HomeyScript doesn’t have enough permissions, my goal is now to build a Homey App.

But the ManagerZigbee isn’t exposing a runCommand method.
Anyone knows, how to turn this HomeyScript:

await Homey.zigBee.runCommand({command: 'UPDATE_NODES', opts: undefined});

into something like this for a homey app?

import Homey from 'homey';

class MyApp extends Homey.App {

  async onInit() {
    await this.homey.zigbee.runCommand({command: 'UPDATE_NODES', opts: undefined});
  }

}

module.exports = MyApp;

Compiler now says NO:
error TS2339: Property 'runCommand' does not exist on type 'ManagerZigBee'.

All i want to do is refresh by Zigbee mesh automatically every 24hours…shouldn’t be that hard

Won’t do you much good, the app still won’t have the correct scopes:

CreateClientError: Missing Scopes HomeyAPIError: Missing Scopes