← All modules

Compass

BuiltConfigurable

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

Module typecompass
Default expression IDcmp
Refresh ratePer-render (sensor events)
Required configtargetReftargetLattargetLngtargetName

Declaration

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

Properties

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

NameDescriptionExampleFormat arg
headingDevice heading in degrees (0–360)187
cardinalCardinal name (N, NE, …) of the device heading — the direction the phone is facingS
headingRadiansHeading as radians3.26
targetBearingBearing from user → target (0–360)136
targetCardinalCardinal name (N, NE, …) of the target bearing — the direction TO the target. Static while stationary.SE
targetDistanceGreat-circle distance in km4623
targetDistanceMiGreat-circle distance in miles2873
pointerAngle(targetBearing − heading) — rotate target pointer by this309
roseAngle(−heading) — rotate compass rose by this-187
targetNameResolved target nameMecca
targetReadytrue when both location and target are settrue

Events

TriggerDescription
On sensor changeRotation-vector sensor reports a new orientation