-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Expand file tree
/
Copy pathswitch.mjs
More file actions
25 lines (23 loc) · 1.07 KB
/
Copy pathswitch.mjs
File metadata and controls
25 lines (23 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import {on_off} from "zigbee-herdsman-converters/converters/fromZigbee";
import {on_off as tzOnOff} from "zigbee-herdsman-converters/converters/toZigbee";
import {presets} from "zigbee-herdsman-converters/lib/exposes";
import {bind, onOff} from "zigbee-herdsman-converters/lib/reporting";
/** @type{import('zigbee-herdsman-converters/lib/types').DefinitionWithExtend | import('zigbee-herdsman-converters/lib/types').DefinitionWithExtend[]} */
export default {
zigbeeModel: ["myZigbeeModel"],
model: "myModel",
vendor: "myVendor",
description: "My super switch!",
fromZigbee: [on_off],
toZigbee: [tzOnOff],
exposes: [presets.switch()],
// The configure method below is needed to make the device reports on/off state changes
// when the device is controlled manually through the button on it.
configure: async (device, coordinatorEndpoint, definition) => {
const endpoint = device.getEndpoint(1);
if (endpoint) {
await bind(endpoint, coordinatorEndpoint, ["genOnOff"]);
await onOff(endpoint);
}
},
};