Driver without driver.js

I’m looking at making some changes to a homey app, and notice that some of the driver directories do not have a driver.js.

Is this a pattern from an older Homey SDK? Or is it still supported?

The drivers in question seem to have a custom pairing HTML template as well, that ends up calling Homey.addDevice().

I’m not 100% sure but I don’t think that ZWave or ZigBee devices have a driver.js as it use the built in driver for that type of device. I guess it is also possible to not have one if the standard driver does everything that is required.

This is a custom app, not using ZWave or ZigBee. It looks like the implementation relies on the custom pairing template, and since it doesn’t need any custom logic in a Driver subclass, it doesn’t add driver.js, and homey-compose doesn’t complain about that. I assume a Driver instance is created still at runtime, but using the base class.

Correct. Even if you include a driver.js it has to extend the base Driver class, so if it’s not there just the base class is used.

Normally the driver.js is required for paring as the method of fetching the devices has to be defined somewhere. With ZWave and ZigBee that is a standard built into the base driver, hence not being needed for those So I’m intrigued how a custom app provides the list of devices to the add device procedure.

If the pairing process uses just a custom pairing template that handles everything (and not any of the built-in templates that work with a list of devices), I don’t think it has to. I assume this app provides “virtual” devices (in the sense that they aren’t coupled to actual hardware).

1 Like

I assume this app provides “virtual” devices (in the sense that they aren’t coupled to actual hardware).

Yepp, it’s a Tuya app, so the devices do not use any of the Homey built in HW (except for the Wifi/network of course) :slight_smile:

Which means they are coupled to actual hardware, so how does the pairing template know which device(s) to pair? :thinking:

The user configures the IP, device ID, and device key, in a simple form :slight_smile: Then the pairing template calls Homey.addDevice.

1 Like

Ah right, that makes sense :+1:t2: