2025-07-23 20:24:14 +02:00
|
|
|
import { VinculumPd7Device, VinculumPd7Service } from "../fimp/vinculum_pd7_device";
|
2025-07-23 15:34:22 +02:00
|
|
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
2025-07-23 00:45:21 +02:00
|
|
|
|
2025-07-23 16:26:41 +02:00
|
|
|
export function sensor_uv__components(
|
|
|
|
topicPrefix: string,
|
2025-07-23 20:24:14 +02:00
|
|
|
device: VinculumPd7Device,
|
|
|
|
svc: VinculumPd7Service
|
2025-07-23 16:26:41 +02:00
|
|
|
): ServiceComponentsCreationResult | undefined {
|
2025-07-23 15:34:22 +02:00
|
|
|
const device_class = undefined;
|
|
|
|
const unit = svc.props?.sup_units?.[0] ?? 'index';
|
2025-07-23 00:45:21 +02:00
|
|
|
|
|
|
|
return {
|
2025-07-23 15:34:22 +02:00
|
|
|
components: {
|
2025-07-23 20:24:14 +02:00
|
|
|
[svc.addr]: {
|
|
|
|
unique_id: svc.addr,
|
2025-07-24 15:54:47 +02:00
|
|
|
platform: 'sensor',
|
2025-07-23 15:34:22 +02:00
|
|
|
device_class: device_class,
|
|
|
|
unit_of_measurement: unit,
|
2025-07-23 20:24:14 +02:00
|
|
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
2025-07-23 15:34:22 +02:00
|
|
|
},
|
|
|
|
}
|
2025-07-23 00:45:21 +02:00
|
|
|
};
|
|
|
|
}
|