Do not query the adapter for inclusion report

This commit is contained in:
Adrian Jagielak
2025-07-23 20:24:14 +02:00
parent adcde274e1
commit 8546610ffd
48 changed files with 363 additions and 472 deletions

View File

@@ -1,3 +1,4 @@
import { log } from "../logger";
import { sendFimpMsg } from "./fimp";
export type InclusionReport = {
@@ -20,14 +21,18 @@ export type InclusionReportService = {
props?: { [key: string]: any } | null
};
export async function getInclusionReport(parameters: { adapterAddress: string; adapterService: string; deviceId: string }): Promise<InclusionReport> {
const inclusionReport = await sendFimpMsg({
address: parameters.adapterAddress,
service: parameters.adapterService,
cmd: 'cmd.thing.get_inclusion_report',
val: parameters.deviceId,
val_t: 'string',
});
export async function getInclusionReport(parameters: { adapterAddress: string; adapterService: string; deviceId: string }): Promise<InclusionReport | undefined> {
try {
const inclusionReport = await sendFimpMsg({
address: parameters.adapterAddress,
service: parameters.adapterService,
cmd: 'cmd.thing.get_inclusion_report',
val: parameters.deviceId,
val_t: 'string',
});
return inclusionReport.val;
return inclusionReport.val;
} catch (e) {
log.error(`Failed getting inclusion report for adapterAddress: ${parameters.adapterAddress}, adapterService: ${parameters.adapterService}, deviceId: ${parameters.deviceId}`)
}
}

View File

@@ -1,14 +1,32 @@
export type VinculumPd7Device = {
client?: {
// User-defined device name
name?: string | null,
} | null,
id: number,
services?: any,
name?: string | null;
} | null;
id: number;
// "Model", e.g. "zb - _TZ3040_bb6xaihh - TS0202"
model?: string | null;
// "Model alias", e.g. "TS0202"
modelAlias?: string | null;
functionality?: 'appliance' | 'climate' | 'energy' | 'ev_charger' | 'lighting' | 'media' | 'other' | 'power' | 'safety' | 'security' | 'shading' | string | null,
services?: Record<string, VinculumPd7Service> | null;
type?: {
// User-defined device type (e.g. "sensor", "chargepoint", or "light")
type?: string | null,
type?: string | null;
// User-defined device subtype (e.g. "presence" or "car_charger")
subtype?: string | null,
} | null,
subtype?: string | null;
} | null;
};
export type VinculumPd7Service = {
// Address of the service, e.g. "/rt:dev/rn:zigbee/ad:1/sv:color_ctrl/ad:3_1"
addr: string;
// Whether the service is enabled or not.
enabled?: boolean | null;
// Interfaces exposed by the service, e.g. ['cmd.meter.get_report','evt.meter.report'].
intf?: string[] | null;
// Properties of the service, e.g. ['sup_units'] or ['sup_modes','sup_setpoints','sup_temperatures'].
props?: {
[key: string]: any;
} | null;
};