Snips and Home assistant : can't run python script


this is my intent_scripts.yaml:


this is my python_scripts/ :

stanza = data.get('stanza')
numero = data.get('numero')'AccendiLuciSnips')

if stanza is not None:
# Attento che in sala hai anche la luce.strip_sala
  if stanza == 'sala'
    entity_id = 'light.luce_{}'.format(stanza)'AccendiLuciSnips1 ' + entity_id)
    if numero is not Nome:
      entity_id = 'light.{}'.format(stanza) + '_' + numero'AccendiLuciSnips2 ' + entity_id)
    entity_id = 'light.{}'.format(stanza)'AccendiLuciSnips3 ' + entity_id)


entity_id = "light.luce_sala_1"
service_data = {'entity_id': entity_id }'light', 'turn_on', service_data, False)

(I know it’ s all comment right now becuse I am debugging it!)

Within mosquitto (.68 is HA)

mosquitto_sub -h -t hermes/intent/boggiano:AccendiLuci

I see:
{"sessionId":"1ae7cb1b-86b2-437f-92f1-885468dbdab9","customData":null,"siteId":"default","input":"accendi luce sala","asrTokens":[[{"value":"accendi","confidence":1.0,"rangeStart":0,"rangeEnd":7,"time":{"start":0.0,"end":1.14}},{"value":"luce","confidence":1.0,"rangeStart":8,"rangeEnd":12,"time":{"start":1.14,"end":1.8299999}},{"value":"sala","confidence":1.0,"rangeStart":13,"rangeEnd":17,"time":{"start":1.8299999,"end":2.52}}]],"asrConfidence":1.0,"intent":{"intentName":"boggiano:AccendiLuci","confidenceScore":1.0},"slots":[{"rawValue":"sala","value":{"kind":"Custom","value":"Sala"},"range":{"start":13,"end":17},"entity":"Stanza","slotName":"stanza","confidenceScore":1.0}]}

But I dont’ see any log in HA (of course the light remains off!)

If I manually lunch the script from the HA service page I see the logger lines and the light goes on.

Moreover I dont’ see any log line telling me:

[homeassistant.components.snips] Received unknown intent boggiano:AccendiLuci

So i think that the intent is triggered but the script doesn’t run.

Any idea ?


Answer to myself:
the problem was the indentation into the file intent_script.yaml.

This is correct:

    service: python_script.action_boggiano_accendiluci_boggiano_luciha
      stanza: "{{stanza}}"

Glad you got it! The ‘Dialogue ended’ is because it didn’t get an endsession msg as you thought. You can add a speech section to your intent script. If you don’t want it to say anything you can safely ignore the error and keep it like you have it.