30 lines
759 B
TypeScript
Raw Normal View History

2025-07-24 16:34:58 +02:00
import {
VinculumPd7Device,
VinculumPd7Service,
} from '../fimp/vinculum_pd7_device';
import { ServiceComponentsCreationResult } from '../ha/publish_device';
export function sensor_co__components(
topicPrefix: string,
device: VinculumPd7Device,
2025-07-24 16:34:58 +02:00
svc: VinculumPd7Service,
2025-07-26 02:38:22 +02:00
_svcName: string,
): ServiceComponentsCreationResult | undefined {
const device_class = 'carbon_monoxide';
2025-07-25 14:38:10 +02:00
const name = undefined;
const unit = svc.props?.sup_units?.[0] ?? 'mol/m3';
return {
components: {
[svc.addr]: {
unique_id: svc.addr,
platform: 'sensor',
2025-07-25 14:38:10 +02:00
name: name,
device_class: device_class,
unit_of_measurement: unit,
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
},
2025-07-24 16:34:58 +02:00
},
};
}