I’m trying to programmatically control the pairing flow if the app has already a setting. But it doesn’t work. Seems that showView
and nextView
are not implemented once the Typescript definitions are not in place and I must ignore them:
async onPair(session: PairSession) {
const pat = this.homey.settings.get("personalAccessToken");
if (await this.validateSTToken(pat)) {
this.log("Validated");
// @ts-ignore
await session.showView("list_devices");
this.log("Page should change");
// @ts-ignore
await session.nextView();
this.log("Nothing after the validate works");
}
session.setHandler("login_credentials", async (data) => {
const valid = await this.validateSTToken(data.password);
if (valid) this.homey.settings.set("personalAccessToken", data.password);
return valid;
});
session.setHandler("list_devices", async () => {
const myDevices = await this.client().devices.list({
capability: this.capability,
});
const devices = myDevices?.map((device) => {
const capabilities = getHomeyCapabilitiesForDevice(device);
return {
name: device.label ?? device.name,
data: { id: device.deviceId },
capabilities,
};
});
return devices;
});
}
I’m using Homey Pro v8.0.2 and the homey-apps-sdk-v3-types library at 0.3.1