Alexa, Tell Home Assitant to turn off tv

I’m trying to get AlexaPi to turn off my tv.

Steps taken so far.

Installed Home Assistant / secured https
Installed AlexaPi

Both installs work fine.

I then created an Alexa Skill

the intent

{
  "intents": [
    {
      "intent": "TvControlIntent",
   "slots":
  [
    {
      "name" : "Script",
      "type" : "Scripts"
    }
  ]
    }
  ]
}

WIth a slot called turn off tv.

my config file is

alexa:
  intents:
    TvControlIntent:
      action:
        service: shell_command.pi
        data_template:
          entity_id: {{ Action }}
      speech:
        type: plaintext
        text: OK

If i call it from the test tab on Amazon dev site, it executes fine and runs the command.

If i say something like, Alexa ask home assistant to turn off tv. it won’t work. I’ve never used any of this before and i’ve done my best to google, some help would be appreciated guys.

Cheers.

May be a dumb question, but what is your invocation name for the skill?

Hey raymiec!

In your alexa yaml on home assistant, the entity id should probably be {{ Script }}

Also note that home assistant doesn’t like spaces in script names, but alexa loves them, so you may need to do a | replace(" ", “_”) to convert it to underscores. If you have any underscores in your script names that is

I just called it home assistant, then i tried assistant

just tried makes no difference, in the amazon test console it works and executes my shell command, it just seems like alexa wont recognise the skill.

I think @CommonBlob has hit on something there. If you scripts have space in them, that may be one of the major issues. This thread would be a good guideline on how to handle that; just replace scenes with scripts.

Does she respond at all?

sometimes no, other times responds with can;t find that skill etc. its actually just a shell command that im trying to run, shell_command:
pi: “sudo aplay /usr/share/sounds/alsa/Front_Center.wav” <although i’ll replace that command with a cec one to turn the tv off when i can actually get it to work. hitting test at amazon dev executes it properly.

Try a unique invocation name to see if it makes any difference. Something one word and something other than homeassistant. I called mine “Mother” after the ship’s computer in the Alien movies. LOL.

ha! i’ll give it a go now.

I changed it, it’s made no difference, i even tried saying it in my best american accent lol.

Those images are from the test at amazon so it does work, the skill also shows up in the alexa app, it does seem to be a problem with the invocation name or something.

As an American myself, almost wish I could have heard that. :wink:

odd. So you do the test and it works, then you say exactly the same thing via your echo and it doesn’t work. That’s something ive not seen, generally if it works in test, it works in voice.

When you speak do you get the same logs as above? or something different?

when i speak it i get nothing at all in HA, alexa will respond with can;t find skill etc

ah, on the first page under skill information, is you invocation name correct? Does it say home assistant? the testing page ignores this invocation name and assumes it, where when you talk to Alexa you have to say this correctly

yeah i was correct, i even tried changing it to a few different things to see if i could activate it in any way.

the skill shows in the alexa app with the correct invocation name, no other skills work, like ones from amazon, it will always tell me the skill is disabled. also i get no history of commands in the app, is this normal for AlexaPi?

if i am not mistaken, AlexaPI is not able to communicate with devices.
i hope someone proofs me wrong.

It’s not with a device, its with home assistant

you try to let Alexa see your home assistant as a device she can control.
AlexaPi only can communicate but cant send actions to Hue, emulated Hue or such devices and so also not to home assistant.

I tried it myself and didnt succeed and then found on the net that AlexaPi cant do those things.
i hope that is changed/ will change or that i am wrong, but i dont see any way to make it work at this moment.