From 9e6c91bc3e4a374d521d0d196248da31b5dbbaa1 Mon Sep 17 00:00:00 2001 From: Marcus Schmidt Date: Sun, 13 Aug 2017 07:05:34 +0200 Subject: [PATCH] Added documentation to HA PR#8505 (#3157) * Added documentation to HA PR#8505 - Added possibilities to use template in the command_line sensor * Small fixes after review * Minor changes --- source/_components/sensor.command_line.markdown | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/_components/sensor.command_line.markdown b/source/_components/sensor.command_line.markdown index 9da2a67b6e2..b963bdee442 100644 --- a/source/_components/sensor.command_line.markdown +++ b/source/_components/sensor.command_line.markdown @@ -145,3 +145,16 @@ sensor: command: "python3 /path/to/script/arest-value.py" unit_of_measurement: "°C" ``` + +### {% linkable_title Usage of templating in `command:` %} + +[Templates](/docs/configuration/templating/) are supported in the `command:` configuration variable. This could be used if you want to include the state of a specific sensor as an argument to your external script. + +```yaml +# Example configuration.yaml entry +sensor: + - platform: command_line + name: wind direction + command: 'sh /home/pi/.homeassistant/scripts/wind_direction.sh {{ states.sensor.wind_direction.state }}' + unit_of_measurement: "Direction" +```