Why cant home assistant show time in HH.MM?

Hi I try to set a template sensor attribute to show a timestamp to hh.mm but it just show hh ex 16.00 = 16.

When I test it in template it works but not in the template sensor.

but on the senor it just show HH

template sensor:

weather_timestamp_0: >
            {{ as_timestamp(state_attr('weather.lovstigen25_hourly', 'forecast')[2].datetime) | timestamp_custom('%H.%M') }}
1 Like

Tested with just the attribute code in template and it just show 16 there to…

“16.00” without any string around is interpreted as a float number by HA, then rounded to just “16”.
Not sure if it’s a bug or “work as designed”

1 Like

Perhaps it works if you use colon instead?

Anything but a dot, really :wink:

Yes anything else works but I want the dot :smile:

Any unicode character that looks like a dot but is not the “period” char will work as well, e.g. 14⋅10

You can’t. You have to use something other than a dot. HA will always interpret a dot as a period or number. You can attempt to do what koying is saying, but there’s a chance that HA will still see it as a number.

No, it will definitely only consider an “ascii dot” as a decimal separator. Anything else is considered as string, and so the whole output will be seen as a string.

Yes but if they go into character map and use the ascii character for period, it will still work even though it doesn’t look like a period :wink: Gotta remember users will be users.


{{ '3\x2E50' }}


{{ '3\u002e50' }}

will resolve 3.5


{{ '3\u202450' }}

will resolve as a string that looks like 3.5

Not sure if this works for real but it works on the template tool

{{ as_timestamp(state_attr('weather.lovstigen25_hourly', 'forecast')[2].datetime) | timestamp_custom('%H.⏱⏱') }}


This should format the way you want

            {{ as_timestamp(state_attr('weather.lovstigen25_hourly', 'forecast')[2].datetime) | timestamp_custom('%H\u2024%M') }}

Thanks, that solved it.