From 0e77613fd336add211c4d77eceb226f3d115ddef Mon Sep 17 00:00:00 2001 From: Brian Fitzgerald Date: Tue, 19 Sep 2017 16:34:08 +0200 Subject: [PATCH] Additional example (#3395) * Additional example Using the sensor as a trigger. The syntax for this took me ages to work out, be great to save someone else the hours. * Marking template lines with raw tags Following @fabaff advice to avoid render of the template, using {% raw %}{{your_template}}{% endraw %}. * fixing endraw tag * Fixing? spacing issue --- source/_components/sensor.speedtest.markdown | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source/_components/sensor.speedtest.markdown b/source/_components/sensor.speedtest.markdown index 7fd0ec202a7..d9c25821a8a 100644 --- a/source/_components/sensor.speedtest.markdown +++ b/source/_components/sensor.speedtest.markdown @@ -90,6 +90,25 @@ sensor: - upload ``` +### {% linkable_title Using as a trigger in an automation %} + +```yaml +# Example configuration.yaml entry +automation: + - alias: 'Internet Speed Glow Connect Great' + trigger: + platform: template + value_template: '{% raw %}{{ states.sensor.speedtest_download.state|float > 10}}{% endraw %}' + action: + service: shell_command.green + - alias: 'Internet Speed Glow Connect Poor' + trigger: + platform: template + value_template: '{% raw %}{{ states.sensor.speedtest_download.state| float < 10 }}{% endraw %}' + action: + service: shell_command.red +``` + ## {% linkable_title Notes %} - When running on Raspberry Pi, just note that the maximum speed is limited by its 100 Mbit/s LAN adapter.