Floor Selector
The Floor selector provides a floor picker for selecting Home Assistant floors.
Options
All floor selectors accept these common metadata options:
default?: TFloorId- Default selected floordescription?: string- Human-readable description shown in the UIrequired?: boolean- Whether the field must be provided
Floor-specific options (from ServiceListSelector["floor"]):
entity?: EntityFilterSelector | EntityFilterSelector[]- Filter floors by entitydevice?: DeviceFilterSelector | DeviceFilterSelector[]- Filter floors by devicemultiple?: boolean- Whentrue, allows selecting multiple floors (returnsTFloorId[])
Return Type
TFloorIdwhenmultipleis not set orfalseTFloorId[]whenmultiple: true
Example
import { TServiceParams } from "@digital-alchemy/core";
import { ServiceField } from "@digital-alchemy/synapse";
export function SynapseServiceCreate({
synapse,
context,
logger,
}: TServiceParams) {
synapse.service.create(
{
context,
description: "Configure floor settings",
fields: {
// Floor selector
floor: ServiceField.Floor({
description: "Floor to configure",
required: true,
}),
},
},
async data => {
// data.floor is typed as: TFloorId
logger.info(`Configuring floor: ${data.floor}`);
}
);
}