HomeyAPI.createLocalAPI and meyAPI.createAppAPI inconsistency

Hello,

Following conversation in thread: Zone and zoneName of device from driver context

I want my Homey PRO app to be able to modify the name and zone of a device.
To do so, I’m doing:

            this.homeyApi = await HomeyAPI.createLocalAPI({
                address: "http://127.0.0.1",
                token: "<my secret token>"
            });

            let realDevice = this.getDevices().find(device => device.getData().id === virtualDeviceId);
            
            if (data.name !== realDevice.getName() || data.zoneId !== realDevice.getZone()) {
                await this.homeyApi.devices.updateDevice({
                    id: realDevice.getId(),
                    device: {
                        name: data.name,
                        zone: data.zoneId
                    }
                });
            }

When using the createAppApi instead of createLocalAPI:

            this.homeyApi = await HomeyAPI.createAppAPI({
                homey: this.homey
            });

I get the error:

2023-10-01T08:08:17.557Z [err] [ManagerDrivers] [Driver:esphome-wizard] [HomeyAPIError: Vous n'avez pas la possibilité de faire ceci.] {
  statusCode: 403,
  description: "Vous n'avez pas la possibilité de faire ceci."
}

Even I found a way to make it works, the token requirement is very annoying, it’s not like I want an external application to acces the web api, the code is running insde the homey PRO app…

Any idea?

Probably better to ask on Slack or to post a Github issue.

Better calm down a little before I go through Athom BV …

My app is now working as I expect, but I’m switching between SDK, localAPI and AppAPI for different functionnalities, thanks to Athom BV developpers consistancy …
=> The worst here is about memory … and maybe memory leak :slight_smile:

AppAPI usage require the user to input his token through the pair session interface, but it only concerns:

  • deletion of a device
  • modification of the name or zone of a device

(yes, the interface of the pair session is more like a manager :slight_smile: )

Which are easily accessible through the standard user interface of Homey, so it’s ok I suppose.

Anyway, maybe I just do it all wrong, I don’t know …