2025-07-23 00:45:21 +02:00
|
|
|
import { InclusionReportService } from "../fimp/inclusion_report";
|
|
|
|
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
2025-07-23 13:06:54 +02:00
|
|
|
import { HaComponent } from "../ha/publish_device";
|
2025-07-23 00:45:21 +02:00
|
|
|
|
2025-07-23 13:06:54 +02:00
|
|
|
export function sensor_co__components(vinculumDeviceData: VinculumPd7Device, svc: InclusionReportService): { [key: string]: HaComponent } {
|
2025-07-23 00:45:21 +02:00
|
|
|
if (!svc.address) { return {}; }
|
|
|
|
|
|
|
|
return {
|
|
|
|
[svc.address]: {
|
|
|
|
unique_id: svc.address,
|
2025-07-23 13:50:33 +02:00
|
|
|
p: 'sensor',
|
|
|
|
device_class: 'carbon_monoxide',
|
|
|
|
unit_of_measurement: svc.props?.sup_units?.[0] ?? 'mol/m3',
|
|
|
|
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
2025-07-23 00:45:21 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|