Add extracting device manufacturer name

This commit is contained in:
Adrian Jagielak 2025-07-25 01:04:46 +02:00
parent 58e22e941f
commit 0f103dcb8e
No known key found for this signature in database
GPG Key ID: 0818CF7AF6C62BFB
3 changed files with 14 additions and 6 deletions

View File

@ -10,6 +10,7 @@
- Added support for 'barrier_ctrl' service (devices like garage doors, barriers, and window shades). - Added support for 'barrier_ctrl' service (devices like garage doors, barriers, and window shades).
- Added support for 'water_heater' service (devices such as water boiler or a water tank). - Added support for 'water_heater' service (devices such as water boiler or a water tank).
- Updated demo mode data. - Updated demo mode data.
- Added extracting device manufacturer name.
# 0.1.0 (24.07.2025) # 0.1.0 (24.07.2025)

View File

@ -4,9 +4,10 @@ export type VinculumPd7Device = {
name?: string | null; name?: string | null;
} | null; } | null;
id: number; id: number;
// "Model", e.g. "zb - _TZ3040_bb6xaihh - TS0202" // "Model" string, e.g. "zb - _TZ3040_bb6xaihh - TS0202"
// The first one is the adapter, the second one is the manufacturer, the third one is the device model.
model?: string | null; model?: string | null;
// "Model alias", e.g. "TS0202" // Device model, e.g. "TS0202"
modelAlias?: string | null; modelAlias?: string | null;
functionality?: functionality?:
| 'appliance' | 'appliance'

View File

@ -259,12 +259,16 @@ export function haPublishDevice(parameters: {
if (parameters.demoMode) { if (parameters.demoMode) {
// Apply optimistic override // Apply optimistic override
for (const component of Object.values(components)) { for (const component of Object.values(components)) {
if ((component as any).optimistic === false) { (component as any).optimistic = true;
(component as any).optimistic = true;
}
} }
} }
let vinculumManufacturer: string | undefined;
const parts = (parameters.vinculumDeviceData?.model ?? '').split(' - ');
if (parts.length === 3) {
vinculumManufacturer = parts[1];
}
const configTopic = `${topicPrefix}/config`; const configTopic = `${topicPrefix}/config`;
const stateTopic = `${topicPrefix}/state`; const stateTopic = `${topicPrefix}/state`;
const availabilityTopic = `${topicPrefix}/availability`; const availabilityTopic = `${topicPrefix}/availability`;
@ -277,7 +281,9 @@ export function haPublishDevice(parameters: {
parameters.deviceInclusionReport?.product_name ?? parameters.deviceInclusionReport?.product_name ??
undefined, undefined,
manufacturer: manufacturer:
parameters.deviceInclusionReport?.manufacturer_id ?? undefined, vinculumManufacturer ??
parameters.deviceInclusionReport?.manufacturer_id ??
undefined,
model: model:
parameters.vinculumDeviceData?.modelAlias ?? parameters.vinculumDeviceData?.modelAlias ??
parameters.deviceInclusionReport?.product_id ?? parameters.deviceInclusionReport?.product_id ??