HI,
I’m using this in an automation to send a message when there is an update available
outdated_items: |-
{{ states. Update
| selectattr('state', 'eq', 'on')
| selectattr('attributes.auto_update', 'eq', false)
| selectattr('attributes.in_progress', 'eq', false)
| sort(attribute='attributes.installed_version')
| map(attribute='entity_id')
| list }}
next_to_update: "{{ outdated_items | last }}"
it works great but, when the update is related to shelly or esp the Title attribute is set to None
state update.shellyplug_s_f18d2c_firmware_update=on;
auto_update=False,
installed_version=20230503-101129/v1.13.0-g9aed950,
in_progress=False,
latest_version=20230913-113421/v1.14.0-gcb84623,
release_summary=None,
release_url=None,
skipped_version=None,
**title=None,**
device_class=firmware,
entity_picture=https://brands.home-assistant.io/_/shelly/icon.png,
friendly_name=shellyplug-s-F18D2C firmware update,
supported_features=5 @ 2023-10-15T12:29:26.496877+02:00
when I use to send a notification the message shows None
service: notify.mobile_app_phone
data:
title: Start the update for {{state_attr(next_to_update,'title')}}
message: New version {{state_attr(next_to_update,'latest_version')}}
data:
clickAction: "{{state_attr(next_to_update,'release_url')}}"
the workaround for now is set another automation, add a filter for firmware
| selectattr('attributes.device_class', 'match', 'firmware')
and use {{next_to_update}} instead of {{state_attr(next_to_update,‘title’)}}
title: Start the update for {{next_to_update}}
I’m wondering if I can add a condition to evaluate if the Title value is None and set a variable, something like
condition: template
value_template: >-
{% if state_attr(next_to_update,'title') =='None' %}
NEW_VARIABLE = "Something"
{% else %}
NEW_VARIABLE = {{state_attr(next_to_update,'title')}}
{% endif %}
then use it in the title
service: notify.mobile_app_phone
data:
title: Start the update for NEW_VARIABLE
message: New version {{state_attr(next_to_update,'latest_version')}}
any ideas?