Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: Remove illuminance_lux #8304

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix!: Remove illuminance_lux
  • Loading branch information
Koenkk committed Nov 11, 2024
commit 6c9c97b0f52988b8885b3a40daca13001a11b219
5 changes: 2 additions & 3 deletions src/converters/fromZigbee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,9 @@ const converters1 = {
cluster: 'msIlluminanceMeasurement',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
// DEPRECATED: only return lux here (change illuminance_lux -> illuminance)
const illuminance = msg.data['measuredValue'];
const illuminanceLux = illuminance === 0 ? 0 : Math.pow(10, (illuminance - 1) / 10000);
return {illuminance: illuminance, illuminance_lux: illuminanceLux};
return {illuminance: illuminanceLux};
},
} satisfies Fz.Converter,
pressure: {
Expand Down Expand Up @@ -2654,7 +2653,7 @@ const converters1 = {
W: 'power',
Hz: 'frequency',
pf: 'power_factor',
lx: 'illuminance_lux',
lx: 'illuminance',
};

let nameAlt = '';
Expand Down
2 changes: 1 addition & 1 deletion src/converters/toZigbee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ const converters2 = {
},
} satisfies Tz.Converter,
illuminance: {
key: ['illuminance', 'illuminance_lux'],
key: ['illuminance'],
convertGet: async (entity, key, meta) => {
await entity.read('msIlluminanceMeasurement', ['measuredValue']);
},
Expand Down
2 changes: 1 addition & 1 deletion src/devices/aurora_lighting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const definitions: DefinitionWithExtend[] = [
await reporting.bind(endpoint, coordinatorEndpoint, ['msIlluminanceMeasurement']);
await reporting.illuminance(endpoint);
},
exposes: [e.occupancy(), e.battery_low(), e.tamper(), e.illuminance(), e.illuminance_lux()],
exposes: [e.occupancy(), e.battery_low(), e.tamper(), e.illuminance()],
},
{
zigbeeModel: ['SingleSocket50AU'],
Expand Down
10 changes: 5 additions & 5 deletions src/devices/bosch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ const boschExtend = {
.withUnit('ppm')
.withDescription('The measured CO2 (carbon dioxide) value'),
e.numeric('aqi', ea.STATE).withValueMin(0).withValueMax(500).withValueStep(1).withLabel('AQI').withDescription('Air Quality Index'),
e.numeric('illuminance_lux', ea.STATE).withUnit('lx').withDescription('Measured illuminance in lux'),
e.illuminance(),
e
.numeric('battery', ea.STATE)
.withUnit('%')
Expand Down Expand Up @@ -630,8 +630,8 @@ const boschExtend = {
if (msg.data.temperature !== undefined) {
result.temperature = utils.toNumber(msg.data['temperature']) / 100.0;
}
if (msg.data.illuminance_lux !== undefined) {
result.illuminance_lux = utils.precisionRound(msg.data['illuminance_lux'] / 2, 2);
if (msg.data.illuminance !== undefined) {
result.illuminance = utils.precisionRound(msg.data['illuminance'] / 2, 2);
}
if (msg.data.battery !== undefined) {
result.battery = utils.precisionRound(msg.data['battery'] / 2, 2);
Expand Down Expand Up @@ -1329,7 +1329,7 @@ const definitions: DefinitionWithExtend[] = [
await reporting.batteryVoltage(endpoint);
await reporting.illuminance(endpoint);
},
exposes: [e.temperature(), e.battery(), e.occupancy(), e.battery_low(), e.tamper(), e.illuminance(), e.illuminance_lux()],
exposes: [e.temperature(), e.battery(), e.occupancy(), e.battery_low(), e.tamper(), e.illuminance()],
},
{
zigbeeModel: ['ISW-ZPR1-WP13'],
Expand Down Expand Up @@ -1670,7 +1670,7 @@ const definitions: DefinitionWithExtend[] = [
unknown2: {ID: 0x4002, type: Zcl.DataType.UINT16},
airpurity: {ID: 0x4003, type: Zcl.DataType.UINT16},
temperature: {ID: 0x4004, type: Zcl.DataType.INT16},
illuminance_lux: {ID: 0x4005, type: Zcl.DataType.UINT16},
illuminance: {ID: 0x4005, type: Zcl.DataType.UINT16},
battery: {ID: 0x4006, type: Zcl.DataType.UINT16},
unknown3: {ID: 0x4007, type: Zcl.DataType.UINT16},
unknown4: {ID: 0x4008, type: Zcl.DataType.UINT16},
Expand Down
2 changes: 0 additions & 2 deletions src/devices/ctm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,6 @@ const definitions: DefinitionWithExtend[] = [
exposes: [
e.switch(),
e.illuminance(),
e.illuminance_lux(),
e.occupancy(),
e.binary('device_enabled', ea.ALL, 'ON', 'OFF').withDescription('Turn the device on or off'),
],
Expand Down Expand Up @@ -1366,7 +1365,6 @@ const definitions: DefinitionWithExtend[] = [
exposes: [
e.light_brightness(),
e.illuminance(),
e.illuminance_lux(),
e.occupancy(),
e.binary('device_enabled', ea.ALL, 'ON', 'OFF').withDescription('Turn the device on or off'),
e.numeric('ballast_minimum_level', ea.ALL).withValueMin(10).withValueMax(97).withDescription('Specifies the minimum brightness value'),
Expand Down
8 changes: 3 additions & 5 deletions src/devices/custom_devices_diy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,11 @@ const fzLocal = {
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
// multi-endpoint version based on the stastard onverter 'fz.illuminance'
// DEPRECATED: only return lux here (change illuminance_lux -> illuminance)
const illuminance = msg.data['measuredValue'];
const illuminanceLux = illuminance === 0 ? 0 : Math.pow(10, (illuminance - 1) / 10000);
const multiEndpoint = model.meta && model.meta.multiEndpoint !== undefined && model.meta.multiEndpoint;
const property1 = multiEndpoint ? postfixWithEndpointName('illuminance', msg, model, meta) : 'illuminance';
const property2 = multiEndpoint ? postfixWithEndpointName('illuminance_lux', msg, model, meta) : 'illuminance_lux';
return {[property1]: illuminance, [property2]: illuminanceLux};
return {[property1]: illuminanceLux};
},
} satisfies Fz.Converter,
pressure2: {
Expand Down Expand Up @@ -468,7 +466,7 @@ const definitions: DefinitionWithExtend[] = [
W: 'power',
Hz: 'frequency',
pf: 'power_factor',
lx: 'illuminance_lux',
lx: 'illuminance',
};
valueName = valueName !== undefined ? valueName : infoLookup[valueId];

Expand Down Expand Up @@ -717,7 +715,7 @@ const definitions: DefinitionWithExtend[] = [
description: 'b-parasite open source soil moisture sensor',
fromZigbee: [fz.temperature, fz.humidity, fz.battery, fz.soil_moisture, fz.illuminance],
toZigbee: [],
exposes: [e.temperature(), e.humidity(), e.battery(), e.soil_moisture(), e.illuminance_lux()],
exposes: [e.temperature(), e.humidity(), e.battery(), e.soil_moisture(), e.illuminance()],
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(10);
await reporting.bind(endpoint, coordinatorEndpoint, [
Expand Down
1 change: 0 additions & 1 deletion src/devices/datek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ const definitions: DefinitionWithExtend[] = [
e.temperature(),
e.occupancy(),
e.battery_low(),
e.illuminance_lux(),
e.illuminance(),
e.binary('led_on_motion', ea.ALL, true, false).withDescription('Enable/disable LED on motion'),
e.numeric('occupancy_timeout', ea.ALL).withUnit('s').withValueMin(0).withValueMax(65535),
Expand Down
1 change: 0 additions & 1 deletion src/devices/fantem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const definitions: DefinitionWithExtend[] = [
exposes: [
e.occupancy(),
e.tamper(),
e.illuminance_lux(),
e.illuminance(),
e.temperature(),
e.humidity(),
Expand Down
3 changes: 1 addition & 2 deletions src/devices/immax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const definitions: DefinitionWithExtend[] = [
await reporting.humidity(endpoint);
await reporting.illuminance(endpoint);
},
exposes: [e.occupancy(), e.battery_low(), e.tamper(), e.battery(), e.temperature(), e.illuminance(), e.illuminance_lux(), e.humidity()],
exposes: [e.occupancy(), e.battery_low(), e.tamper(), e.battery(), e.temperature(), e.illuminance(), e.humidity()],
},
{
zigbeeModel: ['ColorTemperature'],
Expand Down Expand Up @@ -222,7 +222,6 @@ const definitions: DefinitionWithExtend[] = [
e.tamper(),
e.battery(),
e.illuminance(),
e.illuminance_lux().withUnit('lx'),
e.temperature(),
e.humidity(),
e.numeric('reporting_time', ea.STATE_SET).withDescription('Reporting interval in minutes').withValueMin(0).withValueMax(1440),
Expand Down
2 changes: 1 addition & 1 deletion src/devices/javis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const definitions: DefinitionWithExtend[] = [
toZigbee: [legacy.tz.javis_microwave_sensor],
exposes: [
e.occupancy(),
e.illuminance_lux(),
e.illuminance(),
e.binary('led_enable', ea.STATE_SET, true, false).withDescription('Enabled LED'),
e
.enum('keep_time', ea.STATE_SET, ['0', '1', '2', '3', '4', '5', '6', '7'])
Expand Down
11 changes: 1 addition & 10 deletions src/devices/kmpcil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,7 @@ const definitions: DefinitionWithExtend[] = [
model: 'KMPCIL_RES005',
vendor: 'KMPCIL',
description: 'Environment sensor',
exposes: [
e.battery(),
e.temperature(),
e.humidity(),
e.pressure(),
e.illuminance().withAccess(ea.STATE_GET),
e.illuminance_lux().withAccess(ea.STATE_GET),
e.occupancy(),
e.switch(),
],
exposes: [e.battery(), e.temperature(), e.humidity(), e.pressure(), e.illuminance().withAccess(ea.STATE_GET), e.occupancy(), e.switch()],
fromZigbee: [fz.battery, fz.temperature, fz.humidity, fz.pressure, fz.illuminance, fz.kmpcil_res005_occupancy, fz.kmpcil_res005_on_off],
toZigbee: [tz.kmpcil_res005_on_off, tz.illuminance],
configure: async (device, coordinatorEndpoint) => {
Expand Down
2 changes: 1 addition & 1 deletion src/devices/konke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const definitions: DefinitionWithExtend[] = [
description: 'Temperature, relative humidity and illuminance sensor',
fromZigbee: [fz.battery, fz.illuminance, fz.humidity, fz.temperature],
toZigbee: [],
exposes: [e.battery(), e.battery_voltage(), e.illuminance(), e.illuminance_lux().withUnit('lx'), e.humidity(), e.temperature()],
exposes: [e.battery(), e.battery_voltage(), e.illuminance(), e.humidity(), e.temperature()],
},
{
zigbeeModel: ['3AFE241000040002'],
Expand Down
4 changes: 2 additions & 2 deletions src/devices/leedarson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const definitions: DefinitionWithExtend[] = [
description: 'Motion sensor',
fromZigbee: [fz.occupancy, fz.illuminance, fz.ignore_occupancy_report],
toZigbee: [],
exposes: [e.occupancy(), e.illuminance(), e.illuminance_lux()],
exposes: [e.occupancy(), e.illuminance()],
},
{
zigbeeModel: ['ZB-SMART-PIRTH-V1'],
Expand All @@ -114,7 +114,7 @@ const definitions: DefinitionWithExtend[] = [
description: '4-in-1-Sensor',
fromZigbee: [fz.battery, fz.ias_occupancy_alarm_1, fz.illuminance, fz.temperature, fz.humidity, fz.ignore_occupancy_report],
toZigbee: [],
exposes: [e.battery(), e.occupancy(), e.temperature(), e.illuminance(), e.illuminance_lux(), e.humidity()],
exposes: [e.battery(), e.occupancy(), e.temperature(), e.illuminance(), e.humidity()],
},
{
zigbeeModel: ['ZB-MotionSensor-S0000'],
Expand Down
24 changes: 6 additions & 18 deletions src/devices/lumi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1603,15 +1603,7 @@ const definitions: DefinitionWithExtend[] = [
meta: {battery: {voltageToPercentage: {min: 2850, max: 3000}}},
fromZigbee: [lumi.fromZigbee.lumi_basic, fz.occupancy_with_timeout, lumi.fromZigbee.lumi_illuminance],
toZigbee: [],
exposes: [
e.battery(),
e.occupancy(),
e.device_temperature(),
e.battery_voltage(),
e.illuminance_lux().withProperty('illuminance'),
e.illuminance().withUnit('lx').withDescription('Measured illuminance in lux'),
e.power_outage_count(false),
],
exposes: [e.battery(), e.occupancy(), e.device_temperature(), e.battery_voltage(), e.illuminance(), e.power_outage_count(false)],
extend: [quirkCheckinInterval('1_HOUR')],
},
{
Expand All @@ -1624,8 +1616,7 @@ const definitions: DefinitionWithExtend[] = [
toZigbee: [lumi.toZigbee.lumi_detection_interval],
exposes: [
e.occupancy(),
e.illuminance_lux().withProperty('illuminance'),
e.illuminance().withUnit('lx').withDescription('Measured illuminance in lux'),
e.illuminance(),
e
.numeric('detection_interval', ea.ALL)
.withValueMin(2)
Expand Down Expand Up @@ -1685,8 +1676,7 @@ const definitions: DefinitionWithExtend[] = [
toZigbee: [lumi.toZigbee.lumi_detection_interval, lumi.toZigbee.lumi_motion_sensitivity, lumi.toZigbee.lumi_trigger_indicator],
exposes: [
e.occupancy(),
e.illuminance_lux().withProperty('illuminance'),
e.illuminance().withUnit('lx').withDescription('Measured illuminance in lux'),
e.illuminance(),
e
.motion_sensitivity_select(['low', 'medium', 'high'])
.withDescription('Select motion sensitivity to use. Press pairing button right before changing this otherwise it will fail.'),
Expand Down Expand Up @@ -1723,8 +1713,7 @@ const definitions: DefinitionWithExtend[] = [
toZigbee: [lumi.toZigbee.lumi_detection_interval],
exposes: [
e.occupancy(),
e.illuminance_lux().withProperty('illuminance'),
e.illuminance().withUnit('lx').withDescription('Measured illuminance in lux'),
e.illuminance(),
e
.numeric('detection_interval', ea.ALL)
.withValueMin(2)
Expand Down Expand Up @@ -2622,7 +2611,7 @@ const definitions: DefinitionWithExtend[] = [
e.battery().withAccess(ea.STATE_GET),
e.battery_voltage().withAccess(ea.STATE_GET),
e.device_temperature(),
e.illuminance_lux(),
e.illuminance(),
e.action(['manual_open', 'manual_close']),
e.enum('motor_state', ea.STATE, ['stopped', 'opening', 'closing', 'pause']).withDescription('Motor state'),
e.binary('running', ea.STATE, true, false).withDescription('Whether the motor is moving or not'),
Expand Down Expand Up @@ -3015,7 +3004,7 @@ const definitions: DefinitionWithExtend[] = [
await reporting.illuminance(endpoint, {min: 15, max: constants.repInterval.HOUR, change: 500});
await endpoint.read('genPowerCfg', ['batteryVoltage']);
},
exposes: [e.battery(), e.battery_voltage(), e.illuminance().withAccess(ea.STATE_GET), e.illuminance_lux().withAccess(ea.STATE_GET)],
exposes: [e.battery(), e.battery_voltage(), e.illuminance().withAccess(ea.STATE_GET), e.illuminance().withAccess(ea.STATE_GET)],
},
{
zigbeeModel: ['lumi.light.acn128'],
Expand Down Expand Up @@ -3541,7 +3530,6 @@ const definitions: DefinitionWithExtend[] = [
e.battery(),
e.battery_voltage(),
e.illuminance(),
e.illuminance_lux(),
e
.numeric('detection_period', exposes.access.ALL)
.withValueMin(1)
Expand Down
2 changes: 1 addition & 1 deletion src/devices/moes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const definitions: DefinitionWithExtend[] = [
description: 'Smart temperature and humidity meter with display',
fromZigbee: [fz.battery, fz.illuminance, fz.humidity, fz.temperature],
toZigbee: [],
exposes: [e.battery(), e.illuminance(), e.illuminance_lux().withUnit('lx'), e.humidity(), e.temperature()],
exposes: [e.battery(), e.illuminance(), e.humidity(), e.temperature()],
},
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_b6wax7g0'}],
Expand Down
2 changes: 1 addition & 1 deletion src/devices/namron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@ const definitions: DefinitionWithExtend[] = [
description: 'Zigbee multisensor (white)',
fromZigbee: [fz.ias_occupancy_alarm_1, fz.battery, fz.temperature, fz.humidity, fz.illuminance],
toZigbee: [],
exposes: [e.occupancy(), e.battery(), e.battery_voltage(), e.illuminance(), e.illuminance_lux(), e.temperature(), e.humidity()],
exposes: [e.occupancy(), e.battery(), e.battery_voltage(), e.illuminance(), e.temperature(), e.humidity()],
whiteLabel: [{vendor: 'Namron', model: '4512771', description: 'Zigbee multisensor (black)', fingerprint: [{modelID: '4512771'}]}],
configure: async (device, coordinatorEndpoint) => {
const endpoint3 = device.getEndpoint(3);
Expand Down
2 changes: 1 addition & 1 deletion src/devices/owon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const definitions: DefinitionWithExtend[] = [
description: 'Motion sensor',
fromZigbee: [fz.battery, fz.ignore_basic_report, fz.ias_occupancy_alarm_1, fz.temperature, fz.humidity, fz.occupancy_timeout, fz.illuminance],
toZigbee: [],
exposes: [e.occupancy(), e.tamper(), e.battery_low(), e.illuminance(), e.illuminance_lux().withUnit('lx'), e.temperature(), e.humidity()],
exposes: [e.occupancy(), e.tamper(), e.battery_low(), e.illuminance(), e.temperature(), e.humidity()],
configure: async (device, coordinatorEndpoint) => {
const endpoint2 = device.getEndpoint(2);
const endpoint3 = device.getEndpoint(3);
Expand Down
4 changes: 0 additions & 4 deletions src/devices/philips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2404,7 +2404,6 @@ const definitions: DefinitionWithExtend[] = [
e.temperature(),
e.occupancy(),
e.battery(),
e.illuminance_lux(),
e.illuminance(),
e.motion_sensitivity_select(['low', 'medium', 'high']),
e.binary('led_indication', ea.ALL, true, false).withDescription('Blink green LED on motion detection'),
Expand Down Expand Up @@ -2446,7 +2445,6 @@ const definitions: DefinitionWithExtend[] = [
e.temperature(),
e.occupancy(),
e.battery(),
e.illuminance_lux(),
e.illuminance(),
e.enum('motion_sensitivity', ea.ALL, ['low', 'medium', 'high']),
e.binary('led_indication', ea.ALL, true, false).withDescription('Blink green LED on motion detection'),
Expand Down Expand Up @@ -2537,7 +2535,6 @@ const definitions: DefinitionWithExtend[] = [
e.temperature(),
e.occupancy(),
e.battery(),
e.illuminance_lux(),
e.illuminance(),
e.enum('motion_sensitivity', ea.ALL, ['low', 'medium', 'high', 'very_high', 'max']),
e.binary('led_indication', ea.ALL, true, false).withDescription('Blink green LED on motion detection'),
Expand Down Expand Up @@ -2575,7 +2572,6 @@ const definitions: DefinitionWithExtend[] = [
e.temperature(),
e.occupancy(),
e.battery(),
e.illuminance_lux(),
e.illuminance(),
e.enum('motion_sensitivity', ea.ALL, ['low', 'medium', 'high', 'very_high', 'max']),
e.binary('led_indication', ea.ALL, true, false).withDescription('Blink green LED on motion detection'),
Expand Down
3 changes: 1 addition & 2 deletions src/devices/schneider_electric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1561,7 +1561,6 @@ const definitions: DefinitionWithExtend[] = [
exposes: [
e.switch().withEndpoint('l1'),
e.occupancy(),
e.illuminance_lux(),
e.illuminance(),
e
.numeric('occupancy_timeout', ea.ALL)
Expand Down Expand Up @@ -1606,7 +1605,7 @@ const definitions: DefinitionWithExtend[] = [
await reporting.batteryPercentageRemaining(endpoint);
await reporting.illuminance(endpoint, {min: 15, max: constants.repInterval.HOUR, change: 500});
},
exposes: [e.battery(), e.illuminance(), e.illuminance_lux(), e.occupancy()],
exposes: [e.battery(), e.illuminance(), e.occupancy()],
},
{
zigbeeModel: ['CH/Socket/2'],
Expand Down
2 changes: 1 addition & 1 deletion src/devices/shinasystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ const definitions: DefinitionWithExtend[] = [
await reporting.humidity(endpoint, {min: 20, max: 300, change: 40});
await reporting.illuminance(endpoint, {min: 20, max: 3600, change: 10});
},
exposes: [e.battery(), e.battery_voltage(), e.temperature(), e.humidity(), e.occupancy(), e.illuminance_lux().withProperty('illuminance')],
exposes: [e.battery(), e.battery_voltage(), e.temperature(), e.humidity(), e.occupancy(), e.illuminance()],
},
{
zigbeeModel: ['SBM300Z1'],
Expand Down
Loading
Loading