2025-07-23 00:45:21 +02:00
|
|
|
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 00:45:21 +02:00
|
|
|
|
2025-07-23 13:06:54 +02:00
|
|
|
export function sensor_wind__components(vinculumDeviceData: VinculumPd7Device, svc: InclusionReportService): { [key: string]: HaComponent } {
|
2025-07-23 00:45:21 +02:00
|
|
|
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',
|
2025-07-23 00:45:21 +02:00
|
|
|
unit_of_measurement: unit,
|
|
|
|
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|