Triggering an Alexa skill from HA

I have an Optoma Cinemax P2 UST projector. I am trying to integrate it with the rest of my home theater which is mostly controlled by HA. So far the rest of the integration is going well using IR and some RS232. Unfortunately the Optoma has been challenging to integrate. It does not have LAN or RS-232 control. The IR control does not have discrete commands that I could find.

It does offer an option to be controlled via Alexa. Through this I can turn it on/off and switch inputs.

Any ideas on how I can create a script that can send a command to Alexa?

I do see the Alexa integration is mainly for Alexa to control HA devices and not the other way around (at least as I understand it).
Thanks

1 Like

Hi, you can trigger a skill with the custom integration for alexa. check out this Home · custom-components/alexa_media_player Wiki · GitHub . This should work out for you.

I tried that custom integration but unless I am missing something I think I am only able to control media output on other Alexa Echo etc and not other devices that are themselves connected via an Alexa skill.

After installing this custom integration and setting up the integration, can you please try this from the developer console?

service: notify.alexa_media_office
data:
  message: Attention. The water pump has been switched on.
  data:
    type: announce
    method: all

make a virtaul switch in HA that can be seen by alexa and then within alexa make a routine that does what you want when this virtaul switch is turned on … virtaul motion detect switch works best

1 Like

Great idea. I created at the virtual switch for the projector. Unfortunately it did not show up in Alexa. Also when I tried to create a routine. It is only giving me the option of using my HA door locks as a smart home trigger. Not sure why I don’t have the option of using the status of a bulb or a switch.

You are missing something… While its best known function is media and TTS notifications, the Alexa Media Player custom component can be used to trigger Alexa routines, skills, or simulate vocal commands.

If you have a routine set up in the Alexa app you can have Home Assistant trigger it in a script, automation, button, etc with a routine service call:

service: media_player.play_media
target:
  entity_id: media_player.livingroom
data:
  media_content_type: routine
  media_content_id: "Optoma Startup"

Make sure that “routine” is all lower case and that the media_content_id matches the name of your routine exactly (including capitalization, spacing, and punctuation)

The custom command service call can be used to simulate a vocal command. Just write whatever phrase you normally say to complete the action in the media_content_id field. (One exception, you can’t use the custom command function to run a routine)

service: media_player.play_media
target:
  entity_id: media_player.livingroom
data:
  media_content_type: custom
  media_content_id: "Tell Optoma to turn on"

OMG, thank you this worked. It was a lot easier than everything else I had tried. I did not realize that the media player could control more than just media.

1 Like

So I am now able to turn the projector on and off through the HA script using the routine service call.
I don’t seem to be able to get it to work to change the HDMI inputs.
Using Alexa I am able to say “Alexa, change projector to hdmi2”.
I created a new script with using the custom command to simulate the voice command above but no success.

service: media_player.play_media
data:
  media_content_id: “change projector to hdmi2”
  media_content_type: custom
target:
  entity_id: media_player.this_device

Sometimes you have to think like a robot… or pretend to speak like a robot. Try something like: “change projector to H.D.M.I. 2”

Tha is for the help. I figured out what I was doing wrong.
I was sending the command to my iPhone Alexa app instead of the Alexa hardware device.
Now input switching works as planned.

1 Like

On this alexa talk, I have been using the alexa media player and love it. I wanted to try triggering a skill using the “skill” content type and skill id in the content id. The one thing that I can’t figure out is how to pass a command to said skill. Is there an extra data parameter I can pass in? The skill I am trying to use can do a few things based on what you ask it to do. Also, has anyone used a scenario where you have a skill that requires an extra response to trigger it? Specifically , I have a stupid door lock that is wi-fi (for some reason I couldn’t get the Zigbee one at the time) and it will only work with Alexa, doesn’t work with my SmartThings anymore so I cannot lock and unlock from there. The Alexa skill requires a passcode to unlock the door (you can lock it without one). So is there a way to trigger this skill, then wait then “say” the password?

2 Likes