|
1 | 1 | import {Zcl} from 'zigbee-herdsman';
|
2 | 2 | import {ClusterDefinition} from 'zigbee-herdsman/dist/zspec/zcl/definition/tstype';
|
3 | 3 |
|
| 4 | +import tz from '../converters/toZigbee'; |
4 | 5 | import * as exposes from '../lib/exposes';
|
5 | 6 | import {logger} from '../lib/logger';
|
6 | 7 | import * as m from '../lib/modernExtend';
|
@@ -1406,28 +1407,13 @@ const yokisCommandsExtend = {
|
1406 | 1407 | // Dereferencing the `on_time` and `off_wait_time` from the keys of the converter.
|
1407 | 1408 | const yokisTz = {
|
1408 | 1409 | on_off: {
|
| 1410 | + ...tz.on_off, |
1409 | 1411 | 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 |
| - }, |
1425 | 1412 | } satisfies Tz.Converter,
|
1426 | 1413 | };
|
1427 | 1414 |
|
1428 | 1415 | function YokisOnOff(args?: m.OnOffArgs): ModernExtend {
|
1429 | 1416 | const result: ModernExtend = {...m.onOff(args), toZigbee: [yokisTz.on_off]};
|
1430 |
| - |
1431 | 1417 | return result;
|
1432 | 1418 | }
|
1433 | 1419 |
|
@@ -2344,6 +2330,14 @@ const definitions: DefinitionWithExtend[] = [
|
2344 | 2330 | model: 'MTR1300E-UP',
|
2345 | 2331 | vendor: 'YOKIS',
|
2346 | 2332 | 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 | + ], |
2347 | 2341 | extend: [
|
2348 | 2342 | m.deviceAddCustomCluster('manuSpecificYokisDevice', YokisClustersDefinition['manuSpecificYokisDevice']),
|
2349 | 2343 | m.deviceAddCustomCluster('manuSpecificYokisInput', YokisClustersDefinition['manuSpecificYokisInput']),
|
|
0 commit comments