Sending input_timedate via MQTT

I am trying to send input_timedate entity via MQTT. The entity contains only time ( has_time: true). To do this I am using automation that triggers on input_datetime change. Let say the initial time is 13:00.
If the payload set in my automation is like this:
payload: "{{ states('input_datetime.user_time') }}"
and If I enter 14 in the hour field (for example, it is the same with any hour)
then the payload is “14:00:00” .
But I want to send only Hour and Minutes. To do this I change the payload as follows:
"{{ state_attr('input_datetime.user_time', 'timestamp') | timestamp_custom('%H:%M') }}"
If I enter 14 in the hour field then “16:00” was sent instead if “14:00”. The hour sent is always +2 hours regardless of hour entered.
How can I send only Hour and Minutes?

I’ll appreciate any help on this.

Regards!

Change this:

timestamp_custom('%H:%M')

To this:

timestamp_custom('%H:%M', false)

Thanks!!! It works fine now!!!

1 Like