Hi, I am trying to write a driver for a device with multple onoff capabilities (on endpoints 1 and 2).
I 1st tried to register the capabilities as:
"capabilities": [
"onoff.pump",
"onoff.valve",
...
and then in the device.js:
this.registerCapability('onoff.pump', CLUSTER.ON_OFF, {
endpoint: 1,
});
this.registerCapability('onoff.valve', CLUSTER.ON_OFF, {
endpoint: 2,
});
This produces the following GUI:
Few issues here:
- Is there a way to control the labels in the dropdown - i could not find anything in the documentation. The user would not know which onoff capability they are working on.
- Toggling the onoff capabilities does not change the settings on the device. If I change the capabilities to a single onoff then it does correctly act on the 1st endpoint.
- Toggling the onoff settings on the device itself does not report back to the homey app.
I then tried to change to implement my own custom capabilities:
"capabilities": [
"water_pump",
"dump_valve",
...
with the capability json as (only showing water_pump as the dump_valve is similar):
{
"type": "boolean",
"title": {
"en": "Water Pump"
},
"units": {
"en": "Status"
},
"desc": {
"en": "Water Pump Power"
},
"getable": true,
"setable": true,
"uiQuickAction": false
}
I then update my device.js to do this:
this.registerCapability('water_pump', CLUSTER.ON_OFF, {
endpoint: 1,
set: (value) => (value ? 'setOn' : 'setOff'),
setParser: () => ({}),
get: 'onOff',
report: 'onOff',
reportParser: (value) => {
return value;
},
});
this.registerCapability('dump_valve', CLUSTER.ON_OFF, {
endpoint: 2,
set: (value) => (value ? 'setOn' : 'setOff'),
setParser: () => ({}),
get: 'onOff',
report: 'onOff',
reportParser: (value) => {
return value;
},
});
I now see a better rendering of the GUI:
I am correctly receiving updates for both endpoints from the device, and I can now control the pump switch, but when trying to control the valve I get a timeout. I assume I am missing some config to control which endpoint the onoff command is sent to.
Any help would be appreciated.