Media seek position excepted float, using a template

alias: change chromecast media position to 39.99
sequence:
  - service: media_player.media_seek
    data:
      seek_position: {{ 50 - 10.01 }}
    target:
      entity_id: media_player.chromecast_audio
mode: single

I’m trying to use value templates to change the media position of a media player, but seek_position won’t accept {{ 50 - 10.01 }} (excepted float for dictionary value) while it does support 39.99. anyone knows what’s up? Thank you

The template is missing outer quotes.

Reference: Important Templating Rules

alias: change chromecast media position to 39.99
sequence:
  - service: media_player.media_seek
    data:
      seek_position: '{{ 50 - 10.01 }}'
    target:
      entity_id: media_player.chromecast_audio
mode: single
1 Like

Ah, rookie mistake. Thank you!

1 Like

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.