mirror of
https://github.com/adrianjagielak/home-assistant-futurehome.git
synced 2025-10-12 07:22:06 -06:00
22 lines
710 B
TypeScript
22 lines
710 B
TypeScript
import { InclusionReportService } from "../fimp/inclusion_report";
|
|
import { VinculumPd7Device } from "../fimp/vinculum_pd7_device";
|
|
import { HaComponent } from "../ha/publish_device";
|
|
|
|
export function sensor_dew__components(vinculumDeviceData: VinculumPd7Device, svc: InclusionReportService): { [key: string]: HaComponent } {
|
|
if (!svc.address) { return {}; }
|
|
|
|
let unit = svc.props?.sup_units?.[0] ?? "°C";
|
|
if (unit === 'C') unit = '°C';
|
|
if (unit === 'F') unit = '°F';
|
|
|
|
return {
|
|
[svc.address]: {
|
|
unique_id: svc.address,
|
|
p: 'sensor',
|
|
device_class: 'temperature',
|
|
unit_of_measurement: unit,
|
|
value_template: `{{ value_json['${svc.address}'].sensor }}`,
|
|
},
|
|
};
|
|
}
|