Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 8 additions & 0 deletions src/devices/heiman.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import * as fz from "../converters/fromZigbee";
import * as tz from "../converters/toZigbee";
import * as constants from "../lib/constants";
import * as exposes from "../lib/exposes";
import {
addCustomClusterHeimanSpecificAirQuality,
addCustomClusterHeimanSpecificInfraRedRemote,
addCustomClusterHeimanSpecificScenes,
} from "../lib/heiman";
import * as m from "../lib/modernExtend";
import * as reporting from "../lib/reporting";
import * as tuya from "../lib/tuya";
Expand Down Expand Up @@ -672,6 +677,7 @@ export const definitions: DefinitionWithExtend[] = [
model: "HS2SS",
vendor: "Heiman",
description: "Smart scene switch",
extend: [addCustomClusterHeimanSpecificScenes()],
fromZigbee: [fz.battery, fz.heiman_scenes],
exposes: [e.battery(), e.action(["cinema", "at_home", "sleep", "go_out", "repast"])],
toZigbee: [],
Expand Down Expand Up @@ -793,6 +799,7 @@ export const definitions: DefinitionWithExtend[] = [
model: "HS2AQ-EM",
vendor: "Heiman",
description: "Air quality monitor",
extend: [addCustomClusterHeimanSpecificAirQuality()],
fromZigbee: [fz.battery, fz.temperature, fz.humidity, fz.pm25, fz.heiman_hcho, fz.heiman_air_quality],
toZigbee: [],
configure: async (device, coordinatorEndpoint) => {
Expand Down Expand Up @@ -891,6 +898,7 @@ export const definitions: DefinitionWithExtend[] = [
model: "HS2IRC",
vendor: "Heiman",
description: "Smart IR Control",
extend: [addCustomClusterHeimanSpecificInfraRedRemote()],
fromZigbee: [fz.battery, fz.heiman_ir_remote],
toZigbee: [tz.heiman_ir_remote],
exposes: [e.battery()],
Expand Down
164 changes: 164 additions & 0 deletions src/lib/heiman.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import {Zcl} from "zigbee-herdsman";

import * as m from "../lib/modernExtend";
import type {ModernExtend} from "../lib/types";

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

export function addCustomClusterHeimanSpecificAirQuality(): ModernExtend {
return m.deviceAddCustomCluster("heimanSpecificAirQuality", {
...manufacturerOptions,
// from HS2AQ-3.0海曼智能空气质量检测仪API文档-V01
ID: 0xfc81,
attributes: {
language: {ID: 0xf000, type: Zcl.DataType.UINT8},
unitOfMeasure: {ID: 0xf001, type: Zcl.DataType.UINT8},
// (0 is not charged, 1 is charging, 2 is fully charged)
batteryState: {ID: 0xf002, type: Zcl.DataType.UINT8},
pm10measuredValue: {ID: 0xf003, type: Zcl.DataType.UINT16},
tvocMeasuredValue: {ID: 0xf004, type: Zcl.DataType.UINT16},
aqiMeasuredValue: {ID: 0xf005, type: Zcl.DataType.UINT16},
temperatureMeasuredMax: {ID: 0xf006, type: Zcl.DataType.INT16},
temperatureMeasuredMin: {ID: 0xf007, type: Zcl.DataType.INT16},
humidityMeasuredMax: {ID: 0xf008, type: Zcl.DataType.UINT16},
humidityMeasuredMin: {ID: 0xf009, type: Zcl.DataType.UINT16},
alarmEnable: {ID: 0xf00a, type: Zcl.DataType.UINT16},
},
commands: {
setLanguage: {
ID: 0x011b,
parameters: [
// (1: English 0: Chinese)
{name: "languageCode", type: Zcl.DataType.UINT8},
],
},
setUnitOfTemperature: {
ID: 0x011c,
parameters: [
// (0: ℉ 1: ℃)
{name: "unitsCode", type: Zcl.DataType.UINT8},
],
},
getTime: {
ID: 0x011d,
parameters: [],
},
},
commandsResponse: {},
});
}

export function addCustomClusterHeimanSpecificScenes(): ModernExtend {
return m.deviceAddCustomCluster("heimanSpecificScenes", {
...manufacturerOptions,
// from HS2SS-3.0海曼智能情景开关API文档-V01
ID: 0xfc80,
manufacturerCode: ManufacturerCode.HEIMAN_TECHNOLOGY_CO_LTD,

Check failure on line 56 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'ManufacturerCode'.
attributes: {},
commands: {
cinema: {
ID: 0xf0,
parameters: [],
},
atHome: {
ID: 0xf1,
parameters: [],
},
sleep: {
ID: 0xf2,
parameters: [],
},
goOut: {
ID: 0xf3,
parameters: [],
},
repast: {
ID: 0xf4,
parameters: [],
},
},
commandsResponse: {},
});
}

export function addCustomClusterHeimanSpecificInfraRedRemote(): ModernExtend {
return m.deviceAddCustomCluster("heimanSpecificInfraRedRemote", {
...manufacturerOptions,
// from HS2IRC-3.0海曼智能红外转发控制器API-V01文档
ID: 0xfc82,
manufacturerCode: ManufacturerCode.HEIMAN_TECHNOLOGY_CO_LTD,

Check failure on line 89 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'ManufacturerCode'.
attributes: {},
commands: {
sendKey: {
ID: 0xf0,
parameters: [
{name: "id", type: DataType.UINT8},

Check failure on line 95 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'DataType'.
{name: "keyCode", type: DataType.UINT8},

Check failure on line 96 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'DataType'.
],
},
studyKey: {
// Total we can have 30 keycode for each device ID (1..30).
ID: 0xf1,
// response: 0xf2,
parameters: [
{name: "id", type: DataType.UINT8},

Check failure on line 104 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'DataType'.
{name: "keyCode", type: DataType.UINT8},

Check failure on line 105 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'DataType'.
],
},
deleteKey: {
ID: 0xf3,
parameters: [
// 1-15 - Delete specific ID, >= 16 - Delete All
{name: "id", type: DataType.UINT8},

Check failure on line 112 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'DataType'.
// 1-30 - Delete specific keycode, >= 31 - Delete All keycodes for the ID
{name: "keyCode", type: DataType.UINT8},

Check failure on line 114 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'DataType'.
],
},
createId: {
// Total we can have 15 device IDs (1..15).
ID: 0xf4,
// response: 0xf5,
parameters: [{name: "modelType", type: DataType.UINT8}],

Check failure on line 121 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'DataType'.
},
getIdAndKeyCodeList: {
ID: 0xf6,
// response: 0xf7,
parameters: [],
},
},
commandsResponse: {
studyKeyRsp: {
ID: 0xf2,
parameters: [
{name: "id", type: DataType.UINT8},

Check failure on line 133 in src/lib/heiman.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find name 'DataType'.
{name: "keyCode", type: DataType.UINT8},
{name: "result", type: DataType.UINT8}, // 0 - success, 1 - fail
],
},
createIdRsp: {
ID: 0xf5,
parameters: [
{name: "id", type: DataType.UINT8}, // 0xFF - create failed
{name: "modelType", type: DataType.UINT8},
],
},
getIdAndKeyCodeListRsp: {
ID: 0xf7,
parameters: [
{name: "packetsTotal", type: DataType.UINT8},
{name: "packetNumber", type: DataType.UINT8},
{name: "packetLength", type: DataType.UINT8}, // Max length is 70 bytes
// HELP for learnedDevicesList data structure:
// struct structPacketPayload {
// uint8_t ID;
// uint8_t ModeType;
// uint8_t KeyNum;
// uint8_t KeyCode[KeyNum];
// } arayPacketPayload[CurentPacketLenght];
// }
{name: "learnedDevicesList", type: BuffaloZclDataType.LIST_UINT8},
],
},
},
});
}