General

The tool Node-RED is a webservice which offers you a flow in which you can drag & drop nodes and connect them with wires.
You can create Alexa Devices with Alexa Home Bridge, create nodes in the flow and do anything with the received data. Passing it to HomeAssistant is only one option.

If you dont want to use a Smart Home Skill and register for Alexa Home Bridge you can install nodes which provide light accessories through the local network, which is easier and more elegant, but you WILL not have the same functionality.
Because I want to control other devices than lights with my Echo Dot I chose the Skill variant.

 Why It Is Worth The Time

  • Huge Alexa configuration possibilies (triggering multiple entities with one Alexa Device like in my flow)
  • Tons of different nodes:
    • tcp
    • telegram-bot
    • email
    • twitter
    • raspberry-nodes (GPIOs, …)
  • Fast Deployment (try deploy options!)

Things You Need

If you don’t want to learn it by yourself you can use, reverse engineer or adapt my flow.
Simply paste it into Node-RED and see how you route the data from Alexa to Home Assistant.
Simply hit deploy to save and start the flow.

[{
	"id": "69cf8328.44711c",
	"type": "api-call-service",
	"z": "6073bb17.cb28c4",
	"name": "Subwoofer",
	"server": "2c691150.b23e3e",
	"service_domain": "switch",
	"service": "",
	"data": "{ \"entity_id\":\"switch.subwoofer\"}",
	"mergecontext": "",
	"x": 1050,
	"y": 320,
	"wires": [
		[]
	],
	"icon": "node-red-contrib-home-assistant/home.png"
}, {
	"id": "f12e6803.d664a8",
	"type": "alexa-home",
	"z": "6073bb17.cb28c4",
	"conf": "5130a5be.bea9ac",
	"device": "22622",
	"acknoledge": true,
	"name": "Subwoofer",
	"topic": "",
	"x": 240,
	"y": 320,
	"wires": [
		["dc0fc90d.fee878"]
	]
}, {
	"id": "5048b665.4817d8",
	"type": "alexa-home",
	"z": "6073bb17.cb28c4",
	"conf": "5130a5be.bea9ac",
	"device": "22621",
	"acknoledge": true,
	"name": "Licht",
	"topic": "light",
	"x": 230,
	"y": 240,
	"wires": [
		["9cfb9d38.4667e", "160afb1f.bb26a5"]
	]
}, {
	"id": "a17e21c2.a2c7",
	"type": "api-call-service",
	"z": "6073bb17.cb28c4",
	"name": "LED Strip",
	"server": "2c691150.b23e3e",
	"service_domain": "light",
	"service": "",
	"data": "{\"entity_id\":\"light.led_strip\"}",
	"mergecontext": "",
	"x": 1040,
	"y": 240,
	"wires": [
		[]
	],
	"icon": "node-red-contrib-home-assistant/home.png"
}, {
	"id": "9073ecb6.978c6",
	"type": "api-call-service",
	"z": "6073bb17.cb28c4",
	"name": "Ikea Lamp",
	"server": "2c691150.b23e3e",
	"service_domain": "light",
	"service": "",
	"data": "{\"entity_id\":\"light.roomlight\"}",
	"mergecontext": "",
	"x": 1050,
	"y": 160,
	"wires": [
		[]
	],
	"icon": "node-red-contrib-home-assistant/home.png"
}, {
	"id": "9cfb9d38.4667e",
	"type": "function",
	"z": "6073bb17.cb28c4",
	"name": "HA Payload",
	"func": "var message = {};\nmessage.payload = {};\n\nswitch(msg.command){\n case \"TurnOnRequest\":\n message.payload.service=\"turn_on\"\n message.payload.data={\"brightness_pct\":\"100\"}\n break;\n case \"TurnOffRequest\":\n message.payload.service=\"turn_off\"\n break;\n case \"SetPercentageRequest\":\n message.payload.service=\"turn_on\"\n message.payload.data={\"brightness_pct\":msg.payload}\n break;\n case \"SetColorRequest\":\n message.payload.service=\"turn_on\"\n message.payload.data={\"brightness_pct\":msg.payload.brightness * 100.0, \"hs_color\": [msg.payload.hue, msg.payload.saturation * 100.0]}\n break;\n case \"SetColorTemperatureRequest\":\n message.payload.service=\"turn_on\"\n message.payload.data={\"brightness_pct\":\"100\"}\n break;\n}\n\nreturn message;",
	"outputs": 1,
	"noerr": 0,
	"x": 650,
	"y": 240,
	"wires": [
		["a17e21c2.a2c7"]
	]
}, {
	"id": "caca1c6e.1f4f3",
	"type": "alexa-home",
	"z": "6073bb17.cb28c4",
	"conf": "5130a5be.bea9ac",
	"device": "22693",
	"acknoledge": true,
	"name": "Deckenlicht",
	"topic": "",
	"x": 250,
	"y": 160,
	"wires": [
		["160afb1f.bb26a5"]
	]
}, {
	"id": "dc0fc90d.fee878",
	"type": "function",
	"z": "6073bb17.cb28c4",
	"name": "HA Payload",
	"func": "var message = {};\nmessage.payload = {};\nswitch(msg.command){\n case \"TurnOnRequest\":\n message.payload.service=\"turn_on\"\n break;\n case \"TurnOffRequest\":\n message.payload.service=\"turn_off\"\n break;\n}\nreturn message;",
	"outputs": 1,
	"noerr": 0,
	"x": 650,
	"y": 320,
	"wires": [
		["69cf8328.44711c"]
	]
}, {
	"id": "934b6bd.395c098",
	"type": "alexa-home",
	"z": "6073bb17.cb28c4",
	"conf": "5130a5be.bea9ac",
	"device": "22694",
	"acknoledge": true,
	"name": "Computer",
	"topic": "",
	"x": 240,
	"y": 400,
	"wires": [
		["d306da82.3672e8"]
	]
}, {
	"id": "d306da82.3672e8",
	"type": "function",
	"z": "6073bb17.cb28c4",
	"name": "HA Payload",
	"func": "var message = {};\nmessage.payload = {};\nswitch(msg.command){\n case \"TurnOnRequest\":\n message.payload.service=\"turn_on\"\n break;\n case \"TurnOffRequest\":\n message.payload.service=\"turn_off\"\n break;\n}\nreturn message;",
	"outputs": 1,
	"noerr": 0,
	"x": 650,
	"y": 400,
	"wires": [
		["d4beee5a.acdd3"]
	]
}, {
	"id": "d4beee5a.acdd3",
	"type": "api-call-service",
	"z": "6073bb17.cb28c4",
	"name": "Desktop",
	"server": "2c691150.b23e3e",
	"service_domain": "switch",
	"service": "",
	"data": "{ \"entity_id\":\"switch.desktop\"}",
	"mergecontext": "",
	"x": 1040,
	"y": 400,
	"wires": [
		[]
	],
	"icon": "node-red-contrib-home-assistant/home.png"
}, {
	"id": "160afb1f.bb26a5",
	"type": "function",
	"z": "6073bb17.cb28c4",
	"name": "HA Payload",
	"func": "var message = {};\nmessage.payload = {};\n\nswitch(msg.command){\n case \"TurnOnRequest\":\n case \"TurnOffRequest\":\n message.payload.service = \"toggle\"\n break;\n}\n\nreturn message;",
	"outputs": 1,
	"noerr": 0,
	"x": 650,
	"y": 160,
	"wires": [
		["9073ecb6.978c6"]
	]
}, {
	"id": "2780d595.3f1a2a",
	"type": "alexa-home",
	"z": "6073bb17.cb28c4",
	"conf": "5130a5be.bea9ac",
	"device": "22697",
	"acknoledge": true,
	"name": "Spotify",
	"topic": "",
	"x": 230,
	"y": 480,
	"wires": [
		["a9dc5e3b.e2a54"]
	]
}, {
	"id": "a9dc5e3b.e2a54",
	"type": "function",
	"z": "6073bb17.cb28c4",
	"name": "HA Payload",
	"func": "var message = {};\nmessage.payload = {};\nswitch(msg.command){\n case \"TurnOnRequest\":\n message.payload.service=\"media_play_pause\"\n break;\n case \"TurnOffRequest\":\n message.payload.service=\"media_play_pause\"\n break;\n}\nreturn message;",
	"outputs": 1,
	"noerr": 0,
	"x": 650,
	"y": 480,
	"wires": [
		["357b3352.a86b4c"]
	]
}, {
	"id": "357b3352.a86b4c",
	"type": "api-call-service",
	"z": "6073bb17.cb28c4",
	"name": "Spotify",
	"server": "2c691150.b23e3e",
	"service_domain": "media_player",
	"service": "",
	"data": "{ \"entity_id\":\"media_player.spotify\"}",
	"mergecontext": "",
	"x": 1030,
	"y": 480,
	"wires": [
		[]
	],
	"icon": "node-red-contrib-home-assistant/home.png"
}, {
	"id": "a245a52b.a8d8b8",
	"type": "tcp in",
	"z": "6073bb17.cb28c4",
	"name": "NCID",
	"server": "client",
	"host": "192.168.2.1",
	"port": "3333",
	"datamode": "stream",
	"datatype": "utf8",
	"newline": "\\n",
	"topic": "",
	"base64": false,
	"x": 230,
	"y": 680,
	"wires": [
		["329df2a6.79cbbe"]
	]
}, {
	"id": "329df2a6.79cbbe",
	"type": "function",
	"z": "6073bb17.cb28c4",
	"name": "Process Call",
	"func": "var message = {};\nmessage.payload = {};\n\nif (msg.payload.startsWith(\"CID\")) {\n var array = msg.payload.split(\"*\");\n var number = array[array.indexOf(\"NMBR\") + 1];\n message.payload.data = {\"message\": number + \" is calling right now.\", \"data\": {\"subtitle\": \"Should you pick up?\"}};\n}\n\nreturn message;",
	"outputs": 1,
	"noerr": 0,
	"x": 650,
	"y": 680,
	"wires": [
		["814a58be.b8ad48"]
	]
}, {
	"id": "814a58be.b8ad48",
	"type": "api-call-service",
	"z": "6073bb17.cb28c4",
	"name": "Notification",
	"server": "2c691150.b23e3e",
	"service_domain": "notify",
	"service": "ios_jphone",
	"data": "",
	"mergecontext": "",
	"x": 1060,
	"y": 680,
	"wires": [
		[]
	]
}, {
	"id": "2c691150.b23e3e",
	"type": "server",
	"z": "",
	"name": "Home Assistant",
	"url": "http://localhost:8123",
	"pass": "YourPasswordHere"
}, {
	"id": "5130a5be.bea9ac",
	"type": "alexa-home-conf",
	"z": 0,
	"username": "YourUsername"
}]

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.