Skip to content

Commit

Permalink
fix(ignore): Remove linkquality expose (#8599)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk authored Jan 12, 2025
1 parent 9094130 commit f913273
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 89 deletions.
1 change: 0 additions & 1 deletion src/devices/bitron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ const definitions: DefinitionWithExtend[] = [
dynExposes.push(hysteresisExposes);
dynExposes.push(e.battery().withAccess(ea.STATE_GET));
dynExposes.push(e.battery_low());
dynExposes.push(e.linkquality());

return dynExposes;
},
Expand Down
3 changes: 1 addition & 2 deletions src/devices/bosch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,6 @@ const definitions: DefinitionWithExtend[] = [
};
const commonExposes = [
e.enum('switch_type', ea.ALL, Object.keys(stateSwitchType)).withDescription('Module controlled by a rocker switch or a button'),
e.linkquality(),
];
const lightExposes = [
e.switch().withEndpoint('left'),
Expand Down Expand Up @@ -1950,7 +1949,7 @@ const definitions: DefinitionWithExtend[] = [
return [...commonExposes, ...coverExposes];
}
}
return [e.enum('device_mode', ea.ALL, Object.keys(stateDeviceMode)).withDescription('Device mode'), e.linkquality()];
return [e.enum('device_mode', ea.ALL, Object.keys(stateDeviceMode)).withDescription('Device mode')];
},
},
{
Expand Down
1 change: 0 additions & 1 deletion src/devices/busch_jaeger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ const definitions: DefinitionWithExtend[] = [
'brightness_stop_row_4',
]),
);
expose.push(e.linkquality());

return expose;
},
Expand Down
2 changes: 1 addition & 1 deletion src/devices/custom_devices_diy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ const definitions: DefinitionWithExtend[] = [
if (exposeDeviceOptions['expose_battery']) {
expose.push(e.battery());
}
expose.push(e.linkquality());

return expose;
},
meta: {multiEndpoint: true, tuyaThermostatPreset: legacy.fz /* for subclassed custom converters */},
Expand Down
1 change: 0 additions & 1 deletion src/devices/danfoss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const definitions: DefinitionWithExtend[] = [
exposes: (device, options) => {
const maxSetpoint = ['TRV001', 'TRV003'].includes(device?.modelID) ? 32 : 35;
return [
e.linkquality(),
e.battery(),
e.keypad_lockout(),
e.programming_operation_mode(),
Expand Down
1 change: 0 additions & 1 deletion src/devices/databyte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const definitions: DefinitionWithExtend[] = [
toZigbee: [],
exposes: [
e.battery(),
e.linkquality(),
e.binary('key_1', ea.STATE, 'ON', 'OFF'),
e.binary('key_2', ea.STATE, 'ON', 'OFF'),
e.binary('key_3', ea.STATE, 'ON', 'OFF'),
Expand Down
2 changes: 0 additions & 2 deletions src/devices/develco.ts
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ const definitions: DefinitionWithExtend[] = [
e.enum('led_control', ea.ALL, ['off', 'fault_only', 'motion_only', 'both']).withDescription('Control LED indicator usage.'),
);
}
dynExposes.push(e.linkquality());
return dynExposes;
},
ota: true,
Expand Down Expand Up @@ -689,7 +688,6 @@ const definitions: DefinitionWithExtend[] = [
e.enum('led_control', ea.ALL, ['off', 'fault_only', 'motion_only', 'both']).withDescription('Control LED indicator usage.'),
);
}
dynExposes.push(e.linkquality());
return dynExposes;
},
ota: true,
Expand Down
1 change: 0 additions & 1 deletion src/devices/gmmts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1983,7 +1983,6 @@ const definitions: DefinitionWithExtend[] = [
exposes: (device, options) => {
let endpoint: Zh.Endpoint;
const exposes: Expose[] = [];
exposes.push(e.linkquality());

let currentContract: string = '';
let currentElec: string = '';
Expand Down
2 changes: 0 additions & 2 deletions src/devices/imhotepcreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ const definitions: DefinitionWithExtend[] = [
}
}

features.push(e.linkquality());

return features;
},
configure: async (device, coordinatorEndpoint) => {
Expand Down
2 changes: 0 additions & 2 deletions src/devices/legrand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ const definitions: DefinitionWithExtend[] = [
eLegrand.ledInDark(),
eLegrand.ledIfOn(),
eLegrand.getCalibrationModes(false),
e.linkquality(),
];
},
configure: async (device, coordinatorEndpoint) => {
Expand Down Expand Up @@ -230,7 +229,6 @@ const definitions: DefinitionWithExtend[] = [
eLegrand.ledInDark(),
eLegrand.ledIfOn(),
eLegrand.getCalibrationModes(true),
e.linkquality(),
];
},
configure: async (device, coordinatorEndpoint) => {
Expand Down
1 change: 0 additions & 1 deletion src/devices/lixee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,6 @@ const definitions: DefinitionWithExtend[] = [
exposes = getCurrentConfig(device, options).map((e) => e.exposes);
}

exposes.push(e.linkquality());
return exposes;
},
options: [
Expand Down
3 changes: 1 addition & 2 deletions src/devices/ls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ const definitions: DefinitionWithExtend[] = [
toZigbee: light({colorTemp: {range: [153, 454]}, color: true}).toZigbee,
configure: light({colorTemp: {range: [153, 454]}, color: true}).configure[0],
exposes: (device, options) => {
if (!device) return [e.light_brightness_colortemp_colorxy([153, 454]), e.linkquality()];
if (!device) return [e.light_brightness_colortemp_colorxy([153, 454])];
return [
e.linkquality(),
...device.endpoints
.filter((ep) => ep.ID !== 242)
.map((ep) => {
Expand Down
3 changes: 1 addition & 2 deletions src/devices/moes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ const definitions: DefinitionWithExtend[] = [
exposes: (device, options) => {
const heatingStepSize = device?.manufacturerName === '_TZE204_5toc8efa' ? 0.5 : 1;
return [
e.linkquality(),
e.child_lock(),
e.deadzone_temperature(),
e.max_temperature_limit().withValueMax(45),
Expand Down Expand Up @@ -435,7 +434,7 @@ const definitions: DefinitionWithExtend[] = [
],
toZigbee: [tzZosung.zosung_ir_code_to_send, tzZosung.zosung_learn_ir_code],
exposes: (device, options) => {
const exposes = [ez.learn_ir_code(), ez.learned_ir_code(), ez.ir_code_to_send(), e.linkquality()];
const exposes = [ez.learn_ir_code(), ez.learned_ir_code(), ez.ir_code_to_send()];
if (device?.manufacturerName !== '') {
exposes.push(e.battery(), e.battery_voltage());
}
Expand Down
4 changes: 2 additions & 2 deletions src/devices/profalux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ const definitions: DefinitionWithExtend[] = [
// 2: soft cover (aka store) : 2xF Stop + Down

if ((device == null && options == null) || endpoint.getClusterAttributeValue('manuSpecificProfalux1', 'motorCoverType') == 1) {
return [e.cover_position_tilt(), e.linkquality()];
return [e.cover_position_tilt()];
} else {
return [e.cover_position(), e.linkquality()];
return [e.cover_position()];
}
},
configure: async (device, coordinatorEndpoint) => {
Expand Down
2 changes: 0 additions & 2 deletions src/devices/siglis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ const definitions: DefinitionWithExtend[] = [
const expose = [];

expose.push(buttonEventExposes);
expose.push(e.linkquality());

if (checkOption(device, options, 'front_surface_enabled')) {
expose.push(e.light_brightness_colorxy().withEndpoint('l1'));
Expand Down Expand Up @@ -246,7 +245,6 @@ const definitions: DefinitionWithExtend[] = [
const expose = [];

expose.push(buttonEventExposes);
expose.push(e.linkquality());

if (checkOption(device, options, 'front_surface_enabled')) {
expose.push(e.light_brightness_colorxy().withEndpoint('l1'));
Expand Down
20 changes: 9 additions & 11 deletions src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ const definitions: DefinitionWithExtend[] = [
if (!device || !noBatteryLowModels.includes(device.manufacturerName)) {
exps.push(e.battery_low());
}
exps.push(e.linkquality());

return exps;
},
meta: {
Expand Down Expand Up @@ -1005,7 +1005,7 @@ const definitions: DefinitionWithExtend[] = [
exps.push(e.battery_low());
exps.push(e.enum('battery_level', ea.STATE, ['low', 'middle', 'high']).withDescription('Battery level state'));
}
exps.push(e.linkquality());

return exps;
},
},
Expand Down Expand Up @@ -1782,7 +1782,7 @@ const definitions: DefinitionWithExtend[] = [
// Requires alarm_1_with_timeout https://github.com/Koenkk/zigbee2mqtt/issues/2818#issuecomment-776119586
fromZigbee: [fz.ias_occupancy_alarm_1_with_timeout, fz.battery, fz.ignore_basic_report],
toZigbee: [],
exposes: [e.occupancy(), e.battery_low(), e.linkquality(), e.battery(), e.battery_voltage()],
exposes: [e.occupancy(), e.battery_low(), e.battery(), e.battery_voltage()],
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg']);
Expand Down Expand Up @@ -1816,7 +1816,7 @@ const definitions: DefinitionWithExtend[] = [
if (!device || !['_TZ3000_bsvqrxru', '_TZ3000_nss8amz9'].includes(device.manufacturerName)) {
exps.push(e.tamper());
}
exps.push(e.linkquality());

return exps;
},
configure: async (device, coordinatorEndpoint) => {
Expand Down Expand Up @@ -1957,7 +1957,7 @@ const definitions: DefinitionWithExtend[] = [
if (!device || !noTamperModels.includes(device.manufacturerName)) {
exps.push(e.tamper());
}
exps.push(e.linkquality());

return exps;
},
},
Expand Down Expand Up @@ -2177,8 +2177,6 @@ const definitions: DefinitionWithExtend[] = [
exps.push(tuya.exposes.lightType(), tuya.exposes.backlightModeOffNormalInverted().withAccess(ea.STATE_SET));
}

exps.push(e.linkquality());

return exps;
},
meta: {
Expand Down Expand Up @@ -2605,7 +2603,7 @@ const definitions: DefinitionWithExtend[] = [
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
},
exposes: [e.battery(), e.illuminance(), e.linkquality(), e.enum('brightness_level', ea.STATE, ['LOW', 'MEDIUM', 'HIGH'])],
exposes: [e.battery(), e.illuminance(), e.enum('brightness_level', ea.STATE, ['LOW', 'MEDIUM', 'HIGH'])],
},
{
zigbeeModel: ['TS130F'],
Expand Down Expand Up @@ -2652,7 +2650,7 @@ const definitions: DefinitionWithExtend[] = [
if (device?.manufacturerName !== '_TZ3210_xbpt8ewc' && device?.manufacturerName !== '_TZ3000_e3vhyirx') {
exps.push(tuya.exposes.indicatorMode(), tuya.exposes.backlightModeOffOn());
}
exps.push(e.linkquality());

return exps;
},
},
Expand Down Expand Up @@ -9244,7 +9242,7 @@ const definitions: DefinitionWithExtend[] = [
fromZigbee: [fz.temperature, fzLocal.TS011F_threshold],
toZigbee: [tzLocal.TS011F_threshold],
exposes: (device, options) => {
const exposes: Expose[] = [e.linkquality()];
const exposes: Expose[] = [];
if (!['_TZ3000_303avxxt', '_TZ3000_zjchz7pd'].includes(device?.manufacturerName)) {
exposes.push(
e.temperature(),
Expand Down Expand Up @@ -10365,7 +10363,7 @@ const definitions: DefinitionWithExtend[] = [
description: 'Motion sensor',
fromZigbee: [fz.ias_occupancy_alarm_1_with_timeout, fz.battery],
toZigbee: [],
exposes: [e.occupancy(), e.battery_low(), e.linkquality(), e.battery(), e.battery_voltage()],
exposes: [e.occupancy(), e.battery_low(), e.battery(), e.battery_voltage()],
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg']);
Expand Down
2 changes: 1 addition & 1 deletion src/devices/ubisys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ const definitions: DefinitionWithExtend[] = [
coverExpose.withPosition().withTilt();
break;
}
return [coverExpose, e.power().withAccess(ea.STATE_GET), e.energy().withAccess(ea.STATE_GET), e.linkquality()];
return [coverExpose, e.power().withAccess(ea.STATE_GET), e.energy().withAccess(ea.STATE_GET)];
},
extend: [ubisysModernExtend.addCustomClusterManuSpecificUbisysDeviceSetup(), ubisysModernExtend.addCustomClusterClosuresWindowCovering()],
configure: async (device, coordinatorEndpoint) => {
Expand Down
2 changes: 1 addition & 1 deletion src/devices/visonic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const definitions: DefinitionWithExtend[] = [
fromZigbee: [fz.ias_occupancy_alarm_1, fz.temperature, fz.battery],
toZigbee: [],
meta: {battery: {voltageToPercentage: {min: 2500, max: 3000}}},
exposes: [e.occupancy(), e.battery_low(), e.tamper(), e.battery_voltage(), e.linkquality(), e.temperature(), e.battery()],
exposes: [e.occupancy(), e.battery_low(), e.tamper(), e.battery_voltage(), e.temperature(), e.battery()],
},
{
zigbeeModel: ['MP-841'],
Expand Down
25 changes: 18 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type {Binary, Climate, Composite, Cover, Enum, Fan, Feature, Light, List, Lock, Numeric, Switch, Text} from './lib/exposes';

import assert from 'assert';

import {Zcl} from 'zigbee-herdsman';
Expand All @@ -8,8 +6,24 @@ import fromZigbee from './converters/fromZigbee';
import toZigbee from './converters/toZigbee';
import allDefinitions from './devices';
import * as configureKey from './lib/configureKey';
import {
access,
Binary,
Climate,
Composite,
Cover,
Enum,
Enum as EnumClass,
Fan,
Feature,
Light,
List,
Lock,
Numeric,
Switch,
Text,
} from './lib/exposes';
import * as exposesLib from './lib/exposes';
import {Enum as EnumClass} from './lib/exposes';
import {generateDefinition} from './lib/generateDefinition';
import * as logger from './lib/logger';
import {
Expand All @@ -35,6 +49,7 @@ const NS = 'zhc';

export type {Ota} from './lib/types';
export {
access as access,
Definition as Definition,
OnEventType as OnEventType,
Feature as Feature,
Expand Down Expand Up @@ -313,10 +328,6 @@ function prepareDefinition(definition: DefinitionWithExtend): Definition {
toZigbee.zcl_command,
);

if (definition.exposes && Array.isArray(definition.exposes) && !definition.exposes.find((e) => e.name === 'linkquality')) {
definition.exposes = definition.exposes.concat([exposesLib.presets.linkquality()]);
}

if (definition.externalConverterName) {
validateDefinition(definition);
}
Expand Down
7 changes: 0 additions & 7 deletions src/lib/exposes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1055,13 +1055,6 @@ export const presets = {
),
)
.withCategory('config'),
linkquality: () =>
new Numeric('linkquality', access.STATE)
.withUnit('lqi')
.withDescription('Link quality (signal strength)')
.withValueMin(0)
.withValueMax(255)
.withCategory('diagnostic'),
local_temperature: () =>
new Numeric('local_temperature', access.STATE_GET).withUnit('°C').withDescription('Current temperature measured on the device'),
lock: () => new Lock().withState('state', 'LOCK', 'UNLOCK', 'State of the lock').withLockState('lock_state', 'Actual state of the lock'),
Expand Down
Loading

0 comments on commit f913273

Please sign in to comment.