Automation not triggering even with the event happening

Hello! I need some help with a virtual switch that is not working as expected. The virtual switch changes from off to on via IFTTT when my cellphone gets connected to my wifi, and viceversa. Then in Smartthings I have an automation that changes the mode to Home or Away depending on the status of the virtual switch (on-Home off-Away). However, the problem is that sometimes even when the virtual switch actually changes its state, the automation doesn’t run. i.e. I can see on my devices list the virtual switch turned on but the mode did not change to Home. Any guesses on what may be happening??

Thank you very much!