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

Service_template

$
0
0

Hello! I’m trying to set automation to get parameter from MQTT broker and set the input boolean state. Here is my code:

  - alias: Test
    initial_state: true
    trigger:
      platform: mqtt
      topic: matrix/WiFiPanel-0/dta
    action:
      - service_template: >
          {% if {{trigger.payload.split(" ")[1].split(";")[0].split("|")[0].split(":")[1]}} == 0 %}
          input_boolean.turn_off
          {% else %}
          input_boolean.turn_on
          {% endif %}
        data:
          entity_id: input_boolean.switch_state

But it doesn’t work. I tried to modify it in different ways, but no luck. I’m getting this error in log:

Invalid config for [automation]: Service input_boolean.turn_"{{ 'off' if {% if {{trigger.payload.split(" ")[1].split(";")[0].split("|")[0].split(":")[1]}} == 0 else 'on' }}" does not match format <domain>.<name> for dictionary value @ data['action'][2]['service_template']. Got None. (See /config/configuration.yaml, line 56).

What I’m doing wrong?

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 106176

Trending Articles



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