The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
driver.js vs. device.js vs. app.json - when and where to put stuff?
working on an app to "Copenhagen Blinds": Venetian blinds, Z-Wave plus, battery driven, multi channel (one for up/down, one for tilt).
The device support device class 'windowcoverings' (includes capabilities "onoff'", "dim", "windowcoverings_state", "windowcoverings_tilt_up", "windowcoverings_tilt_down" and "windowcoverings_tilt_set) as well as it supports capabilites "measure_battery" and "alarm_battery".
I've been looking at a lot of other apps (incl. Fibaro, Neo, LogicHome, Remotec, Slide and Pellini Sceen Line) to get inspiration - and have tried to find advice in the SDK2-docs, including:
I've got the app "basics" working and have it loaded to Homey and can include the device - and get the battery level - so the connection is there. However, I cannot get it to act on anything - and am a bit confused about how much should be included in the app and where to put it: Some of the documents in https://developer.athom.com/docs/apps/ seems contradictory and authors have different styles - as well as some apps are rather complex with a lot of devices etc.
It might be all there in the documents and a matter of me not finding the correct
Is it necessary to also add registerReportListener for each capability as well?
Further, I find it a bit difficult to figure out how many places values on multiChannel should be defined?
Any advice is gladly taken - including examples in other apps that could be useful :-)
1) the app manifest in app.json in the root of your project
2) device driver (device.js) in /drivers/[driverID]/
Check the meshdriver, including the examples provided: https://github.com/athombv/node-homey-meshdriver/
And use a Z-wave app (SDK2) as reference..
Main challenge will be to link the specific device capabilities (for the blinds) to the Z-wave command classes, which is done in the device.js
The example from Athom (https://github.com/athombv/com.fibaro/tree/feature/sdk2/drivers/FGK-10x) shows a device.js file in the folder drivers, not a driver.js - the same goes for other SDK2-apps like LogicHome, Remotec and Neo - and looking at the example in the meshdriver (https://github.com/athombv/node-homey-meshdriver/blob/master/examples/fibaroplug.js) it seems to be similar to the device.js files...
The mentioned apps all use Homeyconfig - and looking in /config/drivers/ are only .json files - I now know these are all basically subsections of the app.json file - and therefore not what should be in the driver.js file...
But if I get it right, basics should be to stick to using driver.js and app.json until I know better :-)