Notify file timestamp hour to early

my configuration.yaml file contains time_zone: Europe/Amsterdam
via ssh and use command date i get: 11:00 CET
I use a file notify and use the following code in the automation:

data_template: 
        message: '({{ now().strftime("%H:%M") }}) # {{states.sensor.dim_01.attributes.battery_level}}'

the output is:
2019-01-07T10:00:00.153014+00:00 (11:00) # 11

So why is the time from the timestamp 10:00 and not 11:00? Can this be corrected?
I can create my own message without the timestamp but still wonder why it is incorrect.

now() is stored in UTC, which is timezone 00:00. You are in timezone 01:00. 10:00 + your timezone offset.

if you want to create your own timestamp, you can’t use the builtin datetime strftime. You gotta use the filter. The filter adjusts based on your timezone.

Also, you should steer clear of using #. It typically represents a comment, it could screw with your yaml.

data_template: 
  message:'({{ now().timestamp() | timestamp_custom("%H:%M") }}) # {{states.sensor.dim_01.attributes.battery_level}}'
1 Like