gpt4 book ai didi

ios - Nest Thermostat Away Status 变回 home

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:01:37 24 4
gpt4 key购买 nike

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"];

这在日志中反射(reflect)为 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成功设置离开状态?当应用程序在应用程序模型的许多不同部分启动时,我尝试立即设置离开状态,只是为了尝试让状态保持不变。除了 github 上不合适的示例项目外,谷歌搜索也没有任何帮助

最佳答案

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

structures/VqFabWH21nwVyd4RWgJgNb292wa7hG_dUwo2i2SG7j3/away

取决于你实际的structure_id,引用here

关于ios - Nest Thermostat Away Status 变回 home,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36266379/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com