HMAccessory is a single HomeKit accessory — a light, sensor, lock, thermostat, etc. — and its services.
HMAccessory
uuid
string
name
room
HMRoom | null
category
HMAccessoryCategory
'lightbulb'
'thermostat'
manufacturer
string | null
model
firmwareVersion
isReachable
boolean
isBlocked
isBridged
bridgedAccessoryUUIDs
string[] | null
services
HMService[]
await accessory.rename("Living Room Lamp") await accessory.identify() // ask the accessory to physically identify (e.g. blink)
accessory.onReachabilityChanged = ok => { /* ... */ } accessory.onNameChanged = name => { /* ... */ } accessory.onServicesChanged = list => { /* ... */ } accessory.onFirmwareVersionChanged = v => { /* ... */ }
const home = await HMHomeManager.primaryHome const light = home?.accessories.find(a => a.category === 'lightbulb') const power = light?.services .find(s => s.serviceType === 'lightbulb') ?.characteristics.find(c => c.characteristicType === 'powerState') await power?.writeValue(true)