2

According to the nest API docs:

"To cancel an eta, send estimated_arrival_window_begin = 0. Check that you're sending an integer (0) in this call, not a string ("0"), or the call will fail."

See https://developers.nest.com/documentation/cloud/eta-reference/

My code is based on the iOS NestDK sample which uses Firebase.

I set things up using the addSubscriptionToURL method as follows: ​

[[FirebaseManager sharedManager] addSubscriptionToURL:[NSString stringWithFormat:@"structures/%@/eta", structureId] withBlock:^(FDataSnapshot *snapshot) {}];

I can then make successful calls to set an eta window for a specific trip.

However, i can't seem to be able to cancel the eta for the same trip. If i just specify the trip_id and estimated_arrival_window_begin properties i get an error message complaining that the estimated_arrival_window_end field is missing.

NSMutableDictionary *values = [[NSMutableDictionary alloc] init];
[values setValue:[_tripId UUIDString] forKey:@"trip_id"];
[values setValue:[NSNumber numberWithInt:0] forKey:@"estimated_arrival_window_begin"];
[[FirebaseManager sharedManager] setValues:values forURL:[NSString stringWithFormat:@"structures/%@/eta", structureId]];

I tried also setting estimated_arrival_window_end to 0 but i then get an error message saying that the estimated_arrival_window_begin is in the past. It seems to be interpreting the 0 value as the beginning of time. Well some time in 1970 anyway!

What am i doing wrong here?!

Thanks!

MaltZero
  • 23
  • 3

1 Answers1

0

Are you using a Nest account with virtual devices created with the Nest Home Simulator? There appears to be a bug using virtual devices versus real devices. Please try using a Nest account with real devices.

  • 1
    Thanks Lionel, I am indeed using the Nest Home Simulator as i don't own a Thermostat yet... – MaltZero Sep 16 '16 at 08:51
  • There appears to have been a bug with Firebase and virtual devices. This has now been fixed. Please try again and report back if you are still experiencing issues. Thanks. – Lionel Iorgulescu Nov 02 '16 at 20:36
  • Thanks Lionel. Since your last reply i have been able to test with a real thermostat. Although the call appears to succeed i have not been able to get Nest to trust my eta window updates enough to actually take action on them. i have used it multiple times, sending updated eta windows every 5 mins or so as suggested but it never seems to do anything. i wish there were more detailed guidelines on this functionality. should the window decrease in size as the eta gets nearer to indicate a more accurate estimate? should i re-send the previous window if the next calculated eta falls inside it? – MaltZero Dec 06 '16 at 17:11
  • Recently a new permission, ETA Read, and API field, [eta_begin], were added. You can try adding this permission and checking this field for development. After development, if you're not interested in other ETAs, you should remove the read permission. But if only one integration is sending ETA data, this should give you the current active ETA. If there are multiple trips occurring simultaneously, the one with the closest ETA will be the active one. Also, updates to a trip will only occur if the update is more than 5 minutes from the current ETA for that trip. – Lionel Iorgulescu Dec 08 '16 at 16:07