There is no ânew methodâ. Thatâs the kicker. This is something with your system.
Maybe you misunderstood my question. The old version number i.e .118.1 fit inside. The new method 2020.7.2 does not.
Yeah, thatâs what I mean⌠no new method. Did you change your font? Load a new theme?
I did not, just more digits now and they do not fit. They did before the version numbering added extra digits. I.e .118.8 (4), 2020.12.1 (7).
I get it now . Let me mull it over a bit
Did you come up with any ideas? I always liked that I could see if I am running the latest version at a glance.
do you explicitly need it to be a badge? maybe try a button like:
you could of course write a template (binary) sensor to simply cut-off the year⌠or set the friendly_name to version, and have it show below the Unit (with a binary True/False as state in the badge)
ha_uptodate:
friendly_name_template: >
{{states('sensor.ha_local_version')}}
value_template: >
{{states('sensor.ha_local_version') == states('sensor.ha_available_version')}}
unit_of_measurement: Up to date
but wouldnât show an icon but the state in the badge though (and without custom_ui thereâs not much to trick the system I fear):
This works, but the badge takes up a lot less room. What code did you use to put both in the button?
this is the template sensor:
ha_uptodate:
friendly_name_template: >
{{states('sensor.ha_local_version')}}
value_template: >
{{states('sensor.ha_local_version') == states('sensor.ha_available_version')}}
icon_template: >
{{ 'mdi:circle-outline' if states('sensor.ha_local_version') !=
states('sensor.ha_available_version') else 'mdi:check-circle-outline' }}
unit_of_measurement: Up to date
and the binary_sensor:
ha_uptodate:
# friendly_name_template: > # <--this is not available for the binary_sensor integration
# {{states('sensor.ha_local_version')}}
value_template: >
{{states('sensor.ha_local_version') == states('sensor.ha_available_version')}}
and because of that, I used a custom_ui customization:
binary_sensor.ha_uptodate:
unit_of_measurement: Up to date
templates:
friendly_name: >
return entities['sensor.ha_local_version'].state;
the latter is not for everyone though, but you are invited to have a look here
Do I need to modify your code for my sensor? I have sensor.installed_version for example.
Well, if you want a badge showing you if your instance is up to date, you would also need the available sensor, and compare the 2.
Maybe I misunderstood.
platform: template
sensors:
ha_uptodate:
friendly_name_template: >
{{states('sensor.ha_local_version')}}
value_template: >
{{states('sensor.ha_local_version') == states('sensor.ha_available_version')}}
icon_template: >
{{ 'mdi:circle-outline' if states('sensor.ha_local_version') !=
states('sensor.ha_available_version') else 'mdi:check-circle-outline' }}
unit_of_measurement: Up to date
I get this in developer tools
sensor.ha_uptodate
state: true
The sensor I created that fed my badges is:
sensor.supervisor_updates
and I get
newest_version: 2021.01.7
current_version: 2021.01.7
or
sensor.latest_available_version
Not sure how your code gets the information.
you can simply replace the sensors in my value_template with your sensor, and template out the attributes:
{{state_attr('sensor.supervisor_updates','newest_version') ==
state_attr('sensor.supervisor_updates','current_version')}}
for checking if you are up to date.
If you only want either version use only {{state_attr('sensor.supervisor_updates','newest_version')}}
or {{state_attr('sensor.supervisor_updates','current_version')}}
Thanks for spending the time. I believe I understand and have the template correct. But since it still says unknown in the developers tools, I must still have something wrong. I assume once this works, I just add the ha_uptodate as the entity of the button card?
platform: template
sensors:
ha_uptodate:
friendly_name_template: >
{{states('sensor.ha_local_version')}}
value_template: >
{{state_attr('sensor.supervisor_updates','newest_version') == state_attr('sensor.supervisor_updates','current_version')}}
icon_template: >
{{ 'mdi:circle-outline' if states('sensor.supervisor_updates','newest_version') !=
states('sensor.supervisor_updates','current_version') else 'mdi:check-circle-outline' }}
unit_of_measurement: Up to date
please show me the template in the dev tools? like this:
and you do have the {{states('sensor.ha_local_version')}}
available in your system?
btw, note that the icon_template doesnât show in the badge (the state is displayed in the badge circle) but will show in the more-info of the badge/sensor.
so thatâs showing fine, the unknown will be another sensor you have configured. that why I asked about the sensor.ha_local_version
. Do you have that?
I do. For some reason the pictures are not showing.
I do not have a sensor.ha_local_version list in the developer tools. I need a class on templates. I guess I know enough about them to be dangerous. This has been helpful, hopefully when it finally works Iâll pick up some knowledge.
thuis is all there is to that:
- platform: command_line
name: Ha local version
command: 'cat /config/.HA_VERSION'
it merely reads the hidden file in your own system ⌠add that to the configuration under the sensor:
domain and youâre good to go.