Strange behavior with $args (from IFTTT) interpreting text as a time


#1

I’ve got a piston that received info from IFTTT via webhooks. It’s intended to set the smart switch to start at a certain time in the morning (for coffee). It works like this;

  1. Send SMS to my IFTTT number with message that’s a time value (e.g. “6:30”)
  2. IFTTT sends the message value to webCoRE via webhooks
  3. webCoRE is triggered, and sets the “@coffeetime” variable (time variable) to be the $args.message passed from webhooks/IFTTT

This works great when the message IS a time value. I can also make it watch for specific words (e.g. if $args.message is “cancel”, then do something else) BUT when I send something that is NOT a time value, then the “@coffeetime” variable ends up changing to the time that the webhooks fired from IFTTT.

I can work around this for my specific keywords, e.g. IF $args.message IS NOT “cancel”… but I can’t get it to handle non-time, non-worked-around values.

Is there any way to make webCoRE only respond if $args.message is a ##:## formatted message?

I know this is confusing; please ask if you need clarification!


#2

Hmm how about contains($args.message,":")


#3

Beautiful! Works like a charm! Thanks.