Tau: tau
The tau template constant provides the mathematical constant tau, which equals 2 * pi, approximately 6.28318. Tau represents one full turn in radians, making some circular and angular calculations more intuitive.
This is useful when working with full rotations or cyclic values. For example, instead of writing 2 * pi to represent a full circle, you can use tau. This can make templatesA template is an automation definition that can include variables for the action or data from the trigger values. This allows automations to generate dynamic actions. [Learn more] involving angular sensorSensors return information about a thing, for instance the level of water in a tank. [Learn more] data or periodic calculations cleaner and easier to read.
Usage
Here’s how to use this template function. Copy any example and adjust it to your setup.
{{ tau }}
6.283185307179586
Good to know
- This is a mathematical constant approximately equal to 6.28318, the same as
2 * pi. - Use it without parentheses.
tauis a value, not a function you call.
Try it yourself
Ready to test this? Open Developer tools > Template, paste the example into the Template editor, and watch the result update on the right. Edit the values to see how the function adapts to your own entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more].
More examples
Real scenarios where this function comes up in automations and templates. Copy any example and adapt it to your setup.
Fraction of a full rotation
Calculate one quarter of a full rotation (90 degrees in radians).
{{ tau / 4 }}
1.5707963267948966
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with your template and expected result, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain or fix templates when you describe what you want in plain language.
Related template functions
These functions work well alongside this one:
-
Pi: pi - The mathematical constant pi, approximately 3.14159.
-
Euler’s number: e - The mathematical constant e (Euler’s number), approximately 2.71828.
-
Sine: sin - Returns the sine of a value given in radians.
-
Cosine: cos - Returns the cosine of a value given in radians.
-
Tangent: tan - Returns the tangent of a value given in radians.