Problems with configuring Snips

I set up Snips (using the mkloeckner app) and detecting my speech is working but I need some assistance on the home assistant site. Snips is working as intended.
Here is what I can see in mqtt:

hermes/intent/agre:ActivateObject {"sessionId":"9d4bc731-4166-4d77-86d4-458377c0f7a4","customData":null,"siteId":"default","input":"schalte den fernseher ein","asrTokens":[[{"value":"schalte","confidence":0.8653383,"range_start":0,"range_end":7,"time":{"start":0.0,"end":0.95144314}},{"value":"den","confidence":0.55904347,"range_start":8,"range_end":11,"time":{"start":0.9530082,"end":1.5899999}},{"value":"fernseher","confidence":1.0,"range_start":12,"range_end":21,"time":{"start":1.5899999,"end":1.7099999}},{"value":"ein","confidence":1.0,"range_start":22,"range_end":25,"time":{"start":1.7099999,"end":2.52}}]],"intent":{"intentName":"agre:ActivateObject","probability":0.92501414},"slots":[{"confidence":1.0,"rawValue":"fernseher","value":{"kind":"Custom","value":"Fernseher"},"range":{"start":12,"end":21},"entity":"mkloeckner/object","slotName":"device"}]}

And here is the sam watch output:

[10:48:52] [Nlu] was asked to parse input "schalte den fernseher ein"
[10:48:52] [Nlu] detected intent agre:ActivateObject with probability 0.925 for input "schalte den fernseher ein"
              Slots ->
                 device -> Fernseher (confidence: 1.000)
[10:48:52] [Dialogue] New intent detected agre:ActivateObject with probability 0.925
              Slots ->
                 device -> Fernseher (confidence: 1.000)
[10:48:58] [Dialogue] session with id '9d4bc731-4166-4d77-86d4-458377c0f7a4' was ended on site default. The session was ended because one of the component didn't respond in a timely manner
[10:48:58] [Asr] was asked to stop listening on site default
[10:48:58] [Hotword] was asked to toggle itself 'on' on site default

So simple turning on/off worked but now I want to have if/else conditions to get multiple devices to work. At first I want to start my harmony activity. Here is what I got so far:

ActivateObject:
    card:
      type: simple
      title: Turn object on
      content: Ask Home Assistant to turn {{ device }} on
    action:
      service_template: >
       {%- if device == "Fernseher" -%}
          remote.turn_on
       {%- else -%}
          homeassistant.turn_on
       {%- endif -%}
      data_template:
        entity_id: >
          {%- if device == "Fernseher" -%}
           remote.harmony_hub
          {%- elif device == "test" -%}
            group.
          {%- elif device == "test2" -%}
            switch.
          {%- endif -%}
        data: >
          {%- if device == "Fernseher" -%}
            activity: "Fernsehen"
          {%- endif -%}

I cant get it to work. Can someone tell me what Iā€™m missing?

Test it using the service tools on the frontend, either your service or entity_id is not getting est to the proper value. What do the HA logs say about it?

Your syntax is also wrong in that you are mixing data and data_template, just use data_template.

      data_template:
        entity_id: >
          {%- if device == "Fernseher" -%}
           remote.harmony_hub
          {%- elif device == "test" -%}
            group.
          {%- elif device == "test2" -%}
            switch.
          {%- endif -%}
        activity: >
          {%- if device == "Fernseher" -%}
            "Fernsehen"
          {%- endif -%}
1 Like

Okay, here is the updated part:

ActivateObject:
    card:
      type: simple
      title: Turn object on
      content: Ask Home Assistant to turn {{ device }} on
    action:
      service_template: >
       {% if device == "Fernseher" %}
          remote.turn_on
       {% else %}
          homeassistant.turn_on
       {% endif %}
      data_template:
        entity_id: >
          {% if device == "Fernseher" %}
           remote.harmony_hub
          {% elif device == "test" %}
            group.
          {% elif device == "test2" %}
            switch.
          {% endif %}
        activity: >
          {% if device == "Fernseher" %}
            "Fernsehen"
          {% endif %}

When using the service tools the harmony activity is launched succesfully (see pic below).

Screenshot_20190116_172343

Hmm, although it seems to not like that activity being set when I test from the front end. So what you would need to do is set a script to do remote turn on, so something like this

IntentScript:
  ActivateObject:
    card:
      type: simple
      title: Turn object on
      content: Ask Home Assistant to turn {{ device }} on
    action:
      service_template: >
       {%- if device == "Fernseher" -%}
          script.turn_on
       {%- else -%}
          homeassistant.turn_on
       {%- endif -%}
      data_template:
        entity_id: >
          {%- if device == "Fernseher" -%}
           script.harmony_fershern
          {%- elif device == "test" -%}
            group.
          {%- elif device == "test2" -%}
            switch.
          {%- endif -%}


Script:
  name: harmony_ferneshen
  service: remote.turn_on
  entity_id: remote.harmony_hub
  data:
    activity: Fernshern

The above is 100% fake code so you will need to work through the syntax, just giving you an idea