Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95397

Template in Action

$
0
0

@hub4code wrote:

I try to use a template value in a automation (action), but I do something wrong??

Action is:

entity_id: media_player.kodi
media_content_id: |
  "{{ state_attr('media_player.kodi', 'media_content_id') + 1 | int }}"
media_content_type: CHANNEL

When I test the template in the template-editor it shows me the right channel number.
When I test the service whit a number instead of the template it works also.

The log shows the following error:

"ValueError: invalid literal for int() with base 10: '"{{ state_attr(\'media_player.kodi\', \'media_content_id\') + 1 | int }}"\n'"

I tried alos with data_template and service_template, but always the same error.

What do I have to chance to use the template in a action??
Thanks

Posts: 17

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 95397

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>