From A to Snips - HA on Hass.io + external Snips guide

That’s crazy, have no idea what that could be. I mean it hears your hotword…

Maybe just try another fresh installation if there’s not much on it yet. Sometimes that saves a lot of time :wink:

I eventually manages to get SNIPS to work again.
I had to change some settings that were deleted when I did a fresh installation.
It took me hours to find the solution.
Bach on the horse :slight_smile:

Ok, back in business.

I can’t figure out how to enter the entity dynamically.

I have a location slot in snips which should refer to the media player i want to start and play a song.

In hsss i have all my media players defined with a name.

When I put {{ Location }} in the entity_id it gives an error and doesn’t work.

intent_sctipt:
PlaySong:
    speech:
        type: plain
        text: 'OK, Playing song in {{ Location }}'
    action:
      - service_template: media_player.play_media
        data_template:
            entity_id: media_player.{{ Location }}
            media_content_id: local:track:song.mp3
            media_content_type: music

media_player:
  - platform: mpd
    host: 192.168.XXX.XXX
    name: master_bedroom_player

Is Snips passing {{ Location }} in lower case with underscores?

If it is passing for example “Master bedroom player” instead, you have two options:

  1. Use the replace and lower filters to transform the Location string.

OR

  1. In Snips create a custom slot for your media players (for “Location”). In there add a value “master_bedroom_player” and give “master bedroom player” as a synonym.

Thanks.
Eventually i used the site_id parameter in snips pref file

site_id is also very cool when using satellites. I use it when the group / room is not defined. So when I am in the bedroom and just say “Lights off” it will switch them off in the bedroom.

Hey @HorizonKane,
short info to give you a feedback.
I have set up another Pi with HassIO (additionally to my Snips-PI) and got it running. I needed to modify some of your recommendation based on my requirements but more or less the “system” is running well.
Next step will be the Template-Design within Hass to get a “nice” connectivity with snips :slight_smile:
Ciao
DJ
PS: und wiederholt Grüße aus dem Pott

Cool to hear that! I got two satellites running now and one base and I am really happy with it. Wife loves it, too!

Always planned to share some of my intent scripts and the app but it’s all a mess and needs cleanup, don’t find time for that right now.

Viele Grüße :slight_smile:

Just to finish this thread off :frowning:

I switched to rhasspy: :slight_smile:


http://rhasspy.readthedocs.io/

Installation and configuration is very easy and after playing around for a few days, I find it even better than Snips as it is easier to manage but still easier to individualise, performance is the same or better.

Posting my experiences and setups in the rhasspy forum for those who are interested.

In case someone is unsure about it: you still need to add snips: to your configuration.yaml
Without it you dont get any answers from rhasspy.

This is not completely true, only if you want to use rhasppys direct HA integration (Intent Handling → Home Assistant) in rhasspy.

If you select “Remote HTTP” because you are doing your automations with Node-RED, the snips: is not necessary in configuration.yaml.

No you don’t.

You can use this (both)

intent:
intent_script:

In intent script you can create intents, also with text responses.
Check here for examples https://community.rhasspy.org/

1 Like

I am new to this. Thought i dont need it anymore for all this snips is dead info. You never know if an example may be outdated for this.
In my case rhasspy (base / sat setup on hassio) didnt say any word without snips: using this rest command

rhasspy_speak:
  url: 'http://192.168.1.222:12101/api/text-to-speech?siteId={{ siteid }}'
  method: 'POST'
  content_type: text/plain
  payload: '{{payload}}'

and this intent

GetTime:
  speech:
    text: '{{ now().strftime("%H uhr %M") }}'
  action:
    service: notify.notify
    data:
      message: "say time"

is there an better/new way for doing it?

Currently im trying to consume a product from grocy but there are too much things to learn at once. Are automations better then intents? Should i learn node red rather then using HA intents?

I am using Node-Red for my automations. I set rhasspy to Remote HTTP and put a webhook in Node-Red and handle my intents there. So I dont need snips: or intent:and dont really know the best way to handle it in HA. Were using intent scripts back then when I was using Snips but I never liked YAML scripts for automations so much because they lack the possibility to create real loops and always come to limits for more complex stuff. So I moved mostofmy automation stuff to Node-Red.

Can you clarify what you mean by “real loops”? The ability to “loop” was introduced a year ago in version 0.113 (13 versions ago) using the repeat action.

snips seems to be a dead project after it get aquired by Sonos?

Yes, because you do not end the Rhasspy session that way
Something like this should work:

intent:
intent_script:
  GetTime:
    action:
      - service: mqtt.publish
        data:
          payload_template: '{"sessionId": "{{_intent.sessionId}}", "text": "{{ now().strftime("%H uhr %M") }}"}'
          topic: hermes/dialogueManager/endSession

However, I personally use events and not intents.
They can be used in automations more easily and you do not have to restart HA every time you change or add an intent.

This is an automation example for lights (dutch)

- id: '1581372525473'
  alias: EventLampen
  trigger:
  - event_data: {}
    event_type: rhasspy_Lights
    platform: event
  condition: []
  action:
  - data_template:
      entity_id: light.{{ trigger.event.data.location }}
    service_template: light.turn_{{ trigger.event.data.action }}
  - service: mqtt.publish
    data:
      topic: hermes/dialogueManager/endSession
      payload_template: '{"sessionId": "{{trigger.event.data._intent.sessionId}}",
        "text": "Okee, {{ trigger.event.data.location }} {% if trigger.event.data.action
        == "on" %}aan{% else %}uit{%  endif %}"}'
  mode: single

If i ask the time, it blinks in several modes, then it blinks waiting for answer and after speaking it the light is immediately off. But i do not know much about it.

Maybe something else is wrong. In rhasspy settings / intent handling i always have an red [save and restart] button.
Do i need snips because its not working like expected?
No matter if i select send events or send intents, always happening the same.
In both cases my getTime and similar intents are working and notification defined in intent is sent.

In case of grocyConsume at least the notification is send. No notification and no speech and i get an Error rendering data template: UndefinedError: 'sensor' is undefined
how can i access this sensor? If i put the text in develeper tools/template it is working.
without the action part it answers, but i want to consume this item :-).

grocyConsume:
  speech:
    text: '{{ count }} {{ unit }} {{ item }} wird ausgetragen'
  action:
    - service: notify.notify
      data:
        message: >
          {%- if state_attr(sensor.grocy_stock.products) is iterable -%}
            {%- for product in state_attr('sensor.grocy_stock.products') -%}
              {%- if product.name == item %}
                {{product.id | int}}
              {% endif -%}
            {%- endfor %}"  - {{count | int}} {{product.name}} verbraucht"
          {% else -%}
            in Grocy ist {{item}} nicht vorhanden
          {% endif -%}

Trying to use an automation created from the interface with no real data i get an error about an value not being an string (explicitely changed it in yaml to product_id: 32 but it always changed back to product_id: '32'
Currently i am out of ideas. The plan was to read the id of a named product from the grocy stock sensor and use service: grocy.consume_product_from_stock
Btw, have i to use service or - service?

Enclose the entity_id in quotes.

{%- if state_attr('sensor.grocy_stock.products') is iterable -%}

Without the quotes, it’s handled like a variable name (and since that variable doesn’t actually exist, it causes the “UndefinedError” message).

In addition, that entity_id doesn’t appear to be valid. It can only have one period in it for separating the entity’s domain from its object_id. Your entity_id contains two periods and the second one is not something Home Assistant normally allows.

sensor.grocy_stock.products
      ^           ^
      |           |
This is OK        |
                  |
This is not normally permitted here.