Nest Thermostat Away Status 变回 home

Nest Thermostat Away Status changes back to home

Nest 恒温器 SDK,使用来自 Nest 的 iOS 示例代码作为参考。

示例代码中概述了温度设置。将离开状态设置为 awayhome(不是向 firebase 发送的字符串值)。

来自上一个问题 Change Away Status on Nest Thermostat (Nest API) 我正在更改离开状态:

    self.rootFirebase = [[Firebase alloc] initWithUrl:@"https://developer-api.nest.com/"];
    Firebase *structuresRef = [self.rootFirebase childByAppendingPath:@"structures"];
    Firebase *thisStructureRef = [structuresRef childByAppendingPath: @"structure_id_0"];
    Firebase *awayRef = [thisStructureRef childByAppendingPath: @"away"];

    // Set Status
    [awayRef setValue:@"away"];

这在日志中反映为 away。让这个坚持下去会导致问题。

设置后 away 一秒钟后的日志显示它又回到了 home

统计数据似乎覆盖了来自应用程序的请求,统计数据中的任何内容都具有优先权

- (void)addSubscriptionToURL:(NSString *)URL withBlock:(SubscriptionBlock)block {

    Firebase *newFirebase2 = [self.rootFirebase childByAppendingPath:@"structures"];
    [newFirebase2 observeEventType:FEventTypeChildAdded withBlock:^(FDataSnapshot *snapshot) {

        // Put structures int a dictionary
         NSMutableDictionary *dict = snapshot.value;
         NSLog(@"\n\n******** STATUS: Away Status =  %@ **********\n\n", [dict valueForKey:@"away"]);

        }];
}

有没有人用nest SDK成功设置离开状态?当应用程序在应用程序模型的许多不同部分启动时,我尝试立即设置离开状态,只是为了尝试让状态保持不变。在 google 搜索中也没有任何帮助,除了 github 上不合适的示例项目

你确定你调用的结构正确吗?它应该是以下内容:

structures/VqFabWH21nwVyd4RWgJgNb292wa7hG_dUwo2i2SG7j3/away

取决于你的实际structure_id,参考here