I made a flow that has Alexa tell my son when to do certain things in the morning to get ready for school. It also checks a Google calendar to see if it is a “No School” day. If it’s a no school day, Alexa will say nothing. I also have a flow.snowday variable. If I send a “Snow day” or “no school” message to my telegram bot, it also will not let Alexa speak. In testing, everything works as it should. The problem is sometimes the flow.snowday somehow changes and blocks Alexa from speaking when she should. I don’t know what is causing it to change. I set an inject node to reset the flow.snowday variable and it will then allow the messages to go through. Then at some point, could be days later, the variable changes. I don’t know if it has to do when I reboot HA or not.
I replaced the telegram receiver node with an inject node and named it “Telegram Receiver”. I wasn’t sure if my token would become public.
[{"id":"f5f18a3411096ab4","type":"inject","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Breakfast","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 06 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"topic":"breakfast","payload":"","payloadType":"date","x":130,"y":2700,"wires":[["bb63b568d0d6ae3b"]]},{"id":"5ff6c2f84de5b52a","type":"inject","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"School","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"30 06 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"topic":"school","payload":"","payloadType":"date","x":120,"y":2740,"wires":[["bb63b568d0d6ae3b"]]},{"id":"eff0576fba305537","type":"inject","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Bathroom","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"40 06 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"topic":"bathroom","payload":"","payloadType":"date","x":130,"y":2780,"wires":[["bb63b568d0d6ae3b"]]},{"id":"d067407194e1b689","type":"inject","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Coat","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"50 06 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"topic":"coat","payload":"","payloadType":"date","x":110,"y":2820,"wires":[["bb63b568d0d6ae3b"]]},{"id":"58ccfa22fe433bbe","type":"alexa-remote-routine","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Announcement Livingroom","account":"5729ad6a8d7b2b74","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"msg","value":"payload.alexa"},"devices":["G090LF097022026J"]}},"x":1360,"y":2780,"wires":[[]]},{"id":"6680d0b5dfaa9b0e","type":"inject","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Bed Time","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 21 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"topic":"bed","payload":"","payloadType":"date","x":130,"y":2900,"wires":[["1c9c43d22563635f"]]},{"id":"bb63b568d0d6ae3b","type":"api-current-state","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"No School?","server":"c10d939a.00f6c","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"calendar.no_school","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":330,"y":2780,"wires":[["5fe7e898ea4618fd"],[]]},{"id":"1c9c43d22563635f","type":"function","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Content of message","func":"var name = msg.topic\nvar noSchool = msg.last_day\n\nvar line1 = [\n \"Master Logan, It is time for your breakfast.\",\n \"Logan, please take a moment from your videos to have breakfast.\",\n \"It's breakfast time Logan.\",\n \"How many times do I have to tell you Logan, it's breakfast time.\",\n \"Good morning, The cracked one. It is time for your breakfast.\"\n ];\nvar line2 = [\n \"Master Logan, it is time to get ready for school.\",\n \"Time to prepare for school.\",\n \"Prince Logan, it is time to change your clothes.\"\n ];\nvar line3 = [\n \"Please remember to brush your teeth and comb your hair, Logan.\",\n \"Logan, your comb and toothbrush await and please remember your deoderant.\",\n \"You will be even more handsome after you brush your teeth and comb your hair.\"\n ];\nvar line4 = [\n \"Master Logan, It is time for you to get your coat and mask.\",\n \"Logan, time to catch the bus.\",\n \"Don't miss the bus because your mother will not take you.\",\n \"Don't forget your coat and mask Logan, I don't want you to get cold.\",\n \"Have fun at school sweaty cracked boy. I will miss you.\"\n \n ];\nvar line5 = [\n \"Master Logan, It is your bed time and no you may not finish it.\",\n \"Good night and sleep tight Logan. I will see you in the morning.\",\n \"Logan, what did the mama bear say to the baby bear? Go to bed!\"\n ];\n\nvar done = [\n \"Enjoy your day off Master Logan.\",\n \"No school today, Master Gamer.\",\n \"Yay! I am so happy for you Logan. There is no school today!\"\n ];\n \n\n\nif (noSchool == \"true\") {\n msg.payload = {}\n msg.payload.type = 'message'\n msg.payload.alexa = done[Math.floor(Math.random() * done.length)]\n} else {\n switch (name){\n case \"breakfast\":\n msg.payload = {}\n msg.payload.type = 'message'\n msg.payload.alexa = line1[Math.floor(Math.random() * line1.length)]\n break;\n case \"school\":\n msg.payload = {}\n msg.payload.type = 'message'\n msg.payload.alexa = line2[Math.floor(Math.random() * line2.length)]\n break;\n case \"bathroom\":\n msg.payload = {}\n msg.payload.type = 'message'\n msg.payload.alexa = line3[Math.floor(Math.random() * line3.length)]\n break;\n case \"coat\":\n msg.payload = {}\n msg.payload.type = 'message'\n msg.payload.alexa = line4[Math.floor(Math.random() * line4.length)]\n break;\n case \"bed\":\n msg.payload = {}\n msg.payload.type = 'message'\n msg.payload.alexa = line5[Math.floor(Math.random() * line5.length)]\n }\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":2840,"wires":[["9b8ab909523f8c78"]]},{"id":"5fe7e898ea4618fd","type":"api-current-state","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Last Day of School?","server":"c10d939a.00f6c","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"calendar.last_student_day","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":520,"y":2780,"wires":[["30ca4e9895262aee"],["21d0e8e712feba56"]]},{"id":"21d0e8e712feba56","type":"change","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Set last_day","rules":[{"t":"set","p":"last_day","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":2840,"wires":[["1c9c43d22563635f"]]},{"id":"30ca4e9895262aee","type":"switch","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Snow Day?","property":"snowday","propertyType":"flow","rules":[{"t":"eq","v":"no","vt":"str"},{"t":"eq","v":"yes","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":2780,"wires":[["1c9c43d22563635f"],[]]},{"id":"23f348cbd46faef5","type":"inject","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Reset Snowday","props":[{"p":"payload"}],"repeat":"","crontab":"00 07 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":3040,"wires":[["f829fd0365f21e43"]]},{"id":"9b8ab909523f8c78","type":"switch","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Which Topic?","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"breakfast","vt":"str"},{"t":"eq","v":"school","vt":"str"},{"t":"eq","v":"bed","vt":"str"},{"t":"eq","v":"bathroom","vt":"str"},{"t":"eq","v":"coat","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":1120,"y":2840,"wires":[["58ccfa22fe433bbe"],["58ccfa22fe433bbe"],["58ccfa22fe433bbe"],["030bcf712ec6e0d0"],["15b9c017b2adb5f2"]]},{"id":"030bcf712ec6e0d0","type":"alexa-remote-routine","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Announcement Master Bedroom","account":"5729ad6a8d7b2b74","routineNode":{"type":"speakAtVolume","payload":{"type":"announcement","text":{"type":"msg","value":"payload.alexa"},"volume":{"type":"num","value":"70"},"mode":"set","devices":["G090LF09702202Q0"]}},"x":1370,"y":2840,"wires":[[]]},{"id":"15b9c017b2adb5f2","type":"alexa-remote-routine","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Announcement Everywhere","account":"5729ad6a8d7b2b74","routineNode":{"type":"speak","payload":{"type":"regular","text":{"type":"msg","value":"payload.alexa"},"devices":["de7fed58eee446aca7ab387b442c9d8b"]}},"x":1360,"y":2900,"wires":[[]]},{"id":"f829fd0365f21e43","type":"change","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Set snowday to \"No\"","rules":[{"t":"set","p":"snowday","pt":"flow","to":"no","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":3000,"wires":[[]]},{"id":"9fc95d1597a68c4a","type":"switch","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"Snow day","vt":"str"},{"t":"eq","v":"No school","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":350,"y":2980,"wires":[["1698d52e8ad99ff2"],["1698d52e8ad99ff2"],["f829fd0365f21e43"]]},{"id":"1698d52e8ad99ff2","type":"change","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Set snowday to \"yes\"","rules":[{"t":"set","p":"snowday","pt":"flow","to":"yes","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":2960,"wires":[[]]},{"id":"9c224402dacc32a6","type":"inject","z":"05787f38c20c568a","g":"4cb2a09444743130","name":"Telegram Receiver","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":2980,"wires":[["9fc95d1597a68c4a"]]},{"id":"5729ad6a8d7b2b74","type":"alexa-remote-account","name":"","authMethod":"proxy","proxyOwnIp":"10.0.0.29","proxyPort":"3456","cookieFile":"/config/alexa-remote2-cookie-auth/authfile.txt","refreshInterval":"3","alexaServiceHost":"pitangui.amazon.com","amazonPage":"amazon.com","acceptLanguage":"en-US","onKeywordInLanguage":"","userAgent":"","useWsMqtt":"on","autoInit":"on"},{"id":"c10d939a.00f6c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]