Skip to content

Commit

Permalink
fix(ignore): move SONOFF customCluster to use modernExtend
Browse files Browse the repository at this point in the history
  • Loading branch information
sjorge committed Apr 28, 2024
1 parent 17a8d85 commit db2aa5b
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions src/devices/sonoff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import fz from '../converters/fromZigbee';
import tz from '../converters/toZigbee';
import * as constants from '../lib/constants';
import * as reporting from '../lib/reporting';
import {binary, enumLookup, forcePowerSource, numeric, onOff, customTimeResponse, battery, ota} from '../lib/modernExtend';
import {
binary, enumLookup, forcePowerSource, numeric, onOff,
customTimeResponse, battery, ota, deviceAddCustomCluster,
} from '../lib/modernExtend';
import {Definition, Fz, KeyValue, KeyValueAny, ModernExtend, Tz} from '../lib/types';
import * as utils from '../lib/utils';
import {logger} from '../lib/logger';
Expand Down Expand Up @@ -803,6 +806,28 @@ const definitions: Definition[] = [
tz.thermostat_running_state,
],
extend: [
deviceAddCustomCluster(
'customSonoffTrvzb',
{
ID: 0xfc11,
attributes: {
childLock: {ID: 0x0000, type: Zcl.DataType.boolean},
tamper: {ID: 0x2000, type: Zcl.DataType.uint8},
illumination: {ID: 0x2001, type: Zcl.DataType.uint8},
openWindow: {ID: 0x6000, type: Zcl.DataType.boolean},
frostProtectionTemperature: {ID: 0x6002, type: Zcl.DataType.int16},
idleSteps: {ID: 0x6003, type: Zcl.DataType.uint16},
closingSteps: {ID: 0x6004, type: Zcl.DataType.uint16},
valveOpeningLimitVoltage: {ID: 0x6005, type: Zcl.DataType.uint16},
valveClosingLimitVoltage: {ID: 0x6006, type: Zcl.DataType.uint16},
valveMotorRunningVoltage: {ID: 0x6007, type: Zcl.DataType.uint16},
valveOpeningDegree: {ID: 0x600B, type: Zcl.DataType.uint8},
valveClosingDegree: {ID: 0x600C, type: Zcl.DataType.uint8},
},
commands: {},
commandsResponse: {},
},
),
binary({
name: 'child_lock',
cluster: 'customSonoffTrvzb',
Expand Down Expand Up @@ -910,30 +935,6 @@ const definitions: Definition[] = [
await endpoint.read('hvacThermostat', ['localTemperatureCalibration']);
await endpoint.read(0xFC11, [0x0000, 0x6000, 0x6002, 0x6003, 0x6004, 0x6005, 0x6006, 0x6007]);
},
onEvent: async (type, data, device, settings, state) => {
const name = 'customSonoffTrvzb';
if (!device.customClusters[name]) {
device.addCustomCluster(name, {
ID: 0xfc11,
attributes: {
childLock: {ID: 0x0000, type: Zcl.DataType.boolean},
tamper: {ID: 0x2000, type: Zcl.DataType.uint8},
illumination: {ID: 0x2001, type: Zcl.DataType.uint8},
openWindow: {ID: 0x6000, type: Zcl.DataType.boolean},
frostProtectionTemperature: {ID: 0x6002, type: Zcl.DataType.int16},
idleSteps: {ID: 0x6003, type: Zcl.DataType.uint16},
closingSteps: {ID: 0x6004, type: Zcl.DataType.uint16},
valveOpeningLimitVoltage: {ID: 0x6005, type: Zcl.DataType.uint16},
valveClosingLimitVoltage: {ID: 0x6006, type: Zcl.DataType.uint16},
valveMotorRunningVoltage: {ID: 0x6007, type: Zcl.DataType.uint16},
valveOpeningDegree: {ID: 0x600B, type: Zcl.DataType.uint8},
valveClosingDegree: {ID: 0x600C, type: Zcl.DataType.uint8},
},
commands: {},
commandsResponse: {},
});
}
},
},
{
zigbeeModel: ['S60ZBTPF'],
Expand Down

0 comments on commit db2aa5b

Please sign in to comment.