-
Notifications
You must be signed in to change notification settings - Fork 14
Templated Thresholds
Nine numeric threshold fields accept a Home Assistant Jinja2 template in place of a fixed number. Type a template into the field and Adaptive Cover Pro renders it to a number once per update cycle, so the threshold can follow a season, a sensor, an input_number helper, or any other state you can express in a template, without an external automation calling a service.
A tenth field, the Motion Occupancy Template on the Automation screen, takes a condition template (truthy/falsy) rather than a number. It is documented at the bottom of this page.
Available in v2.28.0-beta.5 and later. This is a beta feature; behaviour may change before the stable v2.28.0 release.
| Screen | Field |
|---|---|
| Climate β Light & Cloud | Lux Threshold |
| Climate β Light & Cloud | Irradiance Threshold |
| Climate β Light & Cloud | Cloud Coverage Threshold |
| Climate β Temperature & Climate | Minimum Comfort Temperature |
| Climate β Temperature & Climate | Maximum Comfort Temperature |
| Climate β Temperature & Climate | Outdoor Temperature Threshold |
| Weather Safety | Wind Speed Threshold |
| Weather Safety | Rain Rate Threshold |
| Weather Safety | Wind Direction Tolerance |
A plain number still works in every one of these fields. Templating is opt-in: leave a number and nothing changes.
The field is a Jinja code editor with entity autocomplete and syntax highlighting, the same editor Home Assistant uses for template sensors. Your template must render to a number.
{{ states('input_number.summer_high_temp') | float }}{# Tighter comfort band in winter, wider in summer #}
{{ 23 if now().month in (11, 12, 1, 2) else 26 }}{# Track an outdoor sensor, with a fallback if it goes unavailable #}
{{ states('sensor.outdoor_temp') | float(25) }}The unit for each field (Β°C, lux, W/mΒ², %, and so on) is shown in the field's description text rather than next to the editor, because the template editor has no fixed unit.
- The template is rendered once per update cycle, before the position calculation runs. The calculation engine only ever sees the resulting number, never the raw template.
- Use a
floatdefault (| float(25)) for any value that can go unavailable. A bare| floaton an unavailable sensor renders to0, which is rarely the threshold you want. - If a template fails to render to a number β a syntax error, an unavailable entity with no fallback, a non-numeric result β that field falls back to its built-in default for the cycle, and the failure is logged once (not every cycle) until it recovers. The cover keeps operating; one bad template does not stall the rest of the configuration.
Open the cover's diagnostics (see Debug & Diagnostics). Any field configured with a template appears under templated_thresholds, showing both the raw template string and the value it last rendered to:
"templated_thresholds": {
"temp_high": { "template": "{{ 23 if now().month in (11,12,1,2) else 26 }}", "resolved": 26.0 }
}Fields configured with a plain number do not appear there, so the list is exactly the set of thresholds currently driven by a template.
The Motion Occupancy Template field on the Automation screen is the condition-template counterpart. It takes a template that renders truthy or falsy, and treats a truthy result as occupancy. It is OR'd with the configured Motion Sensors: presence is reported when any motion sensor is active or the template renders truthy.
{# Treat the room as occupied whenever a guest switch is on #}
{{ is_state('input_boolean.guest_mode', 'on') }}Truthiness follows Home Assistant's usual condition rules (on, true, 1 count as true). An empty field, a non-template value, or a render failure all read as falsy, so a broken template can never wedge the room into permanent occupancy. The template can be used on its own, with no motion sensors configured, when occupancy is something you compute upstream.
- Climate: the lux, irradiance, cloud, and temperature threshold fields
- Weather Safety: the wind and rain threshold fields
- Automation: the Motion Occupancy Template field
-
Dynamic Temperature Thresholds: a worked example, and when to prefer the
set_climateservice instead - Debug & Diagnostics: reading the resolved values
π Home Β· β¨ Features Β· π° What's New
π Getting Started
- Installation
- Migrating from Custom Repository
- Migrating from Adaptive Cover
- First-Time Setup
- Cover Types
π§ Core Concepts
π Cover Types
βοΈ Configuration
- Sun Tracking
- Position
- Position Matching
- Glare Zones
- Automation
- Custom Position
- Force Override
- Weather Safety
- Climate
- Templated Thresholds
- Blindspot
- Summary Screen
- Debug & Diagnostics
π Entities & Services
- Entities
- Proxy Cover Entity
- Position Verification
- My Position Support (Somfy RTS)
- Runtime Configuration Services
π οΈ Operations
π§ Advanced Use Cases
- Dynamic Temperature Thresholds
- Dynamic Tracking Window
- Bedroom Sleep Mode
- Handling Variable Cloud Cover
- Venetian Tilt-Only on Overcast Days
- Forecast-Based Shading
π¨ Dashboard
π§ͺ Testing & Simulation
π Reference
π©βπ» For Developers