Discovery and pairing of variation of different devices

Hi All,

I’m encountering some challenge with adding devices.

Problem:
I have one modbus TCP device with one modbus ID, this is the ‘network master’ .
The Master holds info regarding it’s own ‘local network’ which has several (ventilation) devices.
The devices can be a valve, or a room sensor, or whatever. So every device could need a different device.js.

There are some constants:

  • The devices pages are always 10 modbus addresses
  • The ’ device type’ address is always the FIRST address (10, 20, 30, 40…)
  • The master is always on address 10.

So, I was thinking of a discovery on [IP]:[port] with DEVICE_ID :

  • First read address 10, which should retrun the master
  • then read all x0 addresses (20, 30, 40, 50, 60…) and add these as ‘device’ in a device list for pairing.

My questions are:
How to approach this, how to link the devices to the right device-files, which pairing html should I use/edit, etc.

Could someone point me in the right direction?

Best regards,

If your devices have different capabilities and functionality, then I would create different drivers.
Only different device.js doesn’t work. You need different drivers.

So one driver for the master device
Another driver for your ventilation devices.

Use the standard list_devices pair template.
Return the matching devices to show up in pair view (using the callback function).

In pair view, you select the driver (device type) and get a lift of devices of this type.

hi @RonnyW ,

thank you for your reply.
I understand that every device needs its matching driver.

I was in the understanding that the pairing procedure was automatic for a specific driver.
You say that I would be able to return a device_list containing different types of devices? I thought I could only return a device_id, not a device type (the required driver)?

Is there an app that uses this type of pairing?

Could another approach be using the “addCapability” method on pairing, depending on the devices found?

Best regards,

You can create your generic driver for all devices.
Dependent on your devices you can create your device array in list_devices event. There you can set a capability list for every device.
In device.js you can implement capabiity listener for capabilities (or a multi capability listener). Tjis way you can implement capability specific logic.

Hi @RonnyW ,

thank you for your reply.

searching for an example a found this page, which looks helpful.

tutorial drivers pairing
It’s for Dsk2 but I presume Dsk3 works similar.

[tutorial drivers pairing SDK3] Pairing - Homey Apps SDK

Best regards,

1 Like