mirror of
https://github.com/adrianjagielak/home-assistant-futurehome.git
synced 2025-09-13 07:37:09 +00:00
29 lines
731 B
TypeScript
29 lines
731 B
TypeScript
import {
|
|
VinculumPd7Device,
|
|
VinculumPd7Service,
|
|
} from '../fimp/vinculum_pd7_device';
|
|
import { ServiceComponentsCreationResult } from '../ha/publish_device';
|
|
|
|
export function sensor_current__components(
|
|
topicPrefix: string,
|
|
device: VinculumPd7Device,
|
|
svc: VinculumPd7Service,
|
|
): ServiceComponentsCreationResult | undefined {
|
|
const device_class = 'current';
|
|
const name = undefined;
|
|
const unit = svc.props?.sup_units?.[0] ?? 'A';
|
|
|
|
return {
|
|
components: {
|
|
[svc.addr]: {
|
|
unique_id: svc.addr,
|
|
platform: 'sensor',
|
|
name: name,
|
|
device_class: device_class,
|
|
unit_of_measurement: unit,
|
|
value_template: `{{ value_json['${svc.addr}'].sensor }}`,
|
|
},
|
|
},
|
|
};
|
|
}
|