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

Syntax For Using Service Template Variables

$
0
0

I am trying to use a template variable when calling a service. See my configuration below. If I set the topic to a string it works fine, I just can’t seem to figure out the syntax when I set it to the below template.

configuration.yaml

notify:
  - name: ntfy
    platform: rest
    resource: https://ntfy.domain.name/
    method: POST_JSON
    authentication: basic
    username: !secret ntfy_username
    password: !secret ntfy_password
    title_param_name: title
    message_param_name: message
    data:
      topic: "{{ ntfy_topic }}"

Testing service call

service: notify.ntfy
data:
  message: "Test #1"
  data:
    variables: 
      ntfy_topic: test

This doesn’t work. Anyone have any hints? I do see the following error in the logs, which suggest this should work if I can figure out the syntax.

Logger: homeassistant.helpers.template
Source: helpers/template.py:419
First occurred: 8:33:19 PM (13 occurrences)
Last logged: 9:39:16 PM

Template variable warning: 'ntfy_topic' is undefined when rendering '{{ ntfy_topic }}'

How do I define ntfy_topic when I call the service?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106377

Trending Articles



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