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

device_support(Heiman): add HS8OS #7423

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
31 changes: 30 additions & 1 deletion src/devices/heiman.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import * as reporting from '../lib/reporting';
import {Definition, Zh, Reporting} from '../lib/types';
const e = exposes.presets;
const ea = exposes.access;
import {light, battery, iasZoneAlarm} from '../lib/modernExtend';
import {Zcl} from 'zigbee-herdsman';

import {light, battery, iasZoneAlarm, illuminance, occupancy, identify, ota, numeric} from '../lib/modernExtend';
import * as tuya from '../lib/tuya';

const definitions: Definition[] = [
Expand Down Expand Up @@ -771,6 +773,33 @@ const definitions: Definition[] = [
iasZoneAlarm({zoneType: 'occupancy', zoneAttributes: ['alarm_1', 'tamper', 'battery_low']}),
],
},
{
zigbeeModel: ['HS8OS-N-3.0', 'HS8OS-EM-3.0', 'HS8OS-EF-3.0', 'HS8OS-EF1-3.0', 'HS8OS-EF2-3.0'],
model: 'HS8OS',
vendor: 'HEIMAN',
description: 'Ceiling embedded occupancy sensor',
extend: [
illuminance(),
occupancy({ultrasonicConfig: ['otu_delay']}),
identify(),
numeric({
name: 'illuminance_threshold',
cluster: 'msIlluminanceMeasurement',
attribute: {ID: 0xf000, type: Zcl.DataType.INT16},
description: 'Controls illuminance threshold for sending commands',
valueMin: 0,
valueMax: 1000,
unit: 'lx',
entityCategory: 'config',
read: true,
zigbeeCommandOptions: {manufacturerCode: Zcl.ManufacturerCode.HEIMAN_TECHNOLOGY_CO_LTD},
}),
// radar settings (?)
// diagnostics
// illuminance SensorStatus
ota(),
],
},
];

export default definitions;
Expand Down
15 changes: 9 additions & 6 deletions src/lib/modernExtend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ export function occupancy(args?: OccupancyArgs): ModernExtend {
}

if (args.ultrasonicConfig) {
if (args.pirConfig.includes('otu_delay')) {
if (args.ultrasonicConfig.includes('otu_delay')) {
settingsExtends.push(
numeric({
name: 'ultrasonic_otu_delay',
Expand All @@ -788,7 +788,7 @@ export function occupancy(args?: OccupancyArgs): ModernExtend {
);
attributesForReading.push('ultrasonicOToUDelay');
}
if (args.pirConfig.includes('uto_delay')) {
if (args.ultrasonicConfig.includes('uto_delay')) {
settingsExtends.push(
numeric({
name: 'ultrasonic_uto_delay',
Expand All @@ -800,7 +800,7 @@ export function occupancy(args?: OccupancyArgs): ModernExtend {
);
attributesForReading.push('ultrasonicUToODelay');
}
if (args.pirConfig.includes('uto_threshold')) {
if (args.ultrasonicConfig.includes('uto_threshold')) {
settingsExtends.push(
numeric({
name: 'ultrasonic_uto_threshold',
Expand All @@ -815,7 +815,7 @@ export function occupancy(args?: OccupancyArgs): ModernExtend {
}

if (args.contactConfig) {
if (args.pirConfig.includes('otu_delay')) {
if (args.contactConfig.includes('otu_delay')) {
settingsExtends.push(
numeric({
name: 'contact_otu_delay',
Expand All @@ -827,7 +827,7 @@ export function occupancy(args?: OccupancyArgs): ModernExtend {
);
attributesForReading.push('contactOToUDelay');
}
if (args.pirConfig.includes('uto_delay')) {
if (args.contactConfig.includes('uto_delay')) {
settingsExtends.push(
numeric({
name: 'contact_uto_delay',
Expand All @@ -839,7 +839,7 @@ export function occupancy(args?: OccupancyArgs): ModernExtend {
);
attributesForReading.push('contactUToODelay');
}
if (args.pirConfig.includes('uto_threshold')) {
if (args.contactConfig.includes('uto_threshold')) {
settingsExtends.push(
numeric({
name: 'contact_uto_threshold',
Expand Down Expand Up @@ -1806,6 +1806,7 @@ export interface NumericArgs {
label?: string;
entityCategory?: 'config' | 'diagnostic';
precision?: number;
read?: boolean;
}
export function numeric(args: NumericArgs): ModernExtend {
const {
Expand Down Expand Up @@ -1909,6 +1910,8 @@ export function numeric(args: NumericArgs): ModernExtend {

const configure: Configure[] = [setupConfigureForReporting(cluster, attribute, reporting, access, endpoints)];

if (args.read) configure.push(setupConfigureForReading(cluster.toString(), [attributeKey], endpoints));

return {exposes, fromZigbee, toZigbee, configure, isModernExtend: true};
}

Expand Down
Loading