How I made Alexa talk to my computer through Home Assistant

So… before the age of Home Assistant in my house, I had a custom Alexa skill hosted as an https endpoint on my computer.
You can have a look at the skill in action here.

Since I started integrating Home Assistant in my house, I had to redirect all incoming traffic with the port 443 to home assistant instead of my computer, meaning I had to shutdown my favorite and most useful Alexa skill.
Well… it made me sad and I’m sorry to say, a bit useless as well, as I had grown so accustomed to asking Alexa to open apps on my computer, I didn’t even remembered where the shortcuts are.

So I set my my mind on restoring the skill using Home Assistant, this is how I made it work:

First of all, I’ve created an mqtt client and a semi-version of my original skill, you can follow the instructions for it here.

After deploying and starting my new application I’ve updated the following configuration in home assistant:

# configuration.yaml
alexa:

intent_script:
  StartAction:
    action:
      service: mqtt.publish
      data_template:
        topic: "smarthome/mqtt_client/askmypc_action"
        payload: '{{ Action }}'
        qos: 0
    speech:
      type: ssml
      text: "<speak>Sure thingboss.</speak>"

On Alexa’s side, I’ve created a custom skill following the instructions here with computer as the invocation name, and the following configuration:

Intent Schema:

{
	"intents": [{
		"slots": [{
			"name": "Action",
			"type": "LIST_OF_ACTIONS"
		}],
		"intent": "StartAction"
	}]
}

Custom Slot Type:
Type:
LIST_OF_ACTIONS

Values:
youtube
amazon developer portal
dropbox
git hub
google
calculator
excel
power point
task manager
word
gmail
facebook
excel and facebook
word and google

Sample Utterances:
StartAction open {Action}
StartAction start {Action}

The end result is I’m now able to say: Alexa, ask computer to open excel,
The request from alexa’s server will reach my home assistant which will publish excel as a payload to the topic smarthome/mqtt_client/askmypc_action.
The mqtt client running on my computer will receive the message an open excel as a desktop application.
You can see the process in action here.

If you want to shorten what you say to Alexa and don’t mind some more work, you can create a new skill for each program so you change the invocation name.

These should work

“Alexa, open excel”
“Alexa, open gmail”

1 Like

That’s actually a great idea.
I can change my echo device name to “computer”…

Computer, open excel.

:sunglasses: