Can I use a Home Assistant template text to calculate the average of two values?
- User
Can I use a Home Assistant template text to calculate the average of two values?
- Assistant
Yes – in Home Assistant’s Jinja2 templates you can grab two entity states, cast them to floats, add them up and divide by two. Here are two common ways to do it:
- Define a template sensor (so you can use the “average” everywhere)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.