Attributes
BaseAttribute
export interface BaseAttribute {
// The unique key for this attribute. This should be unique per device.
key: string;
// The type of device this attribute belongs to.
type: DeviceType;
// The name of the attribute.
name: string;
// The device class of the attribute.
device_class?: DeviceClass;
// The unit of measurement of the attribute.
unit_of_measurement?: string;
// The state class of the attribute.
state_class?: string;
// If the attribute has availability.
availability?: boolean;
// The value that is stored when the attribute is unavailable.
unavailability_value?: string;
}
ButtonAttribute
export interface ButtonAttribute extends BaseAttribute {
type: DeviceType.button;
}
SceneAttribute
export interface SceneAttribute extends BaseAttribute {
type: DeviceType.scene;
}
DeviceTrackerAttribute
export interface DeviceTrackerAttribute extends BaseAttribute {
type: DeviceType.device_tracker;
source_type?: 'gps' | 'router' | 'bluetooth' | 'bluetooth_le';
}
SwitchAttribute
export interface SwitchAttribute extends BaseAttribute {
type: DeviceType.switch;
optimistic: boolean;
}
NumberAttribute
export interface NumberAttribute extends BaseAttribute {
type: DeviceType.number;
min: number;
max: number;
step: number;
}
SelectAttribute
export interface SelectAttribute extends BaseAttribute {
type: DeviceType.select;
optimistic: boolean;
options: string[];
}
ClimateAttribute
export interface ClimateAttribute extends BaseAttribute {
type: DeviceType.climate;
optimistic: boolean;
has_fanmode: boolean;
has_swingmode: boolean;
has_presetmode: boolean;
has_humidity_control: boolean;
}