#Struggling with setting the current time using action of custom:button-card

1 messages · Page 1 of 1 (latest)

compact rivet
#

I am struggling to get this simple action going. I want to set an input_datetime entity to the current time when I click the button. I assumed this would be working with the following, but it doesn't:

type: custom:button-card
section_mode: true
tap_action:
  action: call-service
  service: input_datetime.set_datetime
  target:
    entity_id: input_datetime.my_entity
  service_data:
    timestamp: "{{ now().timestamp() }}"

What am I doing wrong? I am getting the following error: "expected float for dictionary value @ data['timestamp']". Are templates not allowed in the timestamp field?