Alrighty, it's time for Home Assistant 0.10. A lot amazing things have changed and sadly we also had to introduce a bunch of backwards incompatible changes.
I would like to give a big shoutout to philipbl who put a lot in effort in helping the migration to move towards using templates for a wide variety of platforms.
In this release:
- Device tracker: iCloud platform added (xorso, kevinpanaro)
- Frontend: Improved caching using service workers if served over SSL (balloob)
- Sensor: Twitch platform added (happyleavesaoc)
- Template support (balloob, philipbl, fabaff)
- Thermostat: Heatmiser platform added (andylockran)
- Sensor: Dweet.io platform added (fabaff)
- Alexa/Amazon echo component added (balloob)
- Device Tracker: FritzBox platform added (deisi, caiuspb)
- Sensor: Wink now supports the Egg minders (w1ll1am23)
- Sensor: ELIQ Online platform added (molobrakos)
- Binary sensor: REST platform added (fabaff)
- Sensor: Torque (OBD2) platform added (happyleavesaoc)
Templates
This release introduces templates. This will allow you to parse data before it gets processed or create messages for notifications on the fly based on data within Home Assistant. Templates can be specified using Jinja2 templates ([docs](http://jinja.pocoo.org/docs/dev/templates/)) with some Home Assistant specific additions:
- Iterating `states` will yield each state sorted alphabetically by entity id
- Iterating `states.domain` will yield each state of that domain sorted alphabetically by entity id
- `states.sensor.temperature` returns state object for `sensor.temperature`
- `states('device_tracker.paulus')` will return the state of given entity or `unknown` if it doesn't exist.
- `is_state('device_tracker.paulus', 'home')` will test if given entity is specified state.
There are also two extra filters: `multiply` and `round`. Both which convert strings to numbers before doing their job.
Example templates and what they could result in:
| Template | Output |
| --- | --- |
| `{{ states('device_tracker.paulus') }}` | home |
| `{{ states.device_tracker.paulus.attributes.battery }}` | 34 |
| `{% for state in states.sensor %}{{ state.entity_id }}={{ state.state }}, {% endfor %}` | senor.thermostat=24, sensor.humidity=40, |
| `{{ value['hello'][0] | multiply(10) | round(1) }}` | 10.2 |
jinja2
{% if is_state('device_tracker.paulus', 'home') %}
Ha, Paulus is home!
{% else %}
Paulus is at {{ states('device_tracker.paulus')) }}.
{% endif %}
The notification component and the new Alexa/Amazon Echo component are both using the new template functionality to render responses.
A template editor has been added to the developer tool section in the app so you can get instant feedback if your templates are working or not.
Breaking changes
Templates will now be the only way to extract data from 'raw' sources like REST, CommandSensor or MQTT. This will replace any specific option that used to do this before. This means that `precision`, `factor`, `attribute` or `json_path` etc will no longer work.
Affected components and platforms:
- sensor: arest
- sensor: command_sensor
- sensor: rest
- sensor: MQTT
- switch: MQTT
- rollershutter: MQTT
- light: MQTT
- binary_sensor: MQTT
- automation: numeric_state