I’m making my first steps in Homey device development and followed the Getting started tutorial. All was going fine until I used the device.js code snippet for onDiscoveryAvailable on the Discovery page (Discovery - Homey Apps SDK):
async onDiscoveryAvailable(discoveryResult) {
// This method will be executed once when the device has been found (onDiscoveryResult returned true)
this.api = new MyDeviceAPI(discoveryResult.address);
await this.api.connect(); // When this throws, the device will become unavailable.
}
During execution, I get a reference error on the line instantiating a new MyDeviceAPI object. Where should this MyDeviceAPI class be defined and implemented? I can’t find it in the code generated by “homey app create”.
Best regards,
Patrick.