knowing I am comparing strings, and not numbers, please let me ask how to make this formally correct, though my current template seems to always give the desired outcome:
ha_update_available:
friendly_name: 'Ha update available'
value_template: >
{% set latest = states('sensor.ha_available_version') %}
{% set local = states('sensor.ha_local_version') %}
{{latest != 'unavailable' and local != 'unavailable' and 'b' not in latest and
latest > local}}
output of both latest
and local
is in the form of 0.109.5 and 0.109.6 (latest is incorrect at the moment, but that is irrelevant for this issue. well, see below, it is the reason for the whole exercise…)
see what happens in template editor.
no matter which comparison I throw at the bottom template, it always seems correct.
still, I know I shouldn’t do it like this.
please have a look.
reason I ask is because of the fact the latest is incorrect at the moment, and before, the template was simply checking both sensors not being equal. != With a correct state , the would of course suffice. If the available version would not be equal to the installed version, that would indicate an update.
right now, with the available version being 1 down from the installed version, this results in a false red flag
need to be more exact.