Getting the error message "expected float for dictionary value" despite it looks to be float

Hi everyone, this is the automation I set up:

alias: Google Home - Imposta volume soggiorno
  description: ''
  trigger:
  - event_data:
      action: increase_vol_soggiorno
    event_type: ifttt_webhook_received
    platform: event
  condition: []
  action:
  - data:
      volume_level: '{{ ((trigger.event.data.volume_level|int)/100) | float }}'
    entity_id: media_player.soggiorno
    service: media_player.volume_set
  mode: single

It basically should get the volume_level data from the webhook json as integer number and use it to set up the volume level of the media player after converting it to float dividing by 100.

I tested the code within the templates view and I actually get a float number, so it looks like the code for the math is right.

Could you please help me to understand what I’m doing wrong?

Thanks a lot!!

Change data: to data_template:

Thank you for your very quick reply… I thought about something like that 'cause I saw that in other posts, but since for my other automation I didn’t have to do that, I thought it was not the issue… Thank you !!!

1 Like

If you have a template in the data you have to use data_template. Your other automation likely does not have a template.

Understood. Thank you again !