From 53928f87d208f5bc06d1451eadd62bce1529414c Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 26 Aug 2017 12:35:54 -0700 Subject: [PATCH] Add state_with_unit info --- source/_docs/configuration/templating.markdown | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/_docs/configuration/templating.markdown b/source/_docs/configuration/templating.markdown index b1002f94f93..f05886a35a2 100644 --- a/source/_docs/configuration/templating.markdown +++ b/source/_docs/configuration/templating.markdown @@ -85,10 +85,15 @@ Home Assistant adds extensions to allow templates to access all of the current s [strp-format]: https://docs.python.org/3.4/library/datetime.html#strftime-and-strptime-behavior -

+

If your template uses an `entity_id` that begins with a number (example: `states.device_tracker.2008_gmc`) you must use a bracket syntax to avoid errors caused by rendering the `entity_id` improperly. In the example given, the correct syntax for the device tracker would be: `states.device_tracker['2008_gmc']`

+## {% linkable_title Home Assistant template extensions %} + +In templates, besides the normal [state object methods and properties](/topics/state_object/), there are also some extra things available: + +- `states.sensor.temperature.state_with_unit` will print the state of the entity and, if available, the unit. ## {% linkable_title Examples %}