Core Specs & API
Workshop Spec Sheet: cooling/heating rules, energy label math, 3D node contracts, and airflow tokens live here.
API reference entry points are reserved for TypeDoc generation once all adapters settle.
Active packages:
@yunlefun-home/air-conditioner-core@air-conditioner/react@yunlefun-home/air-conditioner@yunlefun-home/air-conditioner-widget
Motion Tokens
@yunlefun-home/air-conditioner-core exports shared motion tokens:
import { acMotion, prefersReducedMotion, renderAcMotionCssVars } from '@yunlefun-home/air-conditioner-core'
acMotion.duration.base // 240 (ms)
acMotion.easing.standard // 'cubic-bezier(0.2, 0, 0, 1)'
prefersReducedMotion() // true when prefers-reduced-motion is enabled (false in SSR)
// Render `--acw-motion-*` CSS variables (with reduced-motion overrides) for Shadow DOM
renderAcMotionCssVars(':host')Airflow and Swing
When powered on, the louver opens and three airflow streams fan out beneath the unit, cross-fading between icy cyan and warm amber when switching Cool / Heat.
Enabling Swing on the remote oscillates both the airflow streams (acMotion.duration.swing ms per cycle) and the louver blades. Turning swing off freezes the louver in place just like a physical wall unit.
store.dispatch({ type: 'toggleSwing' })
store.dispatch({ type: 'swing', swing: true })Views expose data-swing="on" | "off" on the root element.
Mist and Condensation
During Cool mode, soft cold mist drifts below the louver (#70); at 22°C or below, condensation droplets slowly gather on the louver edge and drip with a subtle sound (#21).
| Helper | Return | Rule |
|---|---|---|
getAcMist(state) | Opacity 0–1 | Active only in Cool mode; denser at lower temps and higher fan speeds |
getAcDripInterval(state) | Interval (ms) or undefined | Active only in Cool mode at or below acDripMaxTemperature (22°C); 9s at 16°C, 18s at 22°C, 20% faster on High fan |
getAcCondensationStyle(state) | { mist, dripCycle, drip } | Applied directly as CSS vars on the AC root |
Model Conventions (3D)
Web 3D mode (Three.js) and native apps (CuteAC, Yun Home) share identical Blender-generated models (apps/macos/Model/build_cute_ac.py), exported to USDZ and GLB. Constants in core match ACModel in Swift:
| Constant | Value |
|---|---|
acModelFiles | { wall: 'CuteAC.glb', tower: 'CuteACTower.glb' } |
acModelParts | Named nodes: Louver, Display (0.25 × 0.1 UV plane), Led |
acLouverMotion | Rotate around local X: 40° for wall unit, 30° per blade for tower |
acAirflowAnchors | Airflow origin offsets, widths, and directions |
getAcLedColor(state) | Mode accent color when on, neutral gray when off |
Fan Speed
The remote's Fan button cycles through four speeds stored in AcState.fan:
| Fan | Airflow | Fan Sound |
|---|---|---|
auto | Default cadence | Starts strong, settles once room temp stabilizes, cycles periodically |
low | Slower, softer | Fixed 45% |
medium | Slightly slower | Fixed 70% |
high | Faster, denser | Fixed 100% |
store.dispatch({ type: 'cycleFan' })
store.dispatch({ type: 'fan', fan: 'low' })
audio.setFanSpeed('low')Remote Buttons
- Press-and-hold temperature: Steps once immediately, then repeats smoothly after ~0.5s until hitting 16°C or 31°C.
- Mode shortcut power-on: Pressing Cool or Heat while off powers the unit on into that mode (
{ type: 'mode', mode, powerOn: true }).
import { bindAcPressRepeat } from '@yunlefun-home/air-conditioner-core'
const unbind = bindAcPressRepeat(button, () => store.dispatch({ type: 'increment' }), {
value: () => store.getState().temperature,
})Per-Mode Temperature Memory
Cool and Heat remember their last target temperatures independently in AcState.temperatures ({ cold, hot }). Switching Cool → Heat → Cool restores each mode's temperature just like a real remote.
Notifications
getAcActionNotification emits AcNotification entries grouped by kind, unified across adapters via createAcNotificationPresenter():
kind | Example | Presentation (present() result) |
|---|---|---|
tip | Set 26°C+ in Cool mode to save energy | note: floating paper note blown from the louver (shown once per mode/temp) |
limit | Already at max/min temperature | shake: remote LCD shakes and turns red |
setting | Fan speed: Low | announce: screen-reader announcement only |
Energy Efficiency Label
The sticker in the upper-left mimics the China Energy Label (CEL 010—2019, Grade 1 out of 5 per GB 21455-2019), scaled via --acw-energy-scale (default 0.6).
acEnergyLabel.grade // 1
acEnergyLabel.grades // 5
getAcEnergyLabelText()Audio and Sound Modes
The Sound button at the bottom of the remote cycles normal → sleep (30% volume) → mute:
import { createAcAudioController, createAirConditionerStore } from '@yunlefun-home/air-conditioner-core'
const store = createAirConditionerStore()
store.dispatch({ type: 'cycleSound' })
store.dispatch({ type: 'sound', sound: 'mute' })
const audio = createAcAudioController({}, { soundMode: store.getState().sound })Synthesizes stereo indoor airflow (classic and modern profiles), startup mechanical chimes, mode acoustics, and key beeps natively via the Web Audio API with zero .mp3/.m4a assets, gapless hardware looping, and smooth crossfades. Optional <audio> elements (with resolveAcAudioAssets()) remain supported as fallback for non-Web-Audio environments or custom recordings.