How to control Amazon smart plugs from Home Assistant (via emulated_hue and alexa media player)

I am running HA in docker on a pi (raspberry pi 3b) too. I am using host_ip address as the same IP address of my pi as assigned by my router (which I have set the assignment to a static IP address).

Also, I assume you had restarted HA to make emulated_hue take effect?

Did you try the troubleshooting steps here:

In particular, try these links (again using your pi’s IP address in place of the HA IP Address below):
http://<HA IP Address>:80/description.xml
http://<HA IP Address>:80/api/v2/lights
(Preferably, access these links on the same cell phone you are running your Alexa app.)

For me, I am able to see the emulated_hue devices I am “exposing” to Alexa.

In the alexa app, did you try the add “other” device method?
Go to Devices > “+” (top right corner) > Add Device > Other (last in the list) > “Can’t find a matching logo?” > “Not Sure?” > “Alexa is looking for devices to connect…”
(I’m using android alexa app version 2023.23 Build 2.2.542657.0)

After 45 secs or so, you should be able to see the emulated_hue devices.

So great, got this to work right away - thx for this!

However, and maybe I overlooked it in the replies, how do I use the amazon plug entity as a device in an automation? While having a nicely working tile on my dashboard using the entity, I cannot add the plug as a device in an automation.

How do I do that?

You mean using the amazon plug entity automation in home assistant, right? In my example (in post #2), you can use input_boolean.alexa_ha_lr_light as the trigger in your automation.

I typically add my automation in the HA UI interface:
Settings > Automations & scenes > “+ CREATE AUTOMATION” > Create new automation

Triggers > + ADD TRIGGER > select “State” > in “Entity” field, type “LR light” (my example) to search to the amazon plug entity:

Then from there on, you can add trigger condition and action.

Here’s an example of automation where the “LR light” (the virtual amazon smart plug in HA) triggers a notification to my S10 cell phone:

alias: HA example
description: ""
  - platform: state
      - input_boolean.alexa_ha_lr_light
    to: "on"
condition: []
  - service: notify.mobile_app_sm_g973u1
      message: LR light is turned ON!
mode: single

With this, I can use the Alexa app, the HA app, or even say “Alexa, turn on LR light” to turn on the amazon plug, and it will send me a notification on my cell phone.

No, not like this.
I want to use the plug as action. For example, I want to include the plug in my holiday decoration automation. What puzzles me is that I can switch the plug as entity from a dashboard tile, but I cannot have it as a device to switch it in an automation.

Like this?

alias: LR light ON at night
description: ""
  - platform: time
    at: "23:35:00"
condition: []
  - service: input_boolean.turn_on
    data: {}
      entity_id: input_boolean.alexa_ha_lr_light
mode: single
1 Like

Wow, never made it there. Service… need to learn this.

Fantastic, works! My automation is now switching Shellies and Amazon plugs. Thanks a million!

Hi all, signed up just for this thread, I am brand new to HA and already have a couple Kasa Smart Plugs which work great in HA; but today Amazon is blowing out these Smart plugs for just $5 Canadian bucks! Is there any major issues or struggles to get them added to Home Assistant if I just want to utilize basic on/off functionality? And potentially on a schedule?

Kasa was super easy to be recognized and didn’t need any weird code fiddling like you guys are writing above… I’d just pay more if I had to :face_with_spiral_eyes::sweat:

Thanks in advance for any suggestions!

AFAIK the only way to integrate Amazon smart plugs into HA without going through HA cloud (nabu casa) is via the method in this thread.

As you’ve already experienced, the Kasa plugs integrate well into both Alexa and HA, and are super responsive. The amazon hack via AMP here has a bit of lag.

Personally I would just buy the kasa smart plugs. They are often on sale. In US, the 4-pack is currently US$22:


Darn, it has already arrived, but you are totally correct, the Kasa worked super easily and are indeed very responsive. The $5 price suckered me in I guess LOL, darn

Alexa question: When using this method (communicating with Amazon smart plug through Alexa) doesn’t Alexa require an internet connection (to parse the request)?

Yes it requires Alexa to be connected to the internet for this to work.

So… do you need to have a Spy Speaker in your house?