Skip to content

Instantly share code, notes, and snippets.

@Koenkk

Koenkk/ext.js Secret

Created October 11, 2023 17:38
Show Gist options
  • Save Koenkk/b66f2d1c013a0d7ea69a971f9a0734d0 to your computer and use it in GitHub Desktop.
Save Koenkk/b66f2d1c013a0d7ea69a971f9a0734d0 to your computer and use it in GitHub Desktop.
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const legacy = require('zigbee-herdsman-converters/lib/legacy');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['RDM001', '9290030171', 'RDM004'],
model: '929003017102',
vendor: 'Philips',
description: 'Hue wall switch module',
fromZigbee: [fz.battery, fz.hue_wall_switch_device_mode, fz.hue_wall_switch, fz.command_toggle],
exposes: [
e.battery(), e.action(['left_press', 'left_press_release', 'right_press', 'right_press_release',
'left_hold', 'left_hold_release', 'right_hold', 'right_hold_release', 'toggle']),
e.enum('device_mode', ea.ALL, ['single_rocker', 'single_push_button', 'dual_rocker', 'dual_push_button'])],
toZigbee: [tz.hue_wall_switch_device_mode],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg', 'genOnOff', 'manuSpecificPhilips']);
await reporting.batteryPercentageRemaining(endpoint);
const options = {manufacturerCode: 0x100B, disableDefaultResponse: true};
await endpoint.write('genBasic', {0x0034: {value: 0, type: 48}}, options);
},
};
module.exports = definition;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment