Hi guys,
For one of my Alexa based flows, I´m trying to define the room in which the echo device is located that one is speaking to. Unfortunately, the corresponding "Alexa Event" node does not deliver the information about the group which the device is assigned to. So this again means DIY
In order to do so I´m trying to create a function node, that sets a flow variable for the certain room based on the device the event was initiated from. And that´s how it looks like:
if ((msg.payload.data.domain === "Routines"))
{
flow.set("ActiveEcho",msg.payload.deviceSerialNumber)
}
if ((msg.payload.name === "Büro Echo"||"Büro Echo Show")){
flow.set("ActiveRoom","Büro")
}else if (msg.payload.name === "Bad Echo") {
flow.set("ActiveRoom","Badezimmer")
}else if (msg.payload.name === "Kinderzimmer Echo"){
flow.set("ActiveRoom","Kinderzimmer")
}else if ((msg.payload.name === "Küche Echo"||"Küche Echo Show")){
flow.set("ActiveRoom","Küche")
}else if ((msg.payload.name === "Schlafzimmer Echo links"||"Schlafzimmer Echo rechts")){
flow.set("ActiveRoom","Schlafzimmer")
}else if ((msg.payload.name === "Couch links"||"Couch rechts"||"Wohnzimmer Echo Show"||"Wohnzimmer Echo Studio")){
flow.set("ActiveRoom","Wohnzimmer")
}else{
flow.set("ActiveRoom","undefined")
}
So far, so good. However, no matter which room I initiate the alexa routine from, the "ActiveRoom" variable is always set to "Büro". Interesting wise, the "ActiveEcho" flow variable is set correctly. Now what am I doing wrong here?