设备类型参考
设备类型总览
| 设备类型 (device_type) | schema_id | HAP 类别 | MIoT 输入文件 | HAP 输出文件 |
|---|---|---|---|---|
Lightbulb | light | Lightbulb | light.toml | light.toml |
Outlet | outlet | Outlet | outlet.toml | outlet.toml |
Switch | switch | Switch | switch.toml | switch.toml |
Fan | fan | Fan | fan.toml | fan.toml |
WindowCovering | curtain | WindowCovering | curtain.toml | curtain.toml |
AirConditioner | air-conditioner | AirConditioner | air-conditioner.toml | air-conditioner.toml |
| (空调伴侣) | air-conditioner | AirConditioner | air-condition-outlet.toml | air-condition-outlet.toml |
Airer | airer | WindowCovering | airer.toml | airer.toml |
Humidifier | humidifier | AirHumidifier | humidifier.toml | humidifier.toml |
ElectricBlanket | electric-blanket | Thermostat | electric-blanket.toml | electric-blanket.toml |
Heater | heater | Thermostat | heater.toml | heater.toml |
BathHeater | bath-heater | AirHeater | bath-heater.toml | bath-heater.toml |
MiotGateway | gateway | SecuritySystem | gateway.toml | gateway.toml |
MagnetSensor | magnet-sensor | Sensor | magnet-sensor.toml | magnet-sensor.toml |
TemperatureHumiditySensor | temperature-humidity-sensor | Sensor | temperature-humidity-sensor.toml | temperature-humidity-sensor.toml |
Television | television | Television | — | television.toml |
各设备类型详细映射
Light (灯)
| 字段 | 值 |
|---|---|
| device_type | light |
| schema_id | light |
| HAP 主服务 | Lightbulb |
服务映射:
| spec_type | schema_service | 属性映射 |
|---|---|---|
light | light | on → power-state, brightness → brightness, color-temperature → color-temperature, color-rgb (由 hue + saturation 合成, 使用 color_hs 转换) |
HAP 特性:
| HAP 类型 | schema_attr | 必选 | 值范围 |
|---|---|---|---|
PowerState | power-state | 是 | 0/1 |
Brightness | brightness | 否 | 0-100 |
ColorTemperature | color-temperature | 否 | 140-500 (mired), 倒数转换 factor=1000000 |
Outlet (插座) / Switch (开关)
| 字段 | 值 |
|---|---|
| device_type | outlet / switch |
| schema_id | outlet / switch |
| HAP 主服务 | Outlet / Switch |
| spec_type | switch |
| schema_service | outlet / switch |
| 属性映射 | on → power-state |
Fan (风扇)
| 字段 | 值 |
|---|---|
| device_type | fan |
| schema_id | fan |
| HAP 主服务 | FanV2 |
服务映射:
| spec_type | schema_service | 属性映射 |
|---|---|---|
fan | fan | on → active, fan-level → rotation-speed (分段: 1→25, 2→50, 3→75, 4→100) |
HAP 特性:
| HAP 类型 | schema_attr | 必选 | 值范围 |
|---|---|---|---|
Active | active | 是 | 0/1 |
RotationSpeed | rotation-speed | 否 | 0-100 |
SwingMode | swing-mode | 否 | 0/1 |
Curtain (窗帘/卷帘)
| 字段 | 值 |
|---|---|
| device_type | curtain |
| schema_id | curtain |
| HAP 主服务 | WindowCovering |
服务映射:
| spec_type | schema_service | 属性映射 |
|---|---|---|
curtain | window-covering | target-position → target-position, current-position → current-position |
status → position-state (enum_map: 0→2 停止, 1→1 升起/关闭, 2→0 下降/打开) |
HAP 特性:
| HAP 类型 | schema_attr | 必选 | 值范围 |
|---|---|---|---|
CurrentPosition | current-position | 是 | 0-100 |
TargetPosition | target-position | 是 | 0-100 |
PositionState | position-state | 是 | 0=打开中, 1=关闭中, 2=静止 |
Air Conditioner (空调)
| 字段 | 值 |
|---|---|
| device_type | air-conditioner |
| schema_id | air-conditioner |
| HAP 主服务 | HeaterCooler |
服务映射:
| spec_type | schema_service | 属性映射 |
|---|---|---|
environment | air-conditioner | relative-humidity → relative-humidity, temperature → current-temperature |
air-conditioner | air-conditioner | on → active, mode → ac-op-mode (enum_map), target-temperature + current-temperature 组合 |
fan-control | air-conditioner | fan-level → rotation-speed (分段: 1→25, 2→50, 3→75, 4→100) |
mode enum_map (空调本机): 2(Cool)→2, 5(Heat)→1, 4(Fan)→0, 3(Dry)→2
mode enum_map (空调伴侣): 0(Auto)→0, 1(Cool)→2, 2(Dry)→2, 3(Heat)→1, 4(Fan)→0
HAP 特性:
| HAP 类型 | schema_attr | 必选 | 值范围 |
|---|---|---|---|
Active | active | 是 | 0/1 |
CurrentHeaterCoolerState | current-heater-cooler-state | 是 | 0=未激活, 1=空闲, 2=加热, 3=制冷 |
TargetHeaterCoolerState | target-heater-cooler-state | 是 | 0=自动, 1=制热, 2=制冷 |
CurrentTemperature | current-temperature | 是 | 0-100 |
RotationSpeed | rotation-speed | 否 | 0-100 |
CurrentRelativeHumidity | current-relative-humidity | 否 | 0-100 |
CoolingThresholdTemperature | — | 否 | 10-35 |
HeatingThresholdTemperature | — | 否 | 0-25 |
SwingMode | swing-mode | 否 | 0/1 |
Airer (晾衣架)
| 字段 | 值 |
|---|---|
| device_type | airer |
| schema_id | airer |
| HAP 主服务 | WindowCovering + Lightbulb |
服务映射:
| spec_type | schema_service | 属性映射 |
|---|---|---|
airer | window-covering | status → position-state (enum_map: 0→2 停止, 1→1 上升/关, 2→0 下降/开, 3→2 暂停, 4→2 停止) |
set-night-light | window-covering | current-position → current-position, set-position → target-position; 事件: position-report / finalposition-report → current-position |
light | light | on → power-state, brightness → brightness |
HAP 特性:
| HAP 服务 | HAP 类型 | schema_attr | 值范围 |
|---|---|---|---|
WindowCovering | CurrentPosition | current-position | 0-100 |
WindowCovering | TargetPosition | target-position | 0-100 |
WindowCovering | PositionState | position-state | 0-2 |
Lightbulb | PowerState | power-state | 0/1 |
Lightbulb | Brightness | brightness | 0-100 (可选) |
Humidifier (加湿器)
| 字段 | 值 |
|---|---|
| device_type | humidifier |
| schema_id | humidifier |
| HAP 主服务 | HumidifierDehumidifier + TemperatureSensor |
服务映射:
| spec_type | schema_service | 属性映射 |
|---|---|---|
humidifier | humidifier-dehumidifier | fan-level → rotation-speed, target-humidity → relative-humidity-humidifier-threshold; on 组合: active + current-humidifier-dehumidifier-state (false→2 关闭) |
environment | humidifier-dehumidifier | relative-humidity → current-relative-humidity |
environment | temperature-sensor | temperature → temperature |
HAP 特性:
| HAP 类型 | schema_attr | 必选 | 值范围 |
|---|---|---|---|
Active | active | 是 | 0/1 |
CurrentHumidifierDehumidifierState | current-humidifier-dehumidifier-state | 是 | 0-2 |
TargetHumidifierDehumidifierState | target-humidifier-dehumidifier-state | 否 | 0-2 |
CurrentRelativeHumidity | current-relative-humidity | 是 | 0-100 |
RelativeHumidityHumidifierThreshold | relative-humidity-humidifier-threshold | 否 | 0-100 |
RotationSpeed | rotation-speed | 否 | 0-100 |
Electric Blanket (电热毯)
| 字段 | 值 |
|---|---|
| device_type | electric-blanket |
| schema_id | electric-blanket |
| HAP 主服务 | Thermostat |
| spec_type | electric-blanket |
| schema_service | thermostat |
| 属性映射 | temperature → current-temperature, target-temperature → target-temperature, on → active |
HAP 特性:
| HAP 类型 | schema_attr | 值范围 |
|---|---|---|
CurrentHeatingCoolingState | current-heating-cooling-state | 0=关闭, 1=加热, 2=制冷 |
TargetHeatingCoolingState | target-heating-cooling-state | 0=关闭, 1=加热, 2=制冷, 3=自动 |
CurrentTemperature | current-temperature | 0-99 |
TargetTemperature | target-temperature | 25-55 |
TemperatureDisplayUnits | temperature-display-units | 0=℃, 1=℉ |
Heater (电暖器/暖风机)
| 字段 | 值 |
|---|---|
| device_type | heater |
| schema_id | heater |
| HAP 主服务 | Thermostat |
服务映射:
| spec_type | schema_service | 属性映射 |
|---|---|---|
heater | thermostat | on → active, target-temperature → target-temperature |
environment | thermostat | temperature → current-temperature |
environment | temperature-sensor | temperature → current-temperature |
HAP 特性:
| HAP 类型 | schema_attr | 值范围 |
|---|---|---|
CurrentHeatingCoolingState | current-heating-cooling-state | 0=关闭, 1=加热, 2=制冷 |
TargetHeatingCoolingState | target-heating-cooling-state | 0=关闭, 1=加热, 2=制冷, 3=自动 |
CurrentTemperature | current-temperature | 0-100 |
TargetTemperature | target-temperature | 5-35 |
TemperatureDisplayUnits | temperature-display-units | 0=℃, 1=℉ |
Bath Heater (浴霸)
| 字段 | 值 |
|---|---|
| device_type | bath-heater |
| schema_id | bath-heater |
| HAP 主服务 | HeaterCooler + Fan + Lightbulb |
服务映射:
| spec_type | schema_service | 属性映射 |
|---|---|---|
ptc-bath-heater | bath-heater | mode → bath-heater-op-mode, target-temperature → target-temperature, heat-level → rotation-speed, ventilation → ventilation-state; _temp_placeholder = current-temperature = 25.0 |
light | light | on → power-state, brightness → brightness |
bath-heater-op-mode 枚举:
| 值 | 含义 |
|---|---|
| 0 | 关闭 |
| 1 | 烘干 |
| 2 | 除雾 |
| 3 | 快速除雾 |
| 4 | 加热 |
| 5 | 其他 |
HAP 特性:
| HAP 服务 | HAP 类型 | schema_attr | 值范围 |
|---|---|---|---|
HeaterCooler | Active | active | 0/1 (关闭→0, 模式1-5→1) |
HeaterCooler | CurrentHeaterCoolerState | current-heater-cooler-state | 0=未激活, 1=空闲, 2=加热 |
HeaterCooler | TargetHeaterCoolerState | target-heater-cooler-state | 0=自动, 1=制热 |
HeaterCooler | CurrentTemperature | current-temperature | 0-100 (固定 25°C) |
Fan | Active | ventilation-state | 0/1 |
Lightbulb | PowerState | power-state | 0/1 |
Lightbulb | Brightness | brightness | 0-100 (可选) |
Gateway (中枢网关)
| 字段 | 值 |
|---|---|
| device_type | gateway |
| schema_id | miot-gateway |
| HAP 主服务 | SecuritySystem |
| spec_type | indicator-light |
| schema_service | security-system |
| 属性映射 | on → security-system-current-state |
HAP 特性:
| HAP 类型 | schema_attr | 值范围 |
|---|---|---|
SecuritySystemCurrentState | security-system-current-state | 0=布防(家), 1=布防(外出), 2=布防(夜间), 3=撤防, 4=报警 |
SecuritySystemTargetState | security-system-target-state | 0=撤防, 1=布防(家), 2=布防(外出), 3=布防(夜间) |
Magnet Sensor (门窗磁传感器)
| 字段 | 值 |
|---|---|
| device_type | magnet-sensor |
| schema_id | magnet-sensor |
| HAP 主服务 | ContactSensor |
服务映射:
| spec_type | schema_service | 属性映射 |
|---|---|---|
magnet-sensor | magnet-sensor | contact-state → contact-sensor-state (enum_map: true→0 已接触, false→1 未接触) |
battery | battery-level | battery-level → battery-level |
HAP 特性:
| HAP 类型 | schema_attr | 值范围 |
|---|---|---|
ContactSensorState | contact-sensor-state | 0=已接触(关闭), 1=未接触(打开) |
Temperature Humidity Sensor (温湿度传感器)
| 字段 | 值 |
|---|---|
| device_type | temperature-humidity-sensor |
| schema_id | temperature-humidity-sensor |
| HAP 主服务 | TemperatureSensor + HumiditySensor |
| spec_type | temperature-humidity-sensor |
| schema_service | temperature-humidity-sensor |
| 属性映射 | relative-humidity → relative-humidity, temperature → temperature |
HAP 特性:
| HAP 服务 | HAP 类型 | schema_attr | 值范围 |
|---|---|---|---|
TemperatureSensor | CurrentTemperature | temperature | 0-100 |
HumiditySensor | CurrentRelativeHumidity | relative-humidity | 0-100 (可选) |
服务类型参考
| schema_id | 名称 | 必选属性 | 可选属性 |
|---|---|---|---|
light | 灯光控制 | power-state | brightness, color-temperature, hue, saturation, color-rgb |
outlet | 插座 | power-state | — |
switch | 开关 | power-state | — |
fan | 风扇 | active | rotation-speed, swing-mode |
window-covering | 窗帘 | current-position, target-position, position-state | — |
air-conditioner | 空调 | active, current-temperature, target-temperature | ac-op-mode, target-heater-cooler-state, current-heater-cooler-state, rotation-speed, swing-mode |
air-purifier | 空气净化器 | active | air-particulate-density, current-air-purifier-state, target-air-purifier-state, rotation-speed, swing-mode, lock-physical-controls |
humidifier-dehumidifier | 加湿除湿器 | active | current-humidifier-dehumidifier-state, target-humidifier-dehumidifier-state, relative-humidity-humidifier-threshold, rotation-speed, swing-mode, lock-physical-controls |
thermostat | 温控器 | current-heating-cooling-state, target-heating-cooling-state, current-temperature, target-temperature | temperature-display-units |
bath-heater | 浴霸 | bath-heater-op-mode, target-temperature | rotation-speed, current-temperature, ventilation-state |
television | 电视 | active-identifier | active, configured-name, remote-key, sleep-discovery-mode, volume, mute |
speaker | 扬声器 | volume, mute | volume-control-type, volume-selector |
temperature-sensor | 温度传感器 | temperature | — |
humidity-sensor | 湿度传感器 | relative-humidity | — |
temperature-humidity-sensor | 温湿度传感器 | temperature, relative-humidity | — |
magnet-sensor | 门窗传感器 | contact-sensor-state | battery-level, status-low-battery |
battery-level | 电池电量 | battery-level | status-low-battery |
security-system | 安防系统 | security-system-current-state, security-system-target-state | — |
属性类型参考
| schema_id | 格式 | 访问权限 | 值范围 | 说明 |
|---|---|---|---|---|
power-state | bool | r/w/n | — | 电源开关 |
brightness | uint8 | r/w/n | 0-100 | 亮度百分比 |
color-temperature | uint32 | r/w/n | 2000-6500K | 色温(Kelvin) |
color-rgb | uint32 | r/w/n | — | RGB 颜色值 |
hue | float | r/w/n | 0-360 | 色调 |
saturation | float | r/w/n | 0-100 | 饱和度 |
active | uint8 | r/w/n | 0/1 | 激活状态 |
rotation-speed | float | r/w/n | 0-100 | 旋转速度(百分比) |
swing-mode | uint8 | r/w/n | 0/1 | 扫风模式 |
lock-physical-controls | bool | r/w/n | — | 童锁/物理按键锁定 |
temperature | float | r/n | — | 温度值 |
current-temperature | float | r/n | — | 当前温度 |
target-temperature | float | r/w/n | — | 目标温度 |
temperature-display-units | uint8 | r/w/n | 0=℃, 1=℉ | 温度显示单位 |
relative-humidity | float | r/n | — | 相对湿度 |
current-relative-humidity | float | r/n | — | 当前相对湿度 |
target-humidity | float | r/w/n | 0-100 | 目标湿度 |
relative-humidity-humidifier-threshold | float | r/w/n | 0-100 | 加湿器湿度阈值 |
current-position | uint8 | r/n | 0-100 | 当前位置 |
target-position | uint8 | r/w/n | 0-100 | 目标位置 |
position-state | uint8 | r/n | 0=打开中, 1=关闭中, 2=静止 | 位置状态 |
contact-sensor-state | uint8 | r/n | 0=已接触, 1=未接触 | 门窗传感器状态 |
battery-level | uint8 | r/n | 0-100 | 电池电量 |
status-low-battery | uint8 | r/n | 0=正常, 1=低电量 | 低电量状态 |
air-particulate-density | float | r/n | — | PM2.5 颗粒物浓度 |
current-air-purifier-state | uint8 | r/n | 0-2 | 当前净化器状态 |
target-air-purifier-state | uint8 | r/w/n | 0-1 | 目标净化器状态 |
current-heater-cooler-state | uint8 | r/n | 0=未激活, 1=空闲, 2=加热, 3=制冷 | 当前冷风机状态 |
target-heater-cooler-state | uint8 | r/w/n | 0=自动, 1=加热, 2=制冷 | 目标冷风机状态 |
current-heating-cooling-state | uint8 | r/n | 0=关闭, 1=加热, 2=制冷 | 当前冷暖状态 |
target-heating-cooling-state | uint8 | r/w/n | 0=关闭, 1=加热, 2=制冷, 3=自动 | 目标冷暖状态 |
current-humidifier-dehumidifier-state | uint8 | r/n | 0-3 | 当前加湿除湿状态 |
target-humidifier-dehumidifier-state | uint8 | r/w/n | 0-2 | 目标加湿除湿状态 |
ac-op-mode | uint8 | r/w/n | 2=制冷, 3=除湿, 4=送风, 5=制热 | 空调运行模式 |
bath-heater-op-mode | uint8 | r/w/n | 0=关闭, 1=烘干, 2=除雾, 3=快速除雾, 4=加热 | 浴霸模式 |
ventilation-state | bool | r/w/n | — | 通风状态 |
security-system-current-state | uint8 | r/n | 0=布防(家), 1=布防(外出), 2=布防(夜间), 3=撤防, 4=报警 | 安防当前状态 |
security-system-target-state | uint8 | r/w/n | 0=撤防, 1=布防(家), 2=布防(外出), 3=布防(夜间) | 安防目标状态 |
volume | uint8 | r/w/n | 0-100 | 音量 |
mute | bool | r/w/n | — | 静音 |
volume-control-type | uint8 | r | 0-3 | 音量控制类型 |
volume-selector | uint8 | w | 0-1 | 音量选择器(仅写入) |
active-identifier | uint32 | r/w | — | 当前输入源 |
configured-name | string | r/w | — | 配置名称 |
sleep-discovery-mode | uint8 | r/w | 0/1 | 睡眠发现模式 |
remote-key | uint8 | w | — | 遥控按键(仅写入) |