← All modules

Compass

Built Configurable

Live device heading plus bearing and distance to a target — Qibla, Home, a preset, or any lat/lng. Fully offline. No permissions required.

Module type compass
Default expression ID cmp
Refresh rate Per-render (sensor events)
Required config targetReftargetLattargetLngtargetName

Declaration

<module type="compass" id="cmp" targetRef="qibla" />

Properties

Reference any of these from a template via {cmp:propertyName}.

Name Description Example Format arg
heading Device heading in degrees (0–360) 187
cardinal Nearest 8-wind name (N, NE, …) S
headingRadians Heading as radians 3.26
targetBearing Bearing from user → target (0–360) 136
targetDistance Great-circle distance in km 4623
targetDistanceMi Great-circle distance in miles 2873
pointerAngle (targetBearing − heading) — rotate target pointer by this 309
roseAngle (−heading) — rotate compass rose by this -187
targetName Resolved target name Mecca
targetReady true when both location and target are set true

Events

Trigger Description
On sensor change Rotation-vector sensor reports a new orientation