nest-API的介绍

来源:互联网 发布:单片机相关文献 编辑:程序博客网 时间:2024/06/14 04:00

nest-API的介绍

了解如何使用Nest API,如何与

l Nest Service通讯

l 访问共享数据

l 管理数据的访问

l 安全协议

a

Nest API是一个近实时数据的API,提供基于订阅制(subscription-based)的访问Nest 设备的共享数据。通过Nest API,你可以构建自己的客户端来访问Nest 设备的数据,而且可以读或者这修改这些共享数据的值。

Nest Learning ThermostatNest 会学习的恒温器

· View current temperature

· View or set target temperature

· Set fan timer

· View or set temperature mode

· View online status and last connection information

Nest Protect Smoke + CO Alarm

· View CO or smoke status

· View battery health state

· View online status and last connection information

Home

· View a list of devices in the home

· View energy event status

· Set ETA

· View or set Away state

Getting Started with the Nest API可以开始了...

1. 注册成为Nest Developer Program

2. 编译 Firebase Client Libraries(实时聊天)

使用正式版Firebase库(WebiOSJavaNode.js,他允许通过subscription-based近实时的平台来你同步数据。......

如果你想在开发集成平台上开发,但却没有可以用的Firebase库,你可以使用REST或者REST流代替。

3. Test with the Nest Developer Chrome Extension

How the Nest API Works

客户端App必须预先编译Firebase client库,来配合Nest API的订阅数据值。当订阅数据值改变,新的数据实时更新,并存储为一个标准的Json文档。你的客户端可以基于订阅数据的更新显示或触发一个新的动作。

b

c

Example

让我们说你想为Nest Learning Themostat 来创建客户端来监视两个值:

当前温度

目标温度

看这两个数据属性的变化,你会同意在温控器添加到一个对象结构体里,然后:

当你的客户通过Nest Thermostat调节温度,目标温度的变化和Nest Service 更新Json doc,这些会实时同步。

你的客户端监听这些变化,然后显示目标温度更新当前温度变化。

你可以以订阅单个数据值或者父数据对象的Json值,当你订阅一个父对象,你可以得到父数据的所有值。

Shared device data and permissions

读或写数据值的能力是控制权限。当一个数据值和读取对应的权限,您的客户端可以读取数据的位置。如果有写权限,那么你的客户可以写入数据的位置。

Data access control

当你注册一个Nest的开发计划的client,你会选择与你的产品有关的权限,并提供一个描述你的客户可能采取可能的行动。

你的客户看到这些权限和描述,当他们给您的客户端访问他们的Nest,设备数据。

d

About security protocol安全协议

我们使用OAuth 2授权。OAuth是一种安全地创建一个资源所有者之间的信托协议(一个Nest用户,一个客户(用户)的应用程序或Nest开发者)和资源服务器(Nest  API Service)。

Technical Requirements for Developers  

开发人员的技术要求

你应该有常见的编程语言,平台的知识,授权和通信协议,如:

· Programming languages: Java, Objective-C, JavaScript

· Platforms: iOS, Android, web, Mac OS, Windows, Linux, Rails, Django

· Server-side JavaScript/Java programming

· OAuth 2.0 (authorization)

· Firebase (client libraries used by the Nest API)

Guidelines and Compliance

准则和遵守

When you register for the Nest Developer Program, we'll ask you to agree to comply with the Developer Program Terms of Service and to follow the Nest Design and Branding Guidelines, which describes proper use of the Nest logo, branding and general UI instructions.

If you fail to comply with these agreements, we have the right to suspend your developer account, close all active sessions and revoke all access tokens.

 


0 0
原创粉丝点击