From 6a955be04864fc23a073ef8d3c5b84bbf32658ec Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 4 Oct 2020 19:24:04 -0500 Subject: [PATCH] Remove rate_limit directive from documentation as it is not shipping in 0.116 (#14909) --- source/_docs/configuration/templating.markdown | 1 - source/_integrations/binary_sensor.template.markdown | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/source/_docs/configuration/templating.markdown b/source/_docs/configuration/templating.markdown index d0ff7e79027..89d2928c19c 100644 --- a/source/_docs/configuration/templating.markdown +++ b/source/_docs/configuration/templating.markdown @@ -57,7 +57,6 @@ Extensions allow templates to access all of the Home Assistant specific states a - `is_state('device_tracker.paulus', 'home')` will test if the given entity is the specified state. - `state_attr('device_tracker.paulus', 'battery')` will return the value of the attribute or None if it doesn't exist. - `is_state_attr('device_tracker.paulus', 'battery', 40)` will test if the given entity attribute is the specified state (in this case, a numeric value). Note that the attribute can be `None` and you want to check if it is `None`, you need to use `state_attr('sensor.my_sensor', 'attr') == None`. -- `rate_limit` - limits re-renders of the template. Returns an empty string and accepts the same arguments as the Python `datetime.timedelta` function -- days, seconds, microseconds, milliseconds, minutes, hours, weeks.
Avoid using `states.sensor.temperature.state`, instead use `states('sensor.temperature')`. It is strongly advised to use the `states()`, `is_state()`, `state_attr()` and `is_state_attr()` as much as possible, to avoid errors and error message when the entity isn't ready yet (e.g., during Home Assistant startup). diff --git a/source/_integrations/binary_sensor.template.markdown b/source/_integrations/binary_sensor.template.markdown index 0a985656efe..f6bb04ed43e 100644 --- a/source/_integrations/binary_sensor.template.markdown +++ b/source/_integrations/binary_sensor.template.markdown @@ -297,10 +297,6 @@ time any state changed event happens if any part of the state is accessed. When is only re-rendered when a state is added or removed from the system. On busy systems with many entities or hundreds of thousands state changed events per day, templates may re-render more than desirable. -A `rate_limit` directive can be used to limit how often the template re-renders. - -`rate_limit` returns an empty string and accepts the same arguments as the Python `datetime.timedelta` function -- days, seconds, microseconds, milliseconds, minutes, hours, weeks. - In the below example, re-renders are limited to once per minute: {% raw %} @@ -309,11 +305,11 @@ binary_sensor: - platform: template sensors: has_unavailable_states: - value_template: '{{ rate_limit(minutes=1) }}{% states | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | list | count }}' + value_template: '{{ states | selectattr('state', 'in', ['unavailable', 'unknown', 'none']) | list | count }}' ``` {% endraw %} -If the template accesses every state on the system or all states under a specific domain, a default rate limit of one update per second is applied. If the template only accesses specific states, no rate limit is applied. The rate limit can be disabled by inserting {% raw %}`{{ rate_limit(seconds=0) }}`{% endraw %} into the template. +If the template accesses every state on the system or all states under a specific domain, a rate limit of one update per minute is applied. If the template only accesses specific states, receives update events for specifically referenced entities, or the `homeassistant.update_entity` service is used, no rate limit is applied. ### Working without entities