HomeyAPI.call in HomeyScript

The HomeyScript editor auto-completes HomeyAPI that has a call function, but running it I just get ⚠️ ReferenceError: HomeyAPI is not defined. Isn’t this supported?

HomeyAPI is a class which isn’t directly available (even though the editor suggests it is), but if you really need it, you can use Homey.constructor.call() (since Homey is an instance of HomeyAPI).

Thanks @robertklep ! I tried that just now, but I’m getting ⚠️ TypeError: Cannot call a class as a function for Homey.constructor.call({ method: 'GET', path: '/api/manager/system'}), so I guess that call operator is not whwat I’m looking for. Thanks anyways!

.call() is Function.prototype.call().

1 Like

Right… I was expecting it to be something else. Anyways, solved in Homey.devices.updateDevice in HomeyScript

Thanks for your help Robert!

1 Like