21 lines
680 B
TypeScript
Raw Normal View History

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-23 13:06:54 +02:00
export function sensor_wind__components(vinculumDeviceData: VinculumPd7Device, svc: InclusionReportService): { [key: string]: HaComponent } {
if (!svc.address) { return {}; }
let unit = svc.props?.sup_units?.[0] ?? "km/h";
if (unit === 'kph') unit = 'km/h';
return {
[svc.address]: {
2025-07-23 13:50:33 +02:00
unique_id: svc.address,
p: 'sensor',
device_class: 'wind_speed',
unit_of_measurement: unit,
value_template: `{{ value_json['${svc.address}'].sensor }}`,
},
};
}