我正在尝试使用恒温器控制示例(https://developer.nest.com/documentation/control)中的方法读取有关恒温器的基本信息,但是当我连接到 firebase 时,我只看到该对象structure
(仅包含name
、、、,和) 在快照中 – 没有对象。我正在使用连接到 Firebaseaway
smoke_co_alarms
structure_id
thermostats
devices
var nestToken = $.cookie('nest_token');
var dataRef = new Firebase('wss://developer-api.nest.com/');
dataRef.auth(nestToken);
我尝试使用 直接连接到设备wss://developer-api.nest.com/devices
,但这仅返回一个undefined
数据结构。
我也尝试过使用https://developer-api.nest.com/
and连接到 Firebase https://developer-api.nest.com/
,但他们引发了授权错误并导致我的 javascript 进入无限循环发送请求。
我正在使用以下方式读取数据:
dataRef.on('value', function (snapshot) {
var data = snapshot.val();
structure = firstChild(data.structures);
console.log(data);
console.log(data.structures);
console.log(data.devices);
console.log(data.devices.thermostats);
console.log(structure.thermostats);
};
最后,我在一个使用真实设备的帐户和一个使用虚拟设备的帐户上进行了尝试,所以我知道这不会导致它(即使我没想到会这样)。
任何想法我做错了什么?问题不可能出现在我的 App.js 文件中,对吗?除了身份验证之外,我还需要在用户端进行一些配置吗?我觉得这可能是一件非常简单的事情,它正盯着我看。