Making web request to IFTTT


#22

Yes, but this is a WHILE statement so it runs forever when the door is open… meaning that only the first two announcements would ever be accurate if hard coded. That said, how can I make it run max of 4 announcements? Anything beyond that would be toooo naggy (and too many text messages, once I get that working). I’m thinking refrigerator repair, or some other crazy reason where it might be acceptable for door to be open for a very long time… definitely dont want ‘no limit’ to the notifications.


#23

While contact is open and variable is less than 4. After all the notifications increment the variable. Below the while statement reset the variable

I gave two options. Just add another 1 sec wait.


#24

LOL… genius.
Did I do the variables correctly here?


#25

Looks right to me


#26

Interesting… So I added another wait for 1 second and that issue is solved. But then I tested:
2 minute announcement said the word “Attention” THREE times.
4 minute announcement said the word “Attention” FOUR times.
Still no SMS received - I tried my 10 digit phone number and I tried preceding it with country code (1 for United States).


#27

This should be helpful for anyone looking to setup ifttt webhooks of any kind.


#28

Turn your logging to full. Add log to console error age([refrigerator:contact]) after the first message and the second message.


#29

I can’t imagine why the speak text would say the word ‘attention’ extra times??

But with your SMS, in the UK, for my number starting with 07950, I have to type +447950…

I have no idea about the format of US numbers, but maybe you need to type +1 and then remove the leading zero from your phone number?


#30

Just tested the phone number part. I only used my 10 digit number. No country code needed for the US.

I have a feeling the time is not falling between the range setup so the sms is never getting executed


#31

Perhaps change:

Wait 2 minutes
Wait 1 second

To:

Wait 61 seconds… my minds not fully on it today but maybe the two triggers 1 second apart is causing the error. After all, the word ‘attention’ takes about 1 second to speak.


#32

Yeah, I tried with the 1 and I tried +1
Neither worked for me.


#33

Funny thing is the range between 210000 and 270000 gives a clear 30 second window either side of the 4 minute mark… 3 1/2 - 4 1/2 minutes… and it sent me texts just fine with that range.


#34

Ok, I’ll change the WAIT time and see what happens. Before changing it, I just tested again:
2 min: “Attention” was said 3 times. OPEN TIME SAID ONE MINUTE
4 min: “Attention” was said 4 times. OPEN TIME SAID THREE MINUTES


#35

I don’t understand. I put the logging to full… should I post it?


#36

Please start providing logs. We can all stop throwing darts in the dark.

The log to console was so we can see what the time is outputting as


#37

12/6/2017, 1:21:53 PM +63ms
+0ms ╔Starting piston… (v0.2.0ff.20171129)
+321ms ║╔Subscribing to devices…
+338ms ║║Subscribing to Refrigerator.contact…
+454ms ║║Subscribing to Kitchen Sonos…
+455ms ║╚Finished subscribing (150ms)
+486ms ║Comparison (enum) closed is (string) open = false (2ms)
+494ms ║Comparison (integer) 0 is_less_than (integer) 4 = true (4ms)
+512ms ║Calculating (enum) closed + (error) Variable '
+522ms ║Comparison (error) Invalid device is_between (integer) 210000 … (integer) 270000 = false (4ms)
+541ms ╚Piston successfully started (541ms)
12/6/2017, 1:15:53 PM +798ms
+1ms ╔Received event [Refrigerator].contact = closed with a delay of 184ms
+90ms ║RunTime Analysis CS > 13ms > PS > 42ms > PE > 35ms > CE
+104ms ║Runtime (41838 bytes) successfully initialized in 42ms (v0.2.0ff.20171129) (101ms)
+104ms ║╔Execution stage started
+114ms ║║Comparison (enum) closed is (string) open = false (2ms)
+115ms ║║Cancelling condition #9’s schedules…
+116ms ║║Condition #9 evaluated false (6ms)
+117ms ║║Cancelling condition #14’s schedules…
+118ms ║║Condition group #14 evaluated false (state changed) (8ms)
+119ms ║║Cancelling condition #1’s schedules…
+119ms ║║Condition group #1 evaluated false (state changed) (10ms)
+122ms ║║Cancelling statement #16’s schedules…
+127ms ║║Executed virtual command setVariable (3ms)
+129ms ║╚Execution stage complete. (25ms)
+138ms ╚Event processed successfully (138ms)
12/6/2017, 1:15:39 PM +389ms
+0ms ╔Received event [Refrigerator].contact = open with a delay of 69ms
+75ms ║RunTime Analysis CS > 12ms > PS > 33ms > PE > 31ms > CE
+85ms ║Runtime (41840 bytes) successfully initialized in 33ms (v0.2.0ff.20171129) (83ms)
+86ms ║╔Execution stage started
+95ms ║║Comparison (enum) open is (string) open = true (1ms)
+97ms ║║Cancelling condition #9’s schedules…
+97ms ║║Condition #9 evaluated true (6ms)
+101ms ║║Comparison (integer) 0 is_less_than (integer) 4 = true (1ms)
+102ms ║║Condition #15 evaluated true (4ms)
+103ms ║║Cancelling condition #14’s schedules…
+104ms ║║Condition group #14 evaluated true (state changed) (13ms)
+105ms ║║Cancelling condition #1’s schedules…
+106ms ║║Condition group #1 evaluated true (state changed) (15ms)
+108ms ║║Cancelling statement #2’s schedules…
+111ms ║║Executed virtual command wait (1ms)
+112ms ║║Requesting a wake up for Wed, Dec 6 2017 @ 1:17:39 PM EST (in 120.0s)
+116ms ║╚Execution stage complete. (31ms)
+118ms ║Setting up scheduled job for Wed, Dec 6 2017 @ 1:17:39 PM EST (in 119.995s)
+138ms ╚Event processed successfully (139ms)
12/6/2017, 1:12:40 PM +279ms
+1ms ╔Received event [Refrigerator].contact = closed with a delay of 359ms
+98ms ║RunTime Analysis CS > 13ms > PS > 53ms > PE > 32ms > CE
+113ms ║Runtime (41838 bytes) successfully initialized in 53ms (v0.2.0ff.20171129) (111ms)
+114ms ║╔Execution stage started
+123ms ║║Comparison (enum) closed is (string) open = false (1ms)
+125ms ║║Cancelling condition #9’s schedules…
+126ms ║║Condition #9 evaluated false (5ms)
+127ms ║║Cancelling condition #14’s schedules…
+127ms ║║Condition group #14 evaluated false (state changed) (8ms)
+128ms ║║Cancelling condition #1’s schedules…
+129ms ║║Condition group #1 evaluated false (state changed) (10ms)
+131ms ║║Cancelling statement #16’s schedules…
+136ms ║║Executed virtual command setVariable (2ms)
+139ms ║╚Execution stage complete. (26ms)
+148ms ╚Event processed successfully (148ms)
12/6/2017, 1:12:03 PM +102ms
+1ms ╔Received event [Home].time = 1512583924433 with a delay of -1331ms
+93ms ║RunTime Analysis CS > 21ms > PS > 41ms > PE > 30ms > CE
+106ms ║Runtime (41836 bytes) successfully initialized in 41ms (v0.2.0ff.20171129) (103ms)
+107ms ║╔Execution stage started
+122ms ║║Executed virtual command wait (0ms)
+123ms ║║Waiting for 1000ms
+1128ms ║║Cancelling statement #10’s schedules…
+1159ms ║║Calculating (long) 239657 > (long) 210000 >> (boolean) true
+1165ms ║║Calculating (string) Attention. Attention. It appears that the refrigerator door has been open for + (string) 3 minutes >> (string) Attention. Attention. It appears that the refrigerator door has been open for 3 minutes
+1168ms ║║Calculating (string) Attention. Attention. It appears that the refrigerator door has been open for 3 minutes + (string) . >> (string) Attention. Attention. It appears that the refrigerator door has been open for 3 minutes.
+1171ms ║║Calculating (string) Attention. Attention. It appears that the refrigerator door has been open for 3 minutes. + (string) I’m contacting Merrick >> (string) Attention. Attention. It appears that the refrigerator door has been open for 3 minutes. I’m contacting Merrick
+1333ms ║║Executed physical command [Kitchen Sonos].playText([Attention. Attention. It appears that the refrigerator door has been open for 3 minutes. I’m contacting Merrick]) (158ms)
+1334ms ║║Executed [Kitchen Sonos].playText (159ms)
+1347ms ║║Calculating (enum) open + (error) Variable '
+1355ms ║║Comparison (error) Invalid device is_between (integer) 210000 … (integer) 270000 = false (4ms)
+1357ms ║║Condition #8 evaluated false (20ms)
+1358ms ║║Condition group #5 evaluated false (state did not change) (21ms)
+1367ms ║║Comparison (enum) open is (string) open = true (1ms)
+1369ms ║║Condition #9 evaluated true (8ms)
+1374ms ║║Comparison (integer) 0 is_less_than (integer) 4 = true (2ms)
+1376ms ║║Condition #15 evaluated true (5ms)
+1377ms ║║Condition group #14 evaluated true (state did not change) (16ms)
+1378ms ║║Condition group #1 evaluated true (state did not change) (18ms)
+1380ms ║║Cancelling statement #2’s schedules…
+1384ms ║║Executed virtual command wait (1ms)
+1385ms ║║Requesting a wake up for Wed, Dec 6 2017 @ 1:14:04 PM EST (in 120.0s)
+1390ms ║╚Execution stage complete. (1284ms)
+1392ms ║Setting up scheduled job for Wed, Dec 6 2017 @ 1:14:04 PM EST (in 119.995s)
+1411ms ╚Event processed successfully (1411ms)
12/6/2017, 1:10:03 PM +102ms
+0ms ╔Received event [Home].time = 1512583804911 with a delay of -1810ms
+81ms ║RunTime Analysis CS > 14ms > PS > 43ms > PE > 25ms > CE
+95ms ║Runtime (41836 bytes) successfully initialized in 43ms (v0.2.0ff.20171129) (93ms)
+97ms ║╔Execution stage started
+111ms ║║Executed virtual command wait (0ms)
+112ms ║║Waiting for 1000ms
+1117ms ║║Cancelling statement #10’s schedules…
+1158ms ║║Calculating (long) 119656 > (long) 210000 >> (boolean) false
+1165ms ║║Calculating (string) Attention. Attention. It appears that the refrigerator door has been open for + (string) 1 minute >> (string) Attention. Attention. It appears that the refrigerator door has been open for 1 minute
+1170ms ║║Calculating (string) Attention. Attention. It appears that the refrigerator door has been open for 1 minute + (string) . >> (string) Attention. Attention. It appears that the refrigerator door has been open for 1 minute.
+1173ms ║║Calculating (string) Attention. Attention. It appears that the refrigerator door has been open for 1 minute. + (string) >> (string) Attention. Attention. It appears that the refrigerator door has been open for 1 minute.
+1277ms ║║Executed physical command [Kitchen Sonos].playText([Attention. Attention. It appears that the refrigerator door has been open for 1 minute.]) (98ms)
+1278ms ║║Executed [Kitchen Sonos].playText (100ms)
+1290ms ║║Calculating (enum) open + (error) Variable '
+1297ms ║║Comparison (error) Invalid device is_between (integer) 210000 … (integer) 270000 = false (4ms)
+1299ms ║║Condition #8 evaluated false (18ms)
+1301ms ║║Condition group #5 evaluated false (state did not change) (19ms)
+1313ms ║║Comparison (enum) open is (string) open = true (2ms)
+1315ms ║║Condition #9 evaluated true (10ms)
+1320ms ║║Comparison (integer) 0 is_less_than (integer) 4 = true (2ms)
+1321ms ║║Condition #15 evaluated true (5ms)
+1322ms ║║Condition group #14 evaluated true (state did not change) (18ms)
+1323ms ║║Condition group #1 evaluated true (state did not change) (20ms)
+1325ms ║║Cancelling statement #2’s schedules…
+1330ms ║║Executed virtual command wait (0ms)
+1331ms ║║Requesting a wake up for Wed, Dec 6 2017 @ 1:12:04 PM EST (in 120.0s)
+1336ms ║╚Execution stage complete. (1240ms)
+1337ms ║Setting up scheduled job for Wed, Dec 6 2017 @ 1:12:04 PM EST (in 119.995s)
+1357ms ╚Event processed successfully (1356ms)
12/6/2017, 1:08:04 PM +784ms
+2ms ╔Received event [Refrigerator].contact = open with a delay of 184ms
+90ms ║RunTime Analysis CS > 15ms > PS > 51ms > PE > 23ms > CE
+98ms ║Runtime (41841 bytes) successfully initialized in 51ms (v0.2.0ff.20171129) (96ms)
+99ms ║╔Execution stage started
+109ms ║║Comparison (enum) open is (string) open = true (2ms)
+110ms ║║Cancelling condition #9’s schedules…
+111ms ║║Condition #9 evaluated true (6ms)
+115ms ║║Comparison (integer) 0 is_less_than (integer) 4 = true (1ms)
+116ms ║║Condition #15 evaluated true (4ms)
+117ms ║║Cancelling condition #14’s schedules…
+118ms ║║Condition group #14 evaluated true (state changed) (14ms)
+119ms ║║Cancelling condition #1’s schedules…
+120ms ║║Condition group #1 evaluated true (state changed) (16ms)
+122ms ║║Cancelling statement #2’s schedules…
+125ms ║║Executed virtual command wait (0ms)
+126ms ║║Requesting a wake up for Wed, Dec 6 2017 @ 1:10:04 PM EST (in 120.0s)
+131ms ║╚Execution stage complete. (32ms)
+132ms ║Setting up scheduled job for Wed, Dec 6 2017 @ 1:10:04 PM EST (in 119.995s)
+150ms ╚Event processed successfully (150ms)
Clear Full


#38

We’re working with 2 minutes, so I changed it to 121 seconds.


#39

There it is you have an extra ] at the end of your expression where it compares the time field on line 36


#40

Doh lol


#41

How did we miss that haha… nice catch