Skip to content

Commit 32c85fd

Browse files
Simplified toZigbee converter override
1 parent 2268377 commit 32c85fd

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

src/devices/yokis.ts

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Zcl} from 'zigbee-herdsman';
22
import {ClusterDefinition} from 'zigbee-herdsman/dist/zspec/zcl/definition/tstype';
33

4+
import tz from '../converters/toZigbee';
45
import * as exposes from '../lib/exposes';
56
import {logger} from '../lib/logger';
67
import * as m from '../lib/modernExtend';
@@ -1406,28 +1407,13 @@ const yokisCommandsExtend = {
14061407
// Dereferencing the `on_time` and `off_wait_time` from the keys of the converter.
14071408
const yokisTz = {
14081409
on_off: {
1410+
...tz.on_off,
14091411
key: ['state'],
1410-
convertSet: async (entity, key, value, meta) => {
1411-
const state = utils.isString(meta.message.state) ? meta.message.state.toLowerCase() : null;
1412-
utils.validateValue(state, ['toggle', 'off', 'on']);
1413-
1414-
await entity.command('genOnOff', state, {}, utils.getOptions(meta.mapped, entity));
1415-
if (state === 'toggle') {
1416-
const currentState = meta.state[`state${meta.endpoint_name ? `_${meta.endpoint_name}` : ''}`];
1417-
return currentState ? {state: {state: currentState === 'OFF' ? 'ON' : 'OFF'}} : {};
1418-
} else {
1419-
return {state: {state: state.toUpperCase()}};
1420-
}
1421-
},
1422-
convertGet: async (entity, key, meta) => {
1423-
await entity.read('genOnOff', ['onOff']);
1424-
},
14251412
} satisfies Tz.Converter,
14261413
};
14271414

14281415
function YokisOnOff(args?: m.OnOffArgs): ModernExtend {
14291416
const result: ModernExtend = {...m.onOff(args), toZigbee: [yokisTz.on_off]};
1430-
14311417
return result;
14321418
}
14331419

@@ -2344,6 +2330,14 @@ const definitions: DefinitionWithExtend[] = [
23442330
model: 'MTR1300E-UP',
23452331
vendor: 'YOKIS',
23462332
description: 'Remote power switch with timer 1300W',
2333+
whiteLabel: [
2334+
{
2335+
model: 'MTR1300EB-UP',
2336+
vendor: 'YOKIS',
2337+
description: 'Remote power switch with timer 1300W',
2338+
fingerprint: [{modelID: 'MTR1300EB-UP'}],
2339+
},
2340+
],
23472341
extend: [
23482342
m.deviceAddCustomCluster('manuSpecificYokisDevice', YokisClustersDefinition['manuSpecificYokisDevice']),
23492343
m.deviceAddCustomCluster('manuSpecificYokisInput', YokisClustersDefinition['manuSpecificYokisInput']),

0 commit comments

Comments
 (0)