2025-07-23 00:45:21 +02:00
|
|
|
import { InclusionReportService } from "../fimp/inclusion_report";
|
|
|
|
import { VinculumPd7Device } 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_solarrad__components(
|
|
|
|
topicPrefix: string,
|
|
|
|
vinculumDeviceData: VinculumPd7Device,
|
|
|
|
svc: InclusionReportService
|
|
|
|
): ServiceComponentsCreationResult | undefined {
|
|
|
|
if (!svc.address) { return; }
|
2025-07-23 15:34:22 +02:00
|
|
|
|
|
|
|
const device_class = undefined;
|
|
|
|
const unit = svc.props?.sup_units?.[0] ?? 'W/m2';
|
2025-07-23 00:45:21 +02:00
|
|
|
|
|
|
|
return {
|
2025-07-23 15:34:22 +02:00
|
|
|
components: {
|
|
|
|
[svc.address]: {
|
|
|
|
unique_id: svc.address,
|
|
|
|
p: 'sensor',
|
|
|
|
device_class: device_class,
|
|
|
|
unit_of_measurement: unit,
|
|
|
|
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
|
|
|
},
|
|
|
|
}
|
2025-07-23 00:45:21 +02:00
|
|
|
};
|
|
|
|
}
|