2025-07-24 16:34:58 +02:00
|
|
|
import {
|
|
|
|
VinculumPd7Device,
|
|
|
|
VinculumPd7Service,
|
|
|
|
} from '../fimp/vinculum_pd7_device';
|
|
|
|
import { ServiceComponentsCreationResult } from '../ha/publish_device';
|
2025-07-22 23:21:34 +02:00
|
|
|
|
2025-07-23 16:26:41 +02:00
|
|
|
export function sensor_presence__components(
|
|
|
|
topicPrefix: string,
|
2025-07-23 20:24:14 +02:00
|
|
|
device: VinculumPd7Device,
|
2025-07-24 16:34:58 +02:00
|
|
|
svc: VinculumPd7Service,
|
2025-07-26 02:38:22 +02:00
|
|
|
_svcName: string,
|
2025-07-23 16:26:41 +02:00
|
|
|
): ServiceComponentsCreationResult | undefined {
|
2025-07-24 16:34:58 +02:00
|
|
|
const device_class = 'occupancy';
|
2025-07-22 23:21:34 +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: 'binary_sensor',
|
2025-07-23 15:34:22 +02:00
|
|
|
device_class: device_class,
|
2025-07-23 20:24:14 +02:00
|
|
|
value_template: `{{ value_json['${svc.addr}'].presence | iif('ON', 'OFF') }}`,
|
2025-07-23 15:34:22 +02:00
|
|
|
},
|
2025-07-22 23:21:34 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|