2025-07-22 23:21:34 +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-22 23:21:34 +02:00
|
|
|
|
2025-07-23 13:06:54 +02:00
|
|
|
export function sensor_presence__components(vinculumDeviceData: VinculumPd7Device, svc: InclusionReportService): { [key: string]: HaComponent } {
|
2025-07-22 23:21:34 +02:00
|
|
|
if (!svc.address) { return {}; }
|
|
|
|
|
|
|
|
return {
|
|
|
|
[svc.address]: {
|
|
|
|
unique_id: svc.address,
|
2025-07-23 13:50:33 +02:00
|
|
|
p: 'binary_sensor',
|
2025-07-23 14:05:44 +02:00
|
|
|
device_class: 'occupancy',
|
2025-07-23 13:50:33 +02:00
|
|
|
value_template: `{{ value_json['${svc.address}'].presence | iif('ON', 'OFF') }}`,
|
2025-07-22 23:21:34 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|