Asks for help at the following code:
[{"id":"fef222bb.cf0f68","type":"server-state-changed","z":"641924d1.ee878c","name":"Someone comes ๐ ","server":"f22f6e73.21e16","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"person\\..*","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"home","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":90,"y":3060,"wires":[["93caec5d.bd004"],[]]},{"id":"93caec5d.bd004","type":"delay","z":"641924d1.ee878c","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":235,"y":3060,"wires":[["4f299d8c.b81084"]],"l":false},{"id":"4f299d8c.b81084","type":"function","z":"641924d1.ee878c","name":"Filter family","func":"let family = ['person.yuval','person.rozi'];\n\nif(family.includes(msg.topic)) {\n node.status({fill:\"green\",shape:\"dot\",text:\"Family\"});\n return [msg, null];\n}\nnode.status({fill:\"green\",shape:\"dot\",text:\"Guest\"});\nreturn [null, msg];","outputs":2,"noerr":0,"initialize":"","finalize":"","x":450,"y":3060,"wires":[["ec56ac54.cab6a"],[]],"outputLabels":["Familie","Gรคste"]},{"id":"ec56ac54.cab6a","type":"ha-get-entities","z":"641924d1.ee878c","name":"๐ Get all persons","server":"f22f6e73.21e16","version":0,"rules":[{"property":"entity_id","logic":"is","value":"person\\..*","valueType":"re"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":730,"y":3060,"wires":[["ad900db3.e99f48"]]},{"id":"43949082.4131b","type":"function","z":"641924d1.ee878c","name":"Create message","func":"/** CONFIGURATION **/\n\n// These are the persons you want to include in the greeting.\nlet persons_whitelist = ['person.alice', 'person.yuval', 'person.celine', 'person.dylan'];\n\n// A random greeting will be played every time.\nlet r_greet = [\"Welcome home, \", \"It's nice to see you, \", \"Welcome back, \", \"Hey \", \"Howdy, \"];\n\n/** Optional: Localization\n * If you create a new localization, you can share it in the comments! **/\nlet l10n = {\n \"is\": \"is\",\n \"are\": \"are\",\n \"and\": \"and\",\n \"xyz_is_also_home\": (others, is_are) => others + \" \" + is_are + \" also at home. \",\n \"since\": \"since\",\n \"just_now\": \"just now\",\n \"one_minute\": \"one minute\",\n \"x_minutes\": (minutes) => minutes + \" minutes\",\n \"one_hour\": \"one hour\",\n \"x_hours\": (hours) => hours + \" hours\",\n \"one_day\": \"one day\",\n \"x_days\": (days) => days + \" days\",\n \"away_text\": (persons_with_time) => smart_join(persons_with_time.map(pwt => pwt[0] + \" left \" + pwt[1] + \" ago\")),\n \"final_text\": (text) => hour >= 0 && hour < 6 ? \"<amazon:effect name='whispered'>\" + text + \"</amazon:effect>\" : text \n}\n\n// // Below you find my template for German.\n// // You may also like my r_greet: let r_greet = [\"Willkommen zu Hause, \", \"Schรถn, dass du da bist, \", \"Willkommen zurรผck, \", \"Hallo \", \"Moin, \"];\n// let l10n = {\n// \"is\": \"ist\",\n// \"are\": \"sind\",\n// \"and\": \"und\",\n// \"xyz_is_also_home\": (others, is_are) => others + \" \" + is_are + \" auch zu Hause. \",\n// \"since\": \"seit\",\n// \"just_now\": \"gerade eben\",\n// \"one_minute\": \"einer Minute\",\n// \"x_minutes\": (minutes) => minutes + \" Minuten\",\n// \"one_hour\": \"einer Stunde\",\n// \"x_hours\": (hours) => hours + \" Stunden\",\n// \"one_day\": \"einem Tag\",\n// \"x_days\": (days) => days + \" Tagen\",\n// \"away_text\": (persons_with_time) => smart_join(persons_with_time.map(pwt => pwt[0] + \" ist seit \" + pwt[1])) + \" unterwegs.\",\n// \"final_text\": (text) => hour >= 0 && hour < 6 ? \"<amazon:effect name='whispered'>\" + text + \"</amazon:effect>\" : text \n// }\n\n/** Optional: Relations. Replace a name for a person. E.g.: Call Peter \"Dad\" for the kids */\nlet relations = {\n \"person.celine\": {\n \"person.alice\": \"Mom\",\n \"person.yuval\": \"Dad\",\n },\n \"person.dylan\": {\n \"person.alice\": \"Mom\",\n \"person.yuval\": \"Dad\",\n }\n}\n\n/** END CONFIGURATION.\n * You don't have to change anything below, but if you have a great idea on\n * how to improve this, please write a comment to share it with us! */\n\n// Join the array to a string separated by commas except the last, which gets replaced by \"and\".\nfunction smart_join(arr) { return arr.join(', ').replace(/, ([^,]*)$/, ' ' + l10n[\"and\"] + ' $1'); }\n\n// convert a Date object into a relative time\nfunction relative_time(time_value) {\n var parsed_date = Date.parse(time_value);\n var relative_to = (arguments.length > 1) ? arguments[1] : new Date();\n var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);\n\n if (delta < 60) {\n return l10n[\"just_now\"];\n } else if(delta < 120) {\n return l10n[\"one_minute\"];\n } else if(delta < (60*60)) {\n return l10n[\"x_minutes\"](parseInt(delta / 60).toString());\n } else if(delta < (120*60)) {\n return l10n[\"one_hour\"];\n } else if(delta < (24*60*60)) {\n return l10n[\"x_hours\"](parseInt(delta / 3600).toString());\n } else if(delta < (48*60*60)) {\n return l10n[\"one_day\"]\n } else {\n return l10n[\"x_days\"](parseInt(delta / 86400).toString());\n }\n}\n\n// The arriver is the person that just came home\nlet arriver = msg.data.entity_id;\nlet arriver_name = msg.data.new_state.attributes.friendly_name;\n\nlet hour = new Date().getHours();\nlet home = [];\nlet away = [];\n\n// Get all persons that are home excluding the arriver\nfor(var i=0; i<msg.payload.length; i++) {\n let current = msg.payload[i];\n if(current.entity_id != arriver) {\n\n // Rewrite names for special relations\n var other_name = (relations[arriver] || {})[current.entity_id] || current.attributes.friendly_name;\n\n if(current.state == \"home\") {\n home.push(other_name);\n } else if(persons_whitelist.includes(current.entity_id)) {\n away.push([other_name, relative_time(current.last_changed), current.last_changed]);\n }\n }\n}\n\n// Sort by away time (untested)\naway = away.sort(a => a[2]);\n\n// Create the message\n\n// Get a random greeting from r_greet\nlet greet = r_greet[Math.floor(Math.random()*r_greet.length)];\nlet is_are = home.length == 1 ? l10n[\"is\"] : l10n[\"are\"];\nlet others = smart_join(home);\n\nlet text = greet + arriver_name + \". \";\n\n// Just tell who is home when there is actually someone home\nif(home.length > 0) {\n text += l10n[\"xyz_is_also_home\"](others, is_are);\n}\n\n// Just tell who is away when there is actually someone away\nif(away.length > 0) {\n text += l10n[\"away_text\"](away);\n}\n\nmsg.payload.data = {\n message: l10n[\"final_text\"](text) \n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1020,"y":3060,"wires":[["2aa24cf5.51eaa4"]]},{"id":"ad900db3.e99f48","type":"deduplicate","z":"641924d1.ee878c","name":"","keyproperty":"payload","expiry":"120","x":875,"y":3060,"wires":[["43949082.4131b"],[]],"l":false},{"id":"da0e1181.16921","type":"inject","z":"641924d1.ee878c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"home","payload":"","payloadType":"date","x":660,"y":3180,"wires":[["ec56ac54.cab6a"]]},{"id":"78d8102a.6649e8","type":"api-current-state","z":"641924d1.ee878c","name":"Front door opened","server":"f22f6e73.21e16","version":2,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.openclose_3","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":430,"y":3140,"wires":[["4f299d8c.b81084"],[]]},{"id":"2aa24cf5.51eaa4","type":"api-call-service","z":"641924d1.ee878c","name":"๐ข Alexa","server":"f22f6e73.21e16","version":3,"debugenabled":false,"service_domain":"","service":"notify.alexa_media","entityId":"","data":"{\"data\":{\"type\":\"announce\",\"method\":\"all\"},\"target\":\"media_player.treppenhaus_echo_dot\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1240,"y":3060,"wires":[[]]},{"id":"f22f6e73.21e16","type":"server","name":"yuval_Home Assistant","version":1,"legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
I can not connect the Alexa.
Someone knows what the solution ?
Thanks