mirror of
https://github.com/adrianjagielak/home-assistant-futurehome.git
synced 2025-09-13 15:47:08 +00:00
23 lines
791 B
TypeScript
23 lines
791 B
TypeScript
import { InclusionReportService } from "../fimp/inclusion_report";
|
|
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
import { ServiceComponentsCreationResult } from "../ha/publish_device";
|
|
|
|
export function sensor_rain__components(topicPrefix: string, vinculumDeviceData: VinculumPd7Device, svc: InclusionReportService): ServiceComponentsCreationResult {
|
|
if (!svc.address) { return { components: {} }; }
|
|
|
|
const device_class = 'precipitation_intensity';
|
|
const unit = svc.props?.sup_units?.[0] ?? 'mm/h';
|
|
|
|
return {
|
|
components: {
|
|
[svc.address]: {
|
|
unique_id: svc.address,
|
|
p: 'sensor',
|
|
device_class: device_class,
|
|
unit_of_measurement: unit,
|
|
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
|
},
|
|
}
|
|
};
|
|
}
|