Local_boolean in timestamp_custom

I’m a little confused and haven’t really found anything that explains this to me:

I have a few input_datetime inputs, most of them as just times triggering automations daily. I’ve now defined an input_datetime with both date and time - the intention is to trigger an automation at a specific time on a specific date.

For the daily automations, I trigger them like this:

  trigger:
    platform: template
    value_template: "{{ states('sensor.time') == (state_attr('input_datetime.tid_for_slukk_lys_helgedager', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"

This works fine. If input_datetime.tid_for_slukk_lys_helgedager is set to 00:05, the automation triggers at 00:05. Checking the value of the input_datetime in the template checker with:

{{ (state_attr('input_datetime.tid_for_slukk_lys_helgedager', 'timestamp') | int | timestamp_custom('%H:%M',False)) }}

I get 00:05. All well so far.
If I change the local_boolean parameter (the second parameter in timestamp_custom) to True, I get 01:05, which is not what I want, so I stick with local_boolean set to False.

However, for both time and date, I’ve set input_datetime.tid_for_sla_pa_varme_i_hytta to 2019-11-08 07:00. If I check its value in the template checker with

{{ (state_attr('input_datetime.tid_for_sla_pa_varme_i_hytta', 'timestamp') | int | timestamp_custom('%H:%M, %Y-%m-%d', False)) }}

I get 06:00, 2019-11-08. If I change the local_boolean to True, I get 07:00, 2019-11-08.

I’m not getting why I have to use local_boolean set to False for just time, but True for time and date.

Any ideas or pointers?

Yeah it’s a thing.

It tripped me up in a big way too:

I really should get around to writing the second example for the docs.

OK. Thanks for clearing that up.

So, when using the timestamp_custom filter, I’ll use local_boolean set to False then for input_datetime with time, only, and True for input_datetime with both date and time.

I got confused about this one, so I’m glad to hear this is a thing for everyone, not just me. :wink:

When you get around to it, adding an example in the docs would surely be helpful. :+1: