Remote control any Infrared device using ha and alexa

Hi

Using auto remote, tasker, Alexa, old phone, anymote, home assistant and various curl cmd scripts, I can now successfully change my TV channel via infra red and alexa. Alexa changes the channel in under a second using curl over a py script.

i can now… -
Say to Alexa, turn my freeview box off -

That is sent to my home automation system running on my PI -

The home automation system then calls a curl script

  • Which then triggers an OFF HTTP request using an online web service sender (AutoRemote) which is then sent to my phone

  • My phone reads this Off command (Tasker) and sends an OFF IR command to the youview box.

AutoRemote

This allows you to send a web request to an old Android phone running tasker. Each web request you send using AR can hold a different message, tasker can perform a specific action based on each message it receives.

Ha switch

switch testing curl:
platform: command_line
switches:
testing_curl:
command_on: ‘curl “https://&message=Yes”’
command_off: ‘curl “https://&message=Yes”’
friendly_name: testing_curl

I use emulated hue to discover my switch in alexa.

This is sent to an old Android device running tasker and AnyRemote.

I’m now trying to incorporate automation, so when I go into app mode on my TV, it automatically switches my amp to the correct input, using a platform state change but that isn’t working yet.

Enjoy!

Nice job!

I do a very similar thing using a broadlink rm pro, although without needing tasker or any other web service, but instead using custom Alexa intents from amazon dev account.

Its helpful isnt it, only problem i have is getting the language right:

alexa, ask home assistant to change channel to bbc one (quite lengthy, working on slimming that)

@CommonBlob Could you share any example config for the RM Pro side of things, im thinking of getting one myself, so would like to hit the ground running :slight_smile:

Can i ask if you use Broadlink’s light switches, or others such as LightwaveRF, if the later, is it controllable from the RM Pro?

Hey Daemonic,

You can check out my config here: https://github.com/CommonBlob/homeassistant_config

I dont use any light switches im afraid. Im in the UK with no neutral wire so they are no good for me, but i do have some plugs and also control tv/amp/xbox etc

Hi

You looked into lightwave rf dimmers? They comply with British Standards but are pricey. Check them out!

I have, but still not totally swayed yet. But this is my current choice for when i take the plunge :slight_smile: Do they report state?

I haven’t got it yet but I will be soon, tried out some infrared controlled dimmers and found out they are no good. I have read somewhere in the forum that they do report state.

Hello mate.

Just read your post again on alexa custom skills and was wondering if you could help me please as I am struggling setting it up.

My ISP is Virgin Media and they do not allow forwarding internal to external ports so I tried setting up custom skills using lambda but failed many times.

Could you please advise me on how you set up your custom skills on amazon’s developer page i.e. location etc.

I have a rm mini 3 and trying to get alexa to change channels on my Virgin box. Any idea on how I could set that up without using a spare android phone plugged on charge (using rm bridge or tasker plugin) waiting for its battery to explode?

Many thanks.

Sure, though i haven’t used the lambda forwarding. I have an Alexa skills kit setup on the amazon dev site.

This is my config:

My intent schema is:

{
  "intents": [
    {
      "intent": "LocateIntent",
      "slots": [
        {
          "name": "User",
          "type": "AMAZON.US_FIRST_NAME"
        }
      ]
    },
    {
      "intent": "WhereAreWeIntent",
      "slots": []
    },
    {
      "intent": "ActivateSceneIntent",
      "slots": [
        {
          "name": "Scene",
          "type": "Scenes"
        }
      ]
    },
    {
      "intent": "RunScriptIntent",
      "slots": [
        {
          "name": "Script",
          "type": "Scripts"
        }
      ]
    },
    {
      "intent": "ChangeChannelIntent",
      "slots": [
        {
          "name": "Channel",
          "type": "Channels"
        }
      ]
    }
  ]
}

Then I have the following Custom Slot types:

Then my sample utterences are:

LocateIntent Where is {User}
LocateIntent Where's {User}
LocateIntent Where {User} is
LocateIntent Where be {User}
LocateIntent Where did {User} go

WhereAreWeIntent where we are all
WhereAreWeIntent where everyone is

ActivateSceneIntent activate {Scene}

RunScriptIntent run {Script}
RunScriptIntent turn {Script}

ChangeChannelIntent watch {Channel}

Then i have my endpoint, which goes to my https server (not forgetting the api_password

That is about it on the Amazon side!

You can see my home assistant side on my github repository: https://github.com/CommonBlob/homeassistant_config

Thanks for this mate really appreciate it. May I ask who your ISP is? And have you forwarded your 443 port to 8123?

And finally how did you configure your RM pro/mini to get Alexa to change your TV channels etc?

Many thanks once again bud.

Im on Plusnet. My router is set to port forward 443 -> 8123 yes.

The config for configuring the broadlink is on my github. But essentially i have a set of automations that change the channels. (test it works locally first). Then alexa just tells HA to run these same automations.

So i say, alexa, tell home assistant to watch bbc 1. This uses the utterence: “ChangeChannelIntent” because it matches the watch {Channel}. And because bbc 1 is in the channel slot, this is the info that is passed on. If you check my channels.yaml in the alexa dir on github it has the other side of it. Also with the chanels.yaml in the automations folder.

Sorry, a lot of moving parts I know :slight_smile:

Tell homeassistant to watch BBC1 is a mouthful…

My approach allows me to simply say, Alexa, Turn BBC1 on.

@Rich_Paul I wouldn’t mind that but like I mentioned earlier having a spare old android phone on charge 24/7 is a little dodgy to me.

@CommonBlob thanks for the detailed info again. I guess I need to get another router and my super hub 2 in modem mode.

Mine works direct with rm pro, not tasker, so no android phone needed, which seems a bit clunky to me, even if my language is a bit clunky instead :slight_smile: Although i think i could get the same effect with emulated_hue, although im not sure you can do automations in that.
However this was part experiment for other things as there are some things you can’t do. Unless you want to turn everything on or off or dim.

Id be suprised if you can do a simple port forward. I think all of my routers have done that in the past, even my crappy sky one. But then, ive never been with Virgin :slight_smile:

I send tenet commands straight to my box and as they are switches, emulated hue can control them…

As above, my switch is a cmd line switch. I expose these to alexa via emulated hue, then I’m able to control each switch by the name of it…

Alexa, Turn e4 on…

Will turn my switch on which will send a tenet command straight to my box.

I cannot forward one port to another which is what is required in the custom skill set up.

Apologies - thought we were discussing my telnet project:

I charge it once every 3/4 days. It doesn’t do anything really so battery lasts.

I was charging it straight from my virgin box/tv, which meant it only started charging when I turned my TV on. So around 4hrs a day…

Iv heard of people using ifttt but the delay is 8 seconds before alexa changes the channel.

I only use the above solution to control my amp as that’s the only thing controlled by ir. A python request was about 7 seconds. A Curl request done it immediately.

I’m now using my old Android as a cctv camera, but more fir the motion detectors. My lights will come on if the sun has set and it detects motion. So iv increased the camera sensitivity and made sure it can see the TV!

If the TV ain’t on there’s a good chance I won’t be I’m that room so works for me.

I am still figuring out how to connect my tivo box to the internet like I mentioned before but I am having no joy. Did you follow or do anything specific after plugging the ethernet cable from your tivo box to your router?

Also are you using anymore or any remote for the project you described in your OP?