maxwroc / battery-state-card

Battery state card for Home Assistant
MIT License
875 stars 38 forks source link

Formatting issue secondary_info last_changed #663

Closed erkr closed 9 months ago

erkr commented 9 months ago

Describe the bug Thanks for this really great card. I love it!!! Ran into one of the small issues: The stock example for secondary info works fine:

secondary_info: '{last_changed}'

Result: image

But when I add some additional info, it fails:

secondary_info: 'since {last_changed}'

Result: image

Version

V3.1.5

maxwroc commented 9 months ago

This is expected. To convert value to relative time you need to pass it through the reltime() function image

The only reason why '{last_changed}' works is that this was working like this before and when I have added the support for "having a relative-time values between the string" I didn't want to have a "breaking change" hence bumping major card version.

But I agree that now it can be confusing why the val alone works as expected but not between strings.

Please reopen if it doesn't work with the above

erkr commented 9 months ago

@maxwroc That works great!!! Thanks 🙏