What's wrong with my If/Then/Else?


#1

1) Give a description of the problem

My piston keeps referring to my last ELSE, which is giving an incorrect time.

2) What is the expected behaviour?

The piston either supposed to tell me (1) Where a family member is, and for how long, or (2) Where a family member was last (if between destinations), and when they left. The locations are working, but not the times.

3) What is happening/not happening?
I’ve narrowed it down to the piston is skipping all my IFs (likely because I’ve done something wrong), and just giving me the last ELSE, which results in the same timestamp for all members.

(Cue @WCmore and @ike2018 telling me this is why I shouldn’t use ELSE commands… :stuck_out_tongue: )

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full

18/12/2019, 10:47:24 +966ms
+2ms ╔Received event [Where Is Everybody].switch = off with a delay of 272ms
+145ms ║RunTime Analysis CS > 29ms > PS > 52ms > PE > 63ms > CE
+148ms ║Runtime (70993 bytes) successfully initialized in 52ms (v0.3.110.20191009) (146ms)
+149ms ║╔Execution stage started
+156ms ║║Comparison (enum) off changes_to (string) on = false (1ms)
+157ms ║║Cancelling condition #118’s schedules…
+158ms ║║Condition #118 evaluated false (5ms)
+159ms ║║Cancelling condition #117’s schedules…
+160ms ║║Condition group #117 evaluated false (state changed) (7ms)
+162ms ║╚Execution stage complete. (13ms)
+163ms ╚Event processed successfully (163ms)
18/12/2019, 10:47:23 +174ms
+1ms ╔Received event [Where Is Everybody].switch = on with a delay of 198ms
+116ms ║RunTime Analysis CS > 17ms > PS > 47ms > PE > 52ms > CE
+120ms ║Runtime (71011 bytes) successfully initialized in 47ms (v0.3.110.20191009) (118ms)
+121ms ║╔Execution stage started
+128ms ║║Comparison (enum) on changes_to (string) on = true (0ms)
+129ms ║║Cancelling condition #118’s schedules…
+130ms ║║Condition #118 evaluated true (5ms)
+131ms ║║Cancelling condition #117’s schedules…
+131ms ║║Condition group #117 evaluated true (state changed) (6ms)
+133ms ║║Cancelling statement #147’s schedules…
+457ms ║║Executed physical command [Echo - Computer Echo].setAlarmVolume([99]) (317ms)
+458ms ║║Executed [Echo - Computer Echo].setAlarmVolume (319ms)
+460ms ║║Cancelling statement #12’s schedules…
+464ms ║║Executed virtual command setVariable (2ms)
+469ms ║║Cancelling statement #15’s schedules…
+475ms ║║Executed virtual command setVariable (3ms)
+481ms ║║Comparison (dynamic) Life360 Derek is_equal_to (dynamic) Life360 Derek = true (1ms)
+483ms ║║Cancelling condition #288’s schedules…
+484ms ║║Condition #288 evaluated true (7ms)
+485ms ║║Cancelling condition #148’s schedules…
+486ms ║║Condition group #148 evaluated true (state changed) (8ms)
+488ms ║║Cancelling statement #396’s schedules…
+498ms ║║Executed virtual command setVariable (3ms)
+508ms ║║Comparison (string) Western Christian is_not_any_of (string) Kathleen’s House,The Hollisbraus,Tisha’s School,Western Christian,Kathy’s House,Edwards Theater,Granada,Jack in the Box,Ralphs,Asley’s house,Home = false (3ms)
+509ms ║║Condition #149 evaluated false (8ms)
+510ms ║║Condition group #289 evaluated false (state did not change) (10ms)
+513ms ║║Cancelling statement #312’s schedules…
+516ms ║║Executed virtual command setVariable (1ms)
+527ms ║║Executed virtual command executePiston (7ms)
+533ms ║║Executed virtual command setVariable (3ms)
+538ms ║║Executed virtual command setVariable (3ms)
+543ms ║║is currently at
+544ms ║║Executed virtual command log (1ms)
+550ms ║║Western Christian
+551ms ║║Executed virtual command log (1ms)
+557ms ║║is currently at
+558ms ║║Executed virtual command log (1ms)
+566ms ║║Comparison (dynamic) Life360 Derek is_equal_to (dynamic) Life360 Eric = false (1ms)
+567ms ║║Condition #291 evaluated false (5ms)
+568ms ║║Condition group #290 evaluated false (state did not change) (7ms)
+574ms ║║Comparison (dynamic) Life360 Derek is_equal_to (dynamic) Life360 Julie = false (1ms)
+576ms ║║Condition #298 evaluated false (5ms)
+577ms ║║Condition group #297 evaluated false (state did not change) (6ms)
+583ms ║║Comparison (dynamic) Life360 Derek is_equal_to (dynamic) Life360 Tisha = false (1ms)
+585ms ║║Cancelling condition #305’s schedules…
+585ms ║║Condition #305 evaluated false (6ms)
+587ms ║║Cancelling condition #304’s schedules…
+587ms ║║Condition group #304 evaluated false (state changed) (8ms)
+590ms ║║Cancelling statement #156’s schedules…
+595ms ║║Calculating (integer) 0 + (integer) 1 >> (integer) 1
+600ms ║║Executed virtual command setVariable (2ms)
+604ms ║║Cancelling statement #15’s schedules…
+610ms ║║Executed virtual command setVariable (3ms)
+617ms ║║Comparison (dynamic) Life360 Eric is_equal_to (dynamic) Life360 Derek = false (1ms)
+618ms ║║Cancelling condition #288’s schedules…
+619ms ║║Condition #288 evaluated false (6ms)
+620ms ║║Cancelling condition #148’s schedules…
+621ms ║║Condition group #148 evaluated false (state changed) (8ms)
+628ms ║║Comparison (dynamic) Life360 Eric is_equal_to (dynamic) Life360 Eric = true (1ms)
+629ms ║║Cancelling condition #291’s schedules…
+630ms ║║Condition #291 evaluated true (6ms)
+631ms ║║Cancelling condition #290’s schedules…
+632ms ║║Condition group #290 evaluated true (state changed) (9ms)
+634ms ║║Cancelling statement #398’s schedules…
+644ms ║║Executed virtual command setVariable (3ms)
+658ms ║║Comparison (string) Home is_not_any_of (string) Kathleen’s House,The Hollisbraus,Tisha’s School,Western Christian,Kathy’s House,Edwards Theater,Granada,Jack in the Box,Ralphs,Asley’s house,Home = false (7ms)
+659ms ║║Condition #332 evaluated false (12ms)
+660ms ║║Condition group #331 evaluated false (state did not change) (13ms)
+662ms ║║Cancelling statement #333’s schedules…
+666ms ║║Executed virtual command setVariable (0ms)
+676ms ║║Executed virtual command executePiston (7ms)
+682ms ║║Executed virtual command setVariable (3ms)
+688ms ║║Executed virtual command setVariable (2ms)
+693ms ║║is currently at
+694ms ║║Executed virtual command log (1ms)
+700ms ║║Home
+701ms ║║Executed virtual command log (2ms)
+707ms ║║is currently at
+708ms ║║Executed virtual command log (1ms)
+715ms ║║Comparison (dynamic) Life360 Eric is_equal_to (dynamic) Life360 Julie = false (1ms)
+716ms ║║Condition #298 evaluated false (5ms)
+717ms ║║Condition group #297 evaluated false (state did not change) (7ms)
+724ms ║║Comparison (dynamic) Life360 Eric is_equal_to (dynamic) Life360 Tisha = false (1ms)
+725ms ║║Condition #305 evaluated false (5ms)
+726ms ║║Condition group #304 evaluated false (state did not change) (7ms)
+729ms ║║Cancelling statement #156’s schedules…
+733ms ║║Calculating (integer) 1 + (integer) 1 >> (integer) 2
+737ms ║║Executed virtual command setVariable (2ms)
+741ms ║║Cancelling statement #15’s schedules…
+747ms ║║Executed virtual command setVariable (3ms)
+753ms ║║Comparison (dynamic) Life360 Julie is_equal_to (dynamic) Life360 Derek = false (1ms)
+754ms ║║Condition #288 evaluated false (5ms)
+755ms ║║Condition group #148 evaluated false (state did not change) (6ms)
+761ms ║║Comparison (dynamic) Life360 Julie is_equal_to (dynamic) Life360 Eric = false (1ms)
+763ms ║║Cancelling condition #291’s schedules…
+764ms ║║Condition #291 evaluated false (5ms)
+765ms ║║Cancelling condition #290’s schedules…
+766ms ║║Condition group #290 evaluated false (state changed) (8ms)
+772ms ║║Comparison (dynamic) Life360 Julie is_equal_to (dynamic) Life360 Julie = true (1ms)
+773ms ║║Cancelling condition #298’s schedules…
+774ms ║║Condition #298 evaluated true (6ms)
+775ms ║║Cancelling condition #297’s schedules…
+776ms ║║Condition group #297 evaluated true (state changed) (7ms)
+778ms ║║Cancelling statement #400’s schedules…
+789ms ║║Executed virtual command setVariable (3ms)
+802ms ║║Comparison (string) Home is_not_any_of (string) Kathleen’s House,The Hollisbraus,Tisha’s School,Western Christian,Kathy’s House,Edwards Theater,Granada,Jack in the Box,Ralphs,Asley’s house,Home = false (7ms)
+803ms ║║Condition #348 evaluated false (12ms)
+805ms ║║Condition group #347 evaluated false (state did not change) (13ms)
+807ms ║║Cancelling statement #349’s schedules…
+810ms ║║Executed virtual command setVariable (1ms)
+822ms ║║Executed virtual command executePiston (7ms)
+828ms ║║Executed virtual command setVariable (4ms)
+833ms ║║Executed virtual command setVariable (2ms)
+839ms ║║is currently at
+840ms ║║Executed virtual command log (2ms)
+846ms ║║Home
+847ms ║║Executed virtual command log (1ms)
+852ms ║║6:52 AM
+853ms ║║Executed virtual command log (1ms)
+860ms ║║Comparison (dynamic) Life360 Julie is_equal_to (dynamic) Life360 Tisha = false (1ms)
+862ms ║║Condition #305 evaluated false (5ms)
+863ms ║║Condition group #304 evaluated false (state did not change) (7ms)
+865ms ║║Cancelling statement #156’s schedules…
+870ms ║║Calculating (integer) 2 + (integer) 1 >> (integer) 3
+874ms ║║Executed virtual command setVariable (3ms)
+879ms ║║Cancelling statement #15’s schedules…
+884ms ║║Executed virtual command setVariable (3ms)
+890ms ║║Comparison (dynamic) Life360 Tisha is_equal_to (dynamic) Life360 Derek = false (1ms)
+891ms ║║Condition #288 evaluated false (5ms)
+892ms ║║Condition group #148 evaluated false (state did not change) (6ms)
+899ms ║║Comparison (dynamic) Life360 Tisha is_equal_to (dynamic) Life360 Eric = false (1ms)
+900ms ║║Condition #291 evaluated false (5ms)
+901ms ║║Condition group #290 evaluated false (state did not change) (6ms)
+908ms ║║Comparison (dynamic) Life360 Tisha is_equal_to (dynamic) Life360 Julie = false (1ms)
+909ms ║║Cancelling condition #298’s schedules…
+910ms ║║Condition #298 evaluated false (6ms)
+911ms ║║Cancelling condition #297’s schedules…
+912ms ║║Condition group #297 evaluated false (state changed) (9ms)
+918ms ║║Comparison (dynamic) Life360 Tisha is_equal_to (dynamic) Life360 Tisha = true (1ms)
+920ms ║║Cancelling condition #305’s schedules…
+921ms ║║Condition #305 evaluated true (5ms)
+922ms ║║Cancelling condition #304’s schedules…
+923ms ║║Condition group #304 evaluated true (state changed) (8ms)
+931ms ║║Comparison (string) Tisha’s School is_not_any_of (string) Kathleen’s House,The Hollisbraus,Tisha’s School,Western Christian,Kathy’s House,Edwards Theater,Granada,Jack in the Box,Ralphs,Asley’s house,Home = false (3ms)
+932ms ║║Condition #364 evaluated false (7ms)
+934ms ║║Condition group #363 evaluated false (state did not change) (9ms)
+936ms ║║Cancelling statement #365’s schedules…
+940ms ║║Executed virtual command setVariable (1ms)
+954ms ║║Executed virtual command executePiston (11ms)
+960ms ║║Executed virtual command setVariable (3ms)
+966ms ║║Executed virtual command setVariable (3ms)
+973ms ║║is currently at
+974ms ║║Executed virtual command log (2ms)
+980ms ║║Tisha’s School
+982ms ║║Executed virtual command log (1ms)
+988ms ║║6:52 AM
+989ms ║║Executed virtual command log (2ms)
+993ms ║║Cancelling statement #156’s schedules…
+998ms ║║Calculating (integer) 3 + (integer) 1 >> (integer) 4
+1002ms ║║Executed virtual command setVariable (2ms)
+1006ms ║║Cancelling statement #121’s schedules…
+1010ms ║║Executed virtual command setVariable (2ms)
+1013ms ║║Executed virtual command setVariable (1ms)
+1019ms ║║Cancelling statement #20’s schedules…
+1025ms ║║Executed virtual command setVariable (3ms)
+1033ms ║║Executed virtual command setVariable (2ms)
+1038ms ║║Executed virtual command setVariable (2ms)
+1044ms ║║Executed virtual command setVariable (3ms)
+1049ms ║║Executed virtual command setVariable (2ms)
+1061ms ║║Calculating (dynamic) + (dynamic) Derek >> (dynamic) Derek
+1066ms ║║Calculating (string) Derek + (string) >> (string) Derek
+1070ms ║║Calculating (string) Derek + (string) is currently at >> (string) Derek is currently at
+1074ms ║║Calculating (string) Derek is currently at + (string) >> (string) Derek is currently at
+1077ms ║║Calculating (string) Derek is currently at + (string) Western Christian >> (string) Derek is currently at Western Christian
+1081ms ║║Calculating (string) Derek is currently at Western Christian + (string) since >> (string) Derek is currently at Western Christian since
+1084ms ║║Calculating (string) Derek is currently at Western Christian since + (string) 6:52 AM >> (string) Derek is currently at Western Christian since 6:52 AM
+1087ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM + (string) … >> (string) Derek is currently at Western Christian since 6:52 AM …
+1089ms ║║Executed virtual command setVariable (1ms)
+1095ms ║║Calculating (integer) 0 + (integer) 1 >> (integer) 1
+1100ms ║║Executed virtual command setVariable (2ms)
+1105ms ║║Cancelling statement #20’s schedules…
+1111ms ║║Executed virtual command setVariable (2ms)
+1119ms ║║Executed virtual command setVariable (2ms)
+1124ms ║║Executed virtual command setVariable (2ms)
+1130ms ║║Executed virtual command setVariable (3ms)
+1136ms ║║Executed virtual command setVariable (2ms)
+1148ms ║║Calculating (dynamic) Derek is currently at Western Christian since 6:52 AM … + (dynamic) Eric >> (dynamic) Derek is currently at Western Christian since 6:52 AM …Eric
+1153ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric + (string) >> (string) Derek is currently at Western Christian since 6:52 AM …Eric
+1157ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric + (string) is currently at >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at
+1162ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at + (string) >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at
+1165ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at + (string) Home >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home
+1169ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home + (string) since >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since
+1172ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since + (string) 6:52 AM >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM
+1175ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM + (string) … >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …
+1178ms ║║Executed virtual command setVariable (1ms)
+1183ms ║║Calculating (integer) 1 + (integer) 1 >> (integer) 2
+1187ms ║║Executed virtual command setVariable (2ms)
+1192ms ║║Cancelling statement #20’s schedules…
+1197ms ║║Executed virtual command setVariable (3ms)
+1205ms ║║Executed virtual command setVariable (3ms)
+1210ms ║║Executed virtual command setVariable (2ms)
+1216ms ║║Executed virtual command setVariable (2ms)
+1221ms ║║Executed virtual command setVariable (3ms)
+1232ms ║║Calculating (dynamic) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM … + (dynamic) Julie >> (dynamic) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie
+1236ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie + (string) >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie
+1240ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie + (string) is currently at >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at
+1244ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at + (string) >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at
+1247ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at + (string) Home >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home
+1250ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home + (string) since >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since
+1253ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since + (string) 6:52 AM >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM
+1255ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM + (string) … >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …
+1258ms ║║Executed virtual command setVariable (1ms)
+1262ms ║║Calculating (integer) 2 + (integer) 1 >> (integer) 3
+1267ms ║║Executed virtual command setVariable (3ms)
+1271ms ║║Cancelling statement #20’s schedules…
+1276ms ║║Executed virtual command setVariable (2ms)
+1284ms ║║Executed virtual command setVariable (2ms)
+1289ms ║║Executed virtual command setVariable (2ms)
+1294ms ║║Executed virtual command setVariable (2ms)
+1300ms ║║Executed virtual command setVariable (2ms)
+1311ms ║║Calculating (dynamic) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM … + (dynamic) Tisha >> (dynamic) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha
+1315ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha + (string) >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha
+1318ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha + (string) is currently at >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at
+1322ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at + (string) >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at
+1325ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at + (string) Tisha’s School >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at Tisha’s School
+1328ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at Tisha’s School + (string) since >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at Tisha’s School since
+1330ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at Tisha’s School since + (string) 6:52 AM >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at Tisha’s School since 6:52 AM
+1333ms ║║Calculating (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at Tisha’s School since 6:52 AM + (string) … >> (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at Tisha’s School since 6:52 AM …
+1335ms ║║Executed virtual command setVariable (1ms)
+1340ms ║║Calculating (integer) 3 + (integer) 1 >> (integer) 4
+1345ms ║║Executed virtual command setVariable (2ms)
+1348ms ║║Cancelling statement #164’s schedules…
+1352ms ║║Calculating (string) Locations found. + (string) Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at Tisha’s School since 6:52 AM … >> (string) Locations found. Derek is currently at Western Christian since 6:52 AM …Eric is currently at Home since 6:52 AM …Julie is currently at Home since 6:52 AM …Tisha is currently at Tisha’s School since 6:52 AM …
+1354ms ║║Executed virtual command setVariable (0ms)
+1358ms ║║Executed virtual command setVariable (1ms)
+1363ms ║║Executed virtual command setVariable (2ms)
+1365ms ║║Cancelling statement #119’s schedules…
+1373ms ║║Executed physical command [Where Is Everybody].off() (5ms)
+1374ms ║║Executed [Where Is Everybody].off (6ms)
+1376ms ║╚Execution stage complete. (1255ms)
+1377ms ╚Event processed successfully (1377ms)


#2

I think I found my problem…

I guess I’ll have to put the epoch-converter into this piston…was hoping to avoid that…


#3

Nope… Not this time… :grin:

Each of your ELSE sections only has a single condition attached to it. :+1:
If you must use ELSE blocks, this is the way to do it.


#4

Well, it turns out the global variables are my problem. They don’t update as one might expect, so I had to put the Epoch>Human time converter in my piston. It appears to be working now.


#5

Well, @guxdude and @WCmore, I have one last question.

I can’t stop analyzing my piston, and it occurred to me I could take out some huge chunks if I could rewrite these parts with variables. I have one piston that determines when a family member has left or arrived at a particular destination. If they’ve left a destination and are in transit, it stores their last known location in a global variable:

When I run my Where Is Everybody piston, it pulls the last known information from the global variable:

How would I code the global parts like @LastAddressEric (which would be text), @LastAddressEricLeft (which would be an epoch number) so that I could include them in a loop, rather than writing each one out? I’m kinda getting the hang of this stuff, but I’m not sure exactly when to use (), {}, and/or [].

I’m thinking something like: Set variable @LastAddress[Life360Device{inx2}] = {[Life360Device{inx2]:preAddress]}

I guess I’d have to come up with something like inx2 to store the name, since the original inx would be used for counting through the four members. [EDIT] Nope…I’ll create a Devicelist with the four Life360 devices, so I’d have to put in the names like @[Life360Device] = [Life360Device]:preAddress , right?

[EDIT] Crap, I still need to add “Eric” and “EricLeft” to the end of the text @LastAddress, and do this for all four members. Maybe I should just leave it as is.


#6

Globals are not written until the very last line of code has executed in that piston… So if you write to a global, then do not expect to read from that same global during the same execution. (I try to keep data local during processing, and then dump the final results to a global at the end)

On the other hand, if your global variables are “dynamic”, then time based data is often written in a format that does not help us. (I always set the “type” to something specific)

You can see real life examples (of time based strangeness) by importing & testing my piston over here.