# Alexa connection with wemo emulator

**URL:** <https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824>\
**Category:** General\
**Created:** [30 May 2023 17:42 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824 "2023-05-30T17:42:42Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![lessi](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@lessi](https://discourse.nodered.org/u/lessi)\
**Post date:** [30 May 2023 17:42 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/1 "2023-05-30T17:42:42Z")

</div>

Hello,

I am using the wemo emulator to trigger Alexa to speak. The emulator allows me to create a virtual sensor, which is triggered by my voice command to alexa and then in return triggers alexa to output a certain text/status.  
It works fine, but Alexa is "forgetting" the sensor. So after a while it does not show up in my Alexa app anymore. So the routines programmed are useless.  
Any idea why? I am fine using another Alexa node-set, if available.

> **[node-red-contrib-wemo-emulator](https://flows.nodered.org/node/node-red-contrib-wemo-emulator)**
>
> \*\*NOTE\*\* if you're upgrading from a version prior to 1.0.0, it is recommended that you get Alexa to forget all devices and rediscover. This is due to the fix to prevent duplicated wemo-emulator devices appearing in the Alexa app.

```auto
[
    {
        "id": "9eaa8043970cc501",
        "type": "alexa-remote-routine",
        "z": "6efebd3d726e36ec",
        "name": "",
        "account": "d361aae4a59c7376",
        "routineNode": {
            "type": "speak",
            "payload": {
                "type": "regular",
                "text": {
                    "type": "msg",
                    "value": "payload"
                },
                "devices": [
                    "c7f62b64c9f54f59b55bab4e8f2ca024"
                ]
            }
        },
        "x": 740,
        "y": 1980,
        "wires": [
            []
        ]
    },
    {
        "id": "705589b012bbf679",
        "type": "function",
        "z": "6efebd3d726e36ec",
        "name": "Speech writer",
        "func": "msg.payload = \"Bla bla bla p.\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 460,
        "y": 1980,
        "wires": [
            [
                "9eaa8043970cc501"
            ]
        ]
    },
    {
        "id": "0bf1dff3839577f1",
        "type": "wemo-emulator",
        "z": "6efebd3d726e36ec",
        "name": "status",
        "friendlyName": "status",
        "serial": "status",
        "port": "20002",
        "onTopic": "",
        "onPayload": "",
        "offTopic": "",
        "offPayload": "",
        "x": 190,
        "y": 1980,
        "wires": [
            [
                "705589b012bbf679"
            ]
        ]
    },
    {
        "id": "d361aae4a59c7376",
        "type": "alexa-remote-account",
        "name": "",
        "authMethod": "proxy",
        "proxyOwnIp": "192.168.0.76",
        "proxyPort": "3456",
        "cookieFile": "/opt/iobroker/node_modules/node-red ",
        "refreshInterval": "3",
        "alexaServiceHost": "layla.amazon.de",
        "amazonPage": "amazon.de",
        "acceptLanguage": "de-DE",
        "onKeywordInLanguage": "on",
        "userAgent": "",
        "useWsMqtt": "on",
        "autoInit": "on"
    }
]

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [30 May 2023 18:39 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/2 "2023-05-30T18:39:56Z")

</div>

Can not help with wemo emulator, but [node-red-contrib-alexa-remote2-applestrudel](https://flows.nodered.org/node/node-red-contrib-alexa-remote2-applestrudel) is what I use to make alexa speak and many other things. I have had no issues with it.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [30 May 2023 23:54 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/3 "2023-05-30T23:54:27Z")

</div>

If you are having issues with wemo node you could try an alternative eg

> **[node-red-contrib-virtual-smart-home](https://flows.nodered.org/node/node-red-contrib-virtual-smart-home)**
>
> A Node-RED node that represents a 'virtual device' which can be controlled via Alexa. Requires the virtual smart home skill to be enabled for your Amazon account.

> **[node-red-contrib-alexa-home-skill](https://flows.nodered.org/node/node-red-contrib-alexa-home-skill)**
>
> This node allows you to hook up Node-RED to react to your Amazon Echo.

---

<div class="post-metadata">

**Author:** ![PdeJ](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@PdeJ](https://discourse.nodered.org/u/PdeJ)\
**Post date:** [31 May 2023 20:46 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/4 "2023-05-31T20:46:21Z")

</div>

When I import your snippet I get an unknown alexa-remote-routine in addition to the wemo-emulator node and a function node. Do you mean when you say Alexa is "forgetting" the sensor that the wemo-emulator-node connection between Alexa and the device hosting node red is lost, i.e it stops listening?

I successfully use the wemo-emulator node in my Flows to act as a sensor for the Echo Dot which also acts as a bluetooth speaker, so that I can output an audio response from my Flow. Google Translate is used to convert text to sound which is output as an mp3 and converted by ffmpeg on the fly to a wav piped to aplay. When done on the fly the spaces in the url get request must be replaced by %20 in the msg.payload within the TTS function, and then enclosed in quotes.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/8/488970f528d0692f10a1d5a462c9140c077b891e.png)

```auto
    {
        "id": "79803ffb071e1fd8",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "9a4d64d7317f7e3e",
        "type": "function",
        "z": "79803ffb071e1fd8",
        "name": "TTS",
        "func": "msg.payload = encodeURIComponent(msg.payload.trim());// replace spaces with %20 for url GET REQUEST\nmsg.url =\"https://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&tl=en&q=\"+msg.payload;\nmsg.payload = \"'\"+msg.url+\"'\";// need enclose REQUEST in quotes\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 430,
        "y": 360,
        "wires": [
            [
                "9a7e4c8373b56a4d"
            ]
        ]
    },
    {
        "id": "9a7e4c8373b56a4d",
        "type": "exec",
        "z": "79803ffb071e1fd8",
        "command": "ffmpeg -i ",
        "addpay": "payload",
        "append": "-f wav - | DISPLAY=:0 aplay",
        "useSpawn": "false",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 580,
        "y": 360,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "f38514c21995d062",
        "type": "inject",
        "z": "79803ffb071e1fd8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "Status ON",
        "payloadType": "str",
        "x": 280,
        "y": 420,
        "wires": [
            [
                "9a4d64d7317f7e3e"
            ]
        ]
    },
    {
        "id": "fab0480cdccd06e6",
        "type": "wemo-emulator",
        "z": "79803ffb071e1fd8",
        "name": "status",
        "friendlyName": "status",
        "serial": "status",
        "port": "34515",
        "onTopic": "",
        "onPayload": "Status ON",
        "offTopic": "",
        "offPayload": "Status OFF",
        "x": 210,
        "y": 360,
        "wires": [
            [
                "9a4d64d7317f7e3e"
            ]
        ]
    },
    {
        "id": "0130ee0e3b36aa83",
        "type": "inject",
        "z": "79803ffb071e1fd8",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "Status OFF",
        "payloadType": "str",
        "x": 270,
        "y": 300,
        "wires": [
            [
                "9a4d64d7317f7e3e"
            ]
        ]
    }
]

```

Interestingly I too had issues when using Port 20002, as in your example.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [31 May 2023 22:58 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/5 "2023-05-31T22:58:28Z")

</div>

> [@PdeJ](#):
>
> Google Translate is used to convert text to sound which is output as an mp3 and converted by ffmpeg on the fly to a wav piped to aplay

Why not just use [node-red-contrib-alexa-remote2-applestrudel](https://flows.nodered.org/node/node-red-contrib-alexa-remote2-applestrudel) or similar ?

---

<div class="post-metadata">

**Author:** ![PdeJ](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@PdeJ](https://discourse.nodered.org/u/PdeJ)\
**Post date:** [1 June 2023 16:21 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/6 "2023-06-01T16:21:20Z")

</div>

Why, because it keeps things more local and in my control as there have been so many variant contrib-alexas its hard to know what is reliable, dependable or safe.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [1 June 2023 17:40 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/7 "2023-06-01T17:40:19Z")

</div>

Both wemo emulator and alexa-remotes use the same backend to my understanding. So neither is any more local.

---

<div class="post-metadata">

**Author:** ![PdeJ](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@PdeJ](https://discourse.nodered.org/u/PdeJ)\
**Post date:** [1 June 2023 20:06 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/8 "2023-06-01T20:06:56Z")

</div>

My understanding is that the wemo emulator is running on my local device and is accessible on my local network by the Echo device on that network. But the wemo emulator can't access my Echo device. So local control.

My reticence to dive in and use any of the contrib-alexa/echo nodes is that there are so many (17 at last count) to choose from and some are either no longer supported or deprecated. If my understanding how they operate is correct then they are dependent on the developers providing server support and go through Alexa Skills which could potentially allow the nodes to access my Echo device for any nefarious purposes. But I may have got it all wrong and am simply paranoid and naive.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [1 June 2023 20:55 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/9 "2023-06-01T20:55:25Z")

</div>

I think I have misunderstood your OG post, I use [node-red-contrib-amazon-echo (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-amazon-echo) for local emulated devices, it is old but still functional, but i have no gen 4+ amazon devices to check if it works with them.

So my last post was nonsense, my understanding was confused by my misunderstanding of your OG post.

The alexa-remote2-applestrudle is partly based on this bash script [alexa-remote-control/README.md at master · thorsten-gehrig/alexa-remote-control · GitHub](https://github.com/thorsten-gehrig/alexa-remote-control/blob/master/README.md)

---

<div class="post-metadata">

**Author:** ![lessi](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@lessi](https://discourse.nodered.org/u/lessi)\
**Post date:** [8 June 2023 15:58 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/10 "2023-06-08T15:58:53Z")

</div>

I have no problem using "node-red-contrib-alexa-remote2-applestrudel". Actually I was already using it, but I only managed that Alexa speaks for me triggered by Node-Red. But how can I make Alexa trigger Node-Red?

I basically want to ask Alexa "What is my power station currently generating?". That should trigger a specific function in Node-Red, which compiles a string like "It is generating 1500 kW" and make Alexa say that.

I only managed to set up the first part with wemo. As it was creating a sensor which I could add to the Alexa App and write a routine there. But this sensor always "vanished" from the Alexa App after a short while. How can I manage something similar with "node-red-contrib-alexa-remote2-applestrudel"?

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [8 June 2023 18:53 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/11 "2023-06-08T18:53:33Z")

</div>

Here's a link to a thread I wrote, about 2-years ago, about using Alexa with Node-RED.

> [@Pure fun with Alexa and Alexa Skills](https://discourse.nodered.org/t/pure-fun-with-alexa-and-alexa-skills/46867):
>
> Now the authentication problem with various Alexa nodes has been sorted I thought I'd try something new. I used [BluePrints](https://blueprints.amazon.co.uk/home) to create a Q&A skill called 'Give me a status report' then linked that in the flow below. I've arranged for various devices around my home to report their status to a database that is accessed from the flow and sent to the appropriate Alexa device. Here's an example of capturing feedback from Sonoff-S20 switches and writing the status to a dB.

Using BluePrints you can capture a response from Alexa and use this trigger a NR flow.

---

<div class="post-metadata">

**Author:** ![lessi](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@lessi](https://discourse.nodered.org/u/lessi)\
**Post date:** [11 June 2023 12:16 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/12 "2023-06-11T12:16:29Z")

</div>

Thanks that worked. But is there a BluePrint without a direct answer from Alexa? I want (and have) to compile the answer with NodeRed first and send that to Alexa.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 August 2023 12:17 UTC](https://discourse.nodered.org/t/alexa-connection-with-wemo-emulator/78824/13 "2023-08-10T12:17:06Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
