mirror of
https://github.com/adrianjagielak/home-assistant-futurehome.git
synced 2025-09-13 15:47:08 +00:00
Do not query the adapter for inclusion report
This commit is contained in:
parent
adcde274e1
commit
8546610ffd
@ -1,3 +1,4 @@
|
|||||||
|
import { log } from "../logger";
|
||||||
import { sendFimpMsg } from "./fimp";
|
import { sendFimpMsg } from "./fimp";
|
||||||
|
|
||||||
export type InclusionReport = {
|
export type InclusionReport = {
|
||||||
@ -20,7 +21,8 @@ export type InclusionReportService = {
|
|||||||
props?: { [key: string]: any } | null
|
props?: { [key: string]: any } | null
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getInclusionReport(parameters: { adapterAddress: string; adapterService: string; deviceId: string }): Promise<InclusionReport> {
|
export async function getInclusionReport(parameters: { adapterAddress: string; adapterService: string; deviceId: string }): Promise<InclusionReport | undefined> {
|
||||||
|
try {
|
||||||
const inclusionReport = await sendFimpMsg({
|
const inclusionReport = await sendFimpMsg({
|
||||||
address: parameters.adapterAddress,
|
address: parameters.adapterAddress,
|
||||||
service: parameters.adapterService,
|
service: parameters.adapterService,
|
||||||
@ -30,4 +32,7 @@ export async function getInclusionReport(parameters: { adapterAddress: string; a
|
|||||||
});
|
});
|
||||||
|
|
||||||
return inclusionReport.val;
|
return inclusionReport.val;
|
||||||
|
} catch (e) {
|
||||||
|
log.error(`Failed getting inclusion report for adapterAddress: ${parameters.adapterAddress}, adapterService: ${parameters.adapterService}, deviceId: ${parameters.deviceId}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,32 @@
|
|||||||
export type VinculumPd7Device = {
|
export type VinculumPd7Device = {
|
||||||
client?: {
|
client?: {
|
||||||
// User-defined device name
|
// User-defined device name
|
||||||
name?: string | null,
|
name?: string | null;
|
||||||
} | null,
|
} | null;
|
||||||
id: number,
|
id: number;
|
||||||
services?: any,
|
// "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?: {
|
type?: {
|
||||||
// User-defined device type (e.g. "sensor", "chargepoint", or "light")
|
// 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")
|
// User-defined device subtype (e.g. "presence" or "car_charger")
|
||||||
subtype?: string | null,
|
subtype?: string | null;
|
||||||
} | 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;
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { InclusionReport, InclusionReportService } from "../fimp/inclusion_report";
|
import { InclusionReport, InclusionReportService } from "../fimp/inclusion_report";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { log } from "../logger";
|
import { log } from "../logger";
|
||||||
import { battery__components } from "../services/battery";
|
import { battery__components } from "../services/battery";
|
||||||
import { out_bin_switch__components } from "../services/out_bin_switch";
|
import { out_bin_switch__components } from "../services/out_bin_switch";
|
||||||
@ -148,7 +148,7 @@ export type ServiceComponentsCreationResult = {
|
|||||||
export type CommandHandlers = { [topic: string]: (payload: string) => Promise<void> }
|
export type CommandHandlers = { [topic: string]: (payload: string) => Promise<void> }
|
||||||
|
|
||||||
const serviceHandlers: {
|
const serviceHandlers: {
|
||||||
[name: string]: (topicPrefix: string, vinculumDeviceData: VinculumPd7Device, svc: InclusionReportService) => ServiceComponentsCreationResult | undefined
|
[name: string]: (topicPrefix: string, device: VinculumPd7Device, svc: VinculumPd7Service) => ServiceComponentsCreationResult | undefined
|
||||||
} = {
|
} = {
|
||||||
battery: battery__components,
|
battery: battery__components,
|
||||||
out_bin_switch: out_bin_switch__components,
|
out_bin_switch: out_bin_switch__components,
|
||||||
@ -195,23 +195,21 @@ const serviceHandlers: {
|
|||||||
sensor_weight: sensor_weight__components,
|
sensor_weight: sensor_weight__components,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function haPublishDevice(parameters: { hubId: string, vinculumDeviceData: VinculumPd7Device, deviceInclusionReport: InclusionReport }): { commandHandlers: CommandHandlers } {
|
export function haPublishDevice(parameters: { hubId: string, vinculumDeviceData: VinculumPd7Device, deviceInclusionReport: InclusionReport | undefined }): { commandHandlers: CommandHandlers } {
|
||||||
if (!parameters.deviceInclusionReport.services) {
|
|
||||||
return { commandHandlers: {} };
|
|
||||||
}
|
|
||||||
|
|
||||||
const components: { [key: string]: HaComponent } = {};
|
const components: { [key: string]: HaComponent } = {};
|
||||||
const handlers: CommandHandlers = {};
|
const handlers: CommandHandlers = {};
|
||||||
|
|
||||||
// e.g. "homeassistant/device/futurehome_123456_1"
|
// e.g. "homeassistant/device/futurehome_123456_1"
|
||||||
const topicPrefix = `homeassistant/device/futurehome_${parameters.hubId}_${parameters.deviceInclusionReport.address}`;
|
const topicPrefix = `homeassistant/device/futurehome_${parameters.hubId}_${parameters.vinculumDeviceData.id}`;
|
||||||
|
|
||||||
for (const svc of parameters.deviceInclusionReport.services) {
|
for (const [svcName, svc] of Object.entries(parameters.vinculumDeviceData.services ?? {})) {
|
||||||
if (!svc.name) { continue; }
|
if (!svcName) { continue; }
|
||||||
|
if (!svc.addr) { continue; }
|
||||||
|
if (!svc.enabled) { continue; }
|
||||||
|
|
||||||
const handler = serviceHandlers[svc.name];
|
const handler = serviceHandlers[svcName];
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
log.error(`No handler for service: ${svc.name}`);
|
log.error(`No handler for service: ${svcName}`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,16 +228,13 @@ export function haPublishDevice(parameters: { hubId: string, vinculumDeviceData:
|
|||||||
const availabilityTopic = `${topicPrefix}/availability`
|
const availabilityTopic = `${topicPrefix}/availability`
|
||||||
const config: HaDeviceConfig = {
|
const config: HaDeviceConfig = {
|
||||||
dev: {
|
dev: {
|
||||||
ids: parameters.deviceInclusionReport.address,
|
ids: parameters.vinculumDeviceData.id.toString(),
|
||||||
name:
|
name: parameters.vinculumDeviceData?.client?.name ?? parameters.vinculumDeviceData?.modelAlias ?? parameters.deviceInclusionReport?.product_name,
|
||||||
// User-defined device name
|
mf: parameters.deviceInclusionReport?.manufacturer_id,
|
||||||
parameters.vinculumDeviceData?.client?.name ??
|
mdl: parameters.vinculumDeviceData?.modelAlias ?? parameters.deviceInclusionReport?.product_id,
|
||||||
parameters.deviceInclusionReport.product_name,
|
sw: parameters.deviceInclusionReport?.sw_ver,
|
||||||
mf: parameters.deviceInclusionReport.manufacturer_id,
|
sn: parameters.deviceInclusionReport?.product_hash,
|
||||||
mdl: parameters.deviceInclusionReport.product_id,
|
hw: parameters.deviceInclusionReport?.hw_ver,
|
||||||
sw: parameters.deviceInclusionReport.sw_ver,
|
|
||||||
sn: parameters.deviceInclusionReport.product_hash,
|
|
||||||
hw: parameters.deviceInclusionReport.hw_ver,
|
|
||||||
},
|
},
|
||||||
o: {
|
o: {
|
||||||
name: 'futurehome',
|
name: 'futurehome',
|
||||||
|
@ -84,25 +84,31 @@ import { haUpdateAvailability } from "./ha/update_availability";
|
|||||||
|
|
||||||
const commandHandlers: CommandHandlers = {};
|
const commandHandlers: CommandHandlers = {};
|
||||||
for (const device of devices.val.param.device) {
|
for (const device of devices.val.param.device) {
|
||||||
|
try {
|
||||||
const vinculumDeviceData: VinculumPd7Device = device
|
const vinculumDeviceData: VinculumPd7Device = device
|
||||||
const deviceId = vinculumDeviceData.id.toString()
|
const deviceId = vinculumDeviceData.id.toString()
|
||||||
const services: { [key: string]: any } = vinculumDeviceData?.services
|
const firstServiceAddr = vinculumDeviceData.services ? Object.values(vinculumDeviceData.services)[0]?.addr : undefined;;
|
||||||
const firstServiceAddr = services ? Object.values(services)[0]?.addr : undefined;;
|
|
||||||
|
|
||||||
if (!firstServiceAddr) { continue; }
|
if (!firstServiceAddr) { continue; }
|
||||||
|
|
||||||
const adapterAddress = adapterAddressFromServiceAddress(firstServiceAddr)
|
// This is problematic when the adapter doesn't respond, so we are not getting the inclusion report for now. I'm leaving it here since we might want it in the future.
|
||||||
const adapterService = adapterServiceFromServiceAddress(firstServiceAddr)
|
// // Get additional metadata like manufacutrer or sw/hw version directly from the adapter
|
||||||
|
// const adapterAddress = adapterAddressFromServiceAddress(firstServiceAddr)
|
||||||
|
// const adapterService = adapterServiceFromServiceAddress(firstServiceAddr)
|
||||||
|
// const deviceInclusionReport = await getInclusionReport({ adapterAddress, adapterService, deviceId });
|
||||||
|
const deviceInclusionReport = undefined;
|
||||||
|
|
||||||
// Get additional metadata like manufacutrer or sw/hw version directly from the adapter
|
const result = haPublishDevice({ hubId, vinculumDeviceData, deviceInclusionReport });
|
||||||
const deviceInclusionReport = await getInclusionReport({ adapterAddress, adapterService, deviceId });
|
|
||||||
|
Object.assign(commandHandlers, result.commandHandlers);
|
||||||
|
|
||||||
if (!retainedMessages.some(msg => msg.topic === `homeassistant/device/futurehome_${hubId}_${deviceId}/availability`)) {
|
if (!retainedMessages.some(msg => msg.topic === `homeassistant/device/futurehome_${hubId}_${deviceId}/availability`)) {
|
||||||
// Set initial availability
|
// Set initial availability
|
||||||
haUpdateAvailability({ hubId, deviceAvailability: { address: deviceId, status: 'UP' } });
|
haUpdateAvailability({ hubId, deviceAvailability: { address: deviceId, status: 'UP' } });
|
||||||
}
|
}
|
||||||
const result = haPublishDevice({ hubId, vinculumDeviceData, deviceInclusionReport });
|
} catch (e) {
|
||||||
Object.assign(commandHandlers, result.commandHandlers);
|
log.error('Failed publishing device', device, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setHaCommandHandlers(commandHandlers);
|
setHaCommandHandlers(commandHandlers);
|
||||||
|
|
||||||
|
@ -1,37 +1,33 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
import { HaComponent, ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
|
||||||
|
|
||||||
export function battery__components(
|
export function battery__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
const components: Record<string, HaComponent> = {};
|
||||||
|
|
||||||
if (svc.props?.sup_events?.includes('low_battery')) {
|
if (svc.intf?.includes('evt.alarm.report')) {
|
||||||
return {
|
components[`${svc.addr}_alarm`] = {
|
||||||
components: {
|
unique_id: `${svc.addr}_alarm`,
|
||||||
[svc.address]: {
|
|
||||||
unique_id: svc.address,
|
|
||||||
p: 'binary_sensor',
|
p: 'binary_sensor',
|
||||||
device_class: 'battery',
|
device_class: 'battery',
|
||||||
value_template: `{{ (value_json['${svc.address}'].alarm.status == 'activ') | iif('ON', 'OFF') }}`,
|
value_template: `{{ (value_json['${svc.addr}'].alarm.status == 'activ') | iif('ON', 'OFF') }}`,
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return {
|
if (svc.intf?.includes('evt.lvl.report')) {
|
||||||
components: {
|
components[`${svc.addr}_lvl`] = {
|
||||||
[svc.address]: {
|
unique_id: `${svc.addr}_lvl`,
|
||||||
unique_id: svc.address,
|
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: 'battery',
|
device_class: 'battery',
|
||||||
unit_of_measurement: svc.props?.sup_units?.[0] ?? '%',
|
unit_of_measurement: svc.props?.sup_units?.[0] ?? '%',
|
||||||
value_template: `{{ value_json['${svc.address}'].lvl }}`,
|
value_template: `{{ value_json['${svc.addr}'].lvl }}`,
|
||||||
},
|
};
|
||||||
},
|
}
|
||||||
};
|
|
||||||
|
return {
|
||||||
|
components: components,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,28 @@
|
|||||||
import { sendFimpMsg } from "../fimp/fimp";
|
import { sendFimpMsg } from "../fimp/fimp";
|
||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function out_bin_switch__components(
|
export function out_bin_switch__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
const commandTopic = `${topicPrefix}${svc.addr}/command`;
|
||||||
|
|
||||||
const commandTopic = `${topicPrefix}${svc.address}/command`;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'switch',
|
p: 'switch',
|
||||||
command_topic: commandTopic,
|
command_topic: commandTopic,
|
||||||
optimistic: false,
|
optimistic: false,
|
||||||
value_template: `{{ (value_json['${svc.address}'].binary) | iif('ON', 'OFF') }}`,
|
value_template: `{{ (value_json['${svc.addr}'].binary) | iif('ON', 'OFF') }}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
commandHandlers: {
|
commandHandlers: {
|
||||||
[commandTopic]: async (payload: string) => {
|
[commandTopic]: async (payload: string) => {
|
||||||
await sendFimpMsg({
|
await sendFimpMsg({
|
||||||
address: svc.address!,
|
address: svc.addr!,
|
||||||
service: 'out_bin_switch',
|
service: 'out_bin_switch',
|
||||||
cmd: 'cmd.binary.set',
|
cmd: 'cmd.binary.set',
|
||||||
val: payload === 'ON',
|
val: payload === 'ON',
|
||||||
|
@ -1,31 +1,28 @@
|
|||||||
import { sendFimpMsg } from "../fimp/fimp";
|
import { sendFimpMsg } from "../fimp/fimp";
|
||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function out_lvl_switch__components(
|
export function out_lvl_switch__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
const commandTopic = `${topicPrefix}${svc.addr}/command`;
|
||||||
|
|
||||||
const commandTopic = `${topicPrefix}${svc.address}/command`;
|
|
||||||
|
|
||||||
const minLvl = svc.props?.min_lvl ?? 0;
|
const minLvl = svc.props?.min_lvl ?? 0;
|
||||||
const maxLvl = svc.props?.max_lvl ?? 100;
|
const maxLvl = svc.props?.max_lvl ?? 100;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: "number",
|
p: "number",
|
||||||
min: minLvl,
|
min: minLvl,
|
||||||
max: maxLvl,
|
max: maxLvl,
|
||||||
step: 1,
|
step: 1,
|
||||||
command_topic: commandTopic,
|
command_topic: commandTopic,
|
||||||
optimistic: false,
|
optimistic: false,
|
||||||
value_template: `{{ value_json['${svc.address}'].lvl }}`,
|
value_template: `{{ value_json['${svc.addr}'].lvl }}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -37,7 +34,7 @@ export function out_lvl_switch__components(
|
|||||||
}
|
}
|
||||||
|
|
||||||
await sendFimpMsg({
|
await sendFimpMsg({
|
||||||
address: svc.address!,
|
address: svc.addr!,
|
||||||
service: "out_lvl_switch",
|
service: "out_lvl_switch",
|
||||||
cmd: "cmd.lvl.set",
|
cmd: "cmd.lvl.set",
|
||||||
val: lvl,
|
val: lvl,
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_accelx__components(
|
export function sensor_accelx__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'm/s2';
|
const unit = svc.props?.sup_units?.[0] ?? 'm/s2';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_accely__components(
|
export function sensor_accely__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'm/s2';
|
const unit = svc.props?.sup_units?.[0] ?? 'm/s2';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_accelz__components(
|
export function sensor_accelz__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'm/s2';
|
const unit = svc.props?.sup_units?.[0] ?? 'm/s2';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_airflow__components(
|
export function sensor_airflow__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'm3/h';
|
const unit = svc.props?.sup_units?.[0] ?? 'm3/h';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_airq__components(
|
export function sensor_airq__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'aqi';
|
const device_class = 'aqi';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'pm25';
|
const unit = svc.props?.sup_units?.[0] ?? 'pm25';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_anglepos__components(
|
export function sensor_anglepos__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? '%';
|
const unit = svc.props?.sup_units?.[0] ?? '%';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_atmo__components(
|
export function sensor_atmo__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'atmospheric_pressure';
|
const device_class = 'atmospheric_pressure';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'kPa';
|
const unit = svc.props?.sup_units?.[0] ?? 'kPa';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_baro__components(
|
export function sensor_baro__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'atmospheric_pressure';
|
const device_class = 'atmospheric_pressure';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'kPa';
|
const unit = svc.props?.sup_units?.[0] ?? 'kPa';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_co__components(
|
export function sensor_co__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'carbon_monoxide';
|
const device_class = 'carbon_monoxide';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'mol/m3';
|
const unit = svc.props?.sup_units?.[0] ?? 'mol/m3';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_co2__components(
|
export function sensor_co2__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'carbon_dioxide';
|
const device_class = 'carbon_dioxide';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'ppm';
|
const unit = svc.props?.sup_units?.[0] ?? 'ppm';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_contact__components(
|
export function sensor_contact__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'opening'
|
const device_class = 'opening'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'binary_sensor',
|
p: 'binary_sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
value_template: `{{ value_json['${svc.address}'].open | iif('ON', 'OFF') }}`,
|
value_template: `{{ value_json['${svc.addr}'].open | iif('ON', 'OFF') }}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_current__components(
|
export function sensor_current__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'current';
|
const device_class = 'current';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'A';
|
const unit = svc.props?.sup_units?.[0] ?? 'A';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_dew__components(
|
export function sensor_dew__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'temperature'
|
const device_class = 'temperature'
|
||||||
let unit = svc.props?.sup_units?.[0] ?? "°C";
|
let unit = svc.props?.sup_units?.[0] ?? "°C";
|
||||||
if (unit === 'C') unit = '°C';
|
if (unit === 'C') unit = '°C';
|
||||||
@ -16,12 +13,12 @@ export function sensor_dew__components(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_direct__components(
|
export function sensor_direct__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'wind_direction';
|
const device_class = 'wind_direction';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? '°';
|
const unit = svc.props?.sup_units?.[0] ?? '°';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_distance__components(
|
export function sensor_distance__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'distance';
|
const device_class = 'distance';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'm';
|
const unit = svc.props?.sup_units?.[0] ?? 'm';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_elresist__components(
|
export function sensor_elresist__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'ohm/m';
|
const unit = svc.props?.sup_units?.[0] ?? 'ohm/m';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_freq__components(
|
export function sensor_freq__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'frequency';
|
const device_class = 'frequency';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'Hz';
|
const unit = svc.props?.sup_units?.[0] ?? 'Hz';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_gp__components(
|
export function sensor_gp__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? '%';
|
const unit = svc.props?.sup_units?.[0] ?? '%';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,26 +1,23 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_gust__components(
|
export function sensor_gust__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
let unit = svc.props?.sup_units?.[0] ?? 'km/h';
|
let unit = svc.props?.sup_units?.[0] ?? 'km/h';
|
||||||
if (unit === 'kph') unit = 'km/h'
|
if (unit === 'kph') unit = 'km/h'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_humid__components(
|
export function sensor_humid__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'humidity';
|
const device_class = 'humidity';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? '%';
|
const unit = svc.props?.sup_units?.[0] ?? '%';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_lumin__components(
|
export function sensor_lumin__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'illuminance';
|
const device_class = 'illuminance';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'Lux';
|
const unit = svc.props?.sup_units?.[0] ?? 'Lux';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_moist__components(
|
export function sensor_moist__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'moisture';
|
const device_class = 'moisture';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? '%';
|
const unit = svc.props?.sup_units?.[0] ?? '%';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_noise__components(
|
export function sensor_noise__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'sound_pressure';
|
const device_class = 'sound_pressure';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'dB';
|
const unit = svc.props?.sup_units?.[0] ?? 'dB';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_power__components(
|
export function sensor_power__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'power';
|
const device_class = 'power';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'W';
|
const unit = svc.props?.sup_units?.[0] ?? 'W';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_presence__components(
|
export function sensor_presence__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'occupancy'
|
const device_class = 'occupancy'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'binary_sensor',
|
p: 'binary_sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
value_template: `{{ value_json['${svc.address}'].presence | iif('ON', 'OFF') }}`,
|
value_template: `{{ value_json['${svc.addr}'].presence | iif('ON', 'OFF') }}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_rain__components(
|
export function sensor_rain__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'precipitation_intensity';
|
const device_class = 'precipitation_intensity';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'mm/h';
|
const unit = svc.props?.sup_units?.[0] ?? 'mm/h';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_rotation__components(
|
export function sensor_rotation__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'rpm';
|
const unit = svc.props?.sup_units?.[0] ?? 'rpm';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_seismicint__components(
|
export function sensor_seismicint__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'EMCRO';
|
const unit = svc.props?.sup_units?.[0] ?? 'EMCRO';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_seismicmag__components(
|
export function sensor_seismicmag__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'MB';
|
const unit = svc.props?.sup_units?.[0] ?? 'MB';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_solarrad__components(
|
export function sensor_solarrad__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'W/m2';
|
const unit = svc.props?.sup_units?.[0] ?? 'W/m2';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_tank__components(
|
export function sensor_tank__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'volume_storage';
|
const device_class = 'volume_storage';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'l';
|
const unit = svc.props?.sup_units?.[0] ?? 'l';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_temp__components(
|
export function sensor_temp__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'temperature'
|
const device_class = 'temperature'
|
||||||
let unit = svc.props?.sup_units?.[0] ?? "°C";
|
let unit = svc.props?.sup_units?.[0] ?? "°C";
|
||||||
if (unit === 'C') unit = '°C';
|
if (unit === 'C') unit = '°C';
|
||||||
@ -16,12 +13,12 @@ export function sensor_temp__components(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_tidelvl__components(
|
export function sensor_tidelvl__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'm';
|
const unit = svc.props?.sup_units?.[0] ?? 'm';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_uv__components(
|
export function sensor_uv__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'index';
|
const unit = svc.props?.sup_units?.[0] ?? 'index';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_veloc__components(
|
export function sensor_veloc__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = undefined;
|
const device_class = undefined;
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'm/2';
|
const unit = svc.props?.sup_units?.[0] ?? 'm/2';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_voltage__components(
|
export function sensor_voltage__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'voltage';
|
const device_class = 'voltage';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'V';
|
const unit = svc.props?.sup_units?.[0] ?? 'V';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_watflow__components(
|
export function sensor_watflow__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'volume_flow_rate';
|
const device_class = 'volume_flow_rate';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'l/h';
|
const unit = svc.props?.sup_units?.[0] ?? 'l/h';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_watpressure__components(
|
export function sensor_watpressure__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'pressure';
|
const device_class = 'pressure';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'kPa';
|
const unit = svc.props?.sup_units?.[0] ?? 'kPa';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_wattemp__components(
|
export function sensor_wattemp__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'temperature';
|
const device_class = 'temperature';
|
||||||
let unit = svc.props?.sup_units?.[0] ?? "°C";
|
let unit = svc.props?.sup_units?.[0] ?? "°C";
|
||||||
if (unit === 'C') unit = '°C';
|
if (unit === 'C') unit = '°C';
|
||||||
@ -16,12 +13,12 @@ export function sensor_wattemp__components(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_weight__components(
|
export function sensor_weight__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'weight';
|
const device_class = 'weight';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'kg';
|
const unit = svc.props?.sup_units?.[0] ?? 'kg';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
import { InclusionReportService } from "../fimp/inclusion_report";
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
||||||
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
||||||
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
||||||
|
|
||||||
export function sensor_wind__components(
|
export function sensor_wind__components(
|
||||||
topicPrefix: string,
|
topicPrefix: string,
|
||||||
vinculumDeviceData: VinculumPd7Device,
|
device: VinculumPd7Device,
|
||||||
svc: InclusionReportService
|
svc: VinculumPd7Service
|
||||||
): ServiceComponentsCreationResult | undefined {
|
): ServiceComponentsCreationResult | undefined {
|
||||||
if (!svc.address) { return; }
|
|
||||||
|
|
||||||
const device_class = 'wind_speed';
|
const device_class = 'wind_speed';
|
||||||
const unit = svc.props?.sup_units?.[0] ?? 'km/h';
|
const unit = svc.props?.sup_units?.[0] ?? 'km/h';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
[svc.address]: {
|
[svc.addr]: {
|
||||||
unique_id: svc.address,
|
unique_id: svc.addr,
|
||||||
p: 'sensor',
|
p: 'sensor',
|
||||||
device_class: device_class,
|
device_class: device_class,
|
||||||
unit_of_measurement: unit,
|
unit_of_measurement: unit,
|
||||||
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user