-
Notifications
You must be signed in to change notification settings - Fork 100
Software Update Automation
Because the software update sensor will turn on even when the update is still waiting on Wi-Fi or Downloading, any automation that needs to detect if the update is available to install would need to use the latest_version
attribute.
Here's an example of an automation which automatically installs an update after it has finished downloading:
description: Auto Update
mode: single
trigger:
- platform: state
entity_id:
- update.my_car_software_update
attribute: latest_version
condition:
- condition: template
value_template: >-
{{'Available' in state_attr('update.my_car_software_update',
'latest_version')}}
action:
- service: update.install
data: {}
target:
entity_id: update.my_car_software_update
This will trigger whenever latest_version
changes, such as from 2022.40.1 (Downloading)
-> 2022.40.1 (Available to install)
. The condition will make sure it only runs when latest_version
contains the "Available to install" text.
Technically the above example doesn't need the condition as it will try to install each time latest_version
changes, and the integration is smart enough to not try to install an update which is still waiting on Wi-Fi, downloading, or installing. But having that extra condition is useful in other scenarios such as for notifications.
For a fully fledged auto-update automation, try out this blueprint.