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

feat: move manuSpecificIkeaAirPurifier to zhc #7614

Merged
merged 2 commits into from
Jun 8, 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
14 changes: 7 additions & 7 deletions src/devices/ikea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ import {
ikeaConfigureRemote, ikeaLight, ikeaOta, ikeaConfigureStyrbar,
ikeaBattery, ikeaAirPurifier, legacy as ikeaLegacy,
ikeaVoc, ikeaConfigureGenPollCtrl, tradfriOccupancy,
tradfriRequestedBrightness,
tradfriCommandsOnOff,
tradfriCommandsLevelCtrl,
styrbarCommandOn,
ikeaDotsClick,
ikeaArrowClick,
ikeaMediaCommands,
tradfriRequestedBrightness, tradfriCommandsOnOff,
tradfriCommandsLevelCtrl, styrbarCommandOn,
ikeaDotsClick, ikeaArrowClick, ikeaMediaCommands,
addCustomClusterManuSpecificIkeaAirPurifier,
addCustomClusterManuSpecificIkeaVocIndexMeasurement,
} from '../lib/ikea';

const definitions: Definition[] = [
Expand Down Expand Up @@ -732,6 +730,7 @@ const definitions: Definition[] = [
vendor: 'IKEA',
description: 'STARKVIND air purifier',
extend: [
addCustomClusterManuSpecificIkeaAirPurifier(),
ikeaAirPurifier(),
identify(),
ikeaOta(),
Expand Down Expand Up @@ -945,6 +944,7 @@ const definitions: Definition[] = [
description: 'VINDSTYRKA air quality and humidity sensor',
ota: ota.zigbeeOTA,
extend: [
addCustomClusterManuSpecificIkeaVocIndexMeasurement(),
deviceAddCustomCluster(
'pm25Measurement',
{
Expand Down
49 changes: 45 additions & 4 deletions src/lib/ikea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ import {
import {
LightArgs, light as lightDontUse, ota, ReportingConfigWithoutAttribute,
timeLookup, numeric, NumericArgs, setupConfigureForBinding,
setupConfigureForReporting,
setupConfigureForReporting, deviceAddCustomCluster,
} from '../lib/modernExtend';

import {tradfri as ikea} from '../lib/ota';

import tz from '../converters/toZigbee';
import * as constants from '../lib/constants';
import * as reporting from '../lib/reporting';
import * as globalStore from '../lib/store';
import * as zigbeeHerdsman from 'zigbee-herdsman/dist';
import {Zcl} from 'zigbee-herdsman';
import * as semver from 'semver';

export const manufacturerOptions = {manufacturerCode: zigbeeHerdsman.Zcl.ManufacturerCode.IKEA_OF_SWEDEN};
export const manufacturerOptions = {manufacturerCode: Zcl.ManufacturerCode.IKEA_OF_SWEDEN};

const bulbOnEvent: OnEvent = async (type, data, device, options, state: KeyValue) => {
/**
Expand Down Expand Up @@ -374,7 +375,7 @@ export function ikeaVoc(args?: Partial<NumericArgs>) {
return numeric({
name: 'voc_index',
label: 'VOC index',
cluster: 'msIkeaVocIndexMeasurement',
cluster: 'manuSpecificIkeaVocIndexMeasurement',
attribute: 'measuredValue',
reporting: {min: '1_MINUTE', max: '2_MINUTES', change: 1},
description: 'Sensirion VOC index',
Expand Down Expand Up @@ -666,6 +667,46 @@ export function ikeaMediaCommands(): ModernExtend {
return {exposes, fromZigbee, configure, isModernExtend: true};
}

export function addCustomClusterManuSpecificIkeaAirPurifier(): ModernExtend {
return deviceAddCustomCluster(
'manuSpecificIkeaAirPurifier',
{
ID: 0xfc7d,
manufacturerCode: Zcl.ManufacturerCode.IKEA_OF_SWEDEN,
attributes: {
filterRunTime: {ID: 0x0000, type: Zcl.DataType.UINT32},
replaceFilter: {ID: 0x0001, type: Zcl.DataType.UINT8},
filterLifeTime: {ID: 0x0002, type: Zcl.DataType.UINT32},
controlPanelLight: {ID: 0x0003, type: Zcl.DataType.BOOLEAN},
particulateMatter25Measurement: {ID: 0x0004, type: Zcl.DataType.UINT16},
childLock: {ID: 0x0005, type: Zcl.DataType.BOOLEAN},
fanMode: {ID: 0x0006, type: Zcl.DataType.UINT8},
fanSpeed: {ID: 0x0007, type: Zcl.DataType.UINT8},
deviceRunTime: {ID: 0x0008, type: Zcl.DataType.UINT32},
},
commands: {},
commandsResponse: {},
},
);
}

export function addCustomClusterManuSpecificIkeaVocIndexMeasurement(): ModernExtend {
return deviceAddCustomCluster(
'manuSpecificIkeaVocIndexMeasurement',
{
ID: 0xfc7e,
manufacturerCode: Zcl.ManufacturerCode.IKEA_OF_SWEDEN,
attributes: {
measuredValue: {ID: 0x0000, type: Zcl.DataType.SINGLE_PREC},
measuredMinValue: {ID: 0x0001, type: Zcl.DataType.SINGLE_PREC},
measuredMaxValue: {ID: 0x0002, type: Zcl.DataType.SINGLE_PREC},
},
commands: {},
commandsResponse: {},
},
);
}

export const legacy = {
fromZigbee: {
E1744_play_pause: {
Expand Down
Loading