外观
lib-nest 库参考
原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793783728/FIN+5.3.1+lib-nest 中文整理基于 FIN 5.3.1
导读: 谷歌 Nest 连接器
以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。
目录(导读)
概述(中译)
谷歌 Nest 连接器
API 正文(英文)
docs
Overview • Prerequisites • Connectivity • Supported Points • Learn
tags
| nestClientId | The OAuth client_id for your application |
| nestClientSecret | The OAuth client_secret for your application |
| nestConn | Google Nest connector |
| nestConnRef | Used on a proxy point to reference its parent nestConn |
| nestCur | Nest address to use to get the current value |
| nestPoint | Point which synchronizes data via a Nest connector |
| nestProjectId | The project identifier from your Google Device Access project |
| nestRefreshToken | The OAuth refresh_token for your application |
| nestWrite | Nest address to use to write a point value |
lib nest
Overview
The Nest library implements connector support for the Google Smart Device Management (SDM) API. The SDM API allows you to retrieve sensor data from Google Nest devices.
Prerequisites
Before your can use the nest connector, you must complete the steps in the Google Device Access Quick Start Guide. After completing this guide you should have obtained the following information:
- A
project idfrom the Device Access project you created - The following OAuth settings:
client_idclient_secretrefresh_token
Make a note of the those values since you will need them to setup the connector.
Connectivity
The SDM API is a RESTful API over HTTPS. You can connect to devices in your device access project by creating a nestConn rec (the values in <> are obtained by completing the prerequisites):
dis: "Nest Connector"
conn
nestConn
nestProjectId: "<project-id>"
nestClientId: "<oauth-client-id>"
nestClientSecret: "<oauth-client-secret>"
nestRefreshToken: "<oauth-refresh-token>"Supported Points
The nest connector uses the nestCur tag to get the current value of a particular device "trait". This value is specified as:
<point-address> := <device-id>:<trait>
<trait> := <trait-name>.<trait-field>
<device-id>, <trait-name>, <trait-field> := StrFor example, if you have a thermostat with device id THERM-123, you can obtain the current room temperature by setting nestCur to THERM-123:Temperature.ambientTemperatureCelsius
The following section detail the supported devices and traits that can be mapped to points. Note: the nest connector currently supports only Thermostat devices.
Thermostat
The following trait's are supported for Nest Thermostats:
Humidity.ambientHumidityPercent- the humidity measured at the deviceTemperature.ambientTermperatureCelsius- the temperature, measured in degrees Celsius, measured at the deviceThermostatMode.mode- the current thermostat mode (e.g. HEAT)ThermostatHavac.status- the current HVAC status of the thermostat (e.g. HEATING)ThermostatTemperatureSetpoint.heatCelsius- the target temperature when the thermostat is in HEAT or HEATCOOL modeThermostatTemperatureSetpoint.coolCelsius- the target temperature when the thermostat is in COOL or HEATCOOL mode
The thermostat mode, aand heating/cooling setpoints can be written if the nestWrite tag is configured for those points. If you use connLearn(), then these tags will be automatically applied for you.
Learn
The nest connector supports connLearn() to learn points from your devices. This is the easiest way to discover and add points to your project.
def
nestClientId
The OAuth client_id for your application. Follow the prerequisites to obtain this value.
meta
| def | nestClientId |
| is | password |
| lib | lib:nest |
| tagOn | nestConn |
| uiInput | ui::PasswordInput |
supertypes
| val | Data value type |
| scalar | Scalar is an atomic value kind |
| str | Unicode string of characters |
| password | Manages password which is hashed/stored to the password store |
def
nestClientSecret
The OAuth client_secret for your application. Follow the prerequisites to obtain this value.
meta
| def | nestClientSecret |
| is | password |
| lib | lib:nest |
| tagOn | nestConn |
| uiInput | ui::PasswordInput |
supertypes
| val | Data value type |
| scalar | Scalar is an atomic value kind |
| str | Unicode string of characters |
| password | Manages password which is hashed/stored to the password store |
def
nestConn
Google Nest connector
meta
| connFeatures | |
| def | nestConn |
| icon | nest |
| is | conn |
| lib | lib:nest |
usage
| nestConn conn |
supertypes
| marker | Marker labels a dict with typing information |
| entity | Top-level dicts with a unique identifier |
| conn | Connector for communication to a remote system |
tags
| actorTimeout | Timeout for messages send to the connector's actor thread |
| connErr | Error message associated when connStatus indicates an error condition |
| connLinger | Linger timeout used to keep a connector open |
| connOpenRetryFreq | Duration used for connector open retries |
| connPingFreq | Duration used to configure the auto-ping feature on a given connector |
| connState | Current connection state of a connector as one of the predefined strings |
| connStatus | Current status of a connector as one of the predefined strings See Connectors |
| connTuningRef | Reference to a tuning configuration defined by a connTuning rec |
| dis | Display name for an entity |
| disabled | Indicates the entity is in a disabled state |
| id | Defines the unique identifier of an entity in system using a ref value type |
| nestClientId | The OAuth client_id for your application |
| nestClientSecret | The OAuth client_secret for your application |
| nestProjectId | The project identifier from your Google Device Access project |
| nestRefreshToken | The OAuth refresh_token for your application |
def
nestConnRef
Used on a proxy point to reference its parent nestConn
meta
| def | nestConnRef |
| is | ref |
| lib | lib:nest |
| of | nestConn |
| tagOn | nestPoint |
supertypes
| val | Data value type |
| scalar | Scalar is an atomic value kind |
| ref | Reference to an entity |
def
nestCur
Nest address to use to get the current value.
meta
| def | nestCur |
| is | str |
| lib | lib:nest |
| tagOn | nestPoint |
supertypes
| val | Data value type |
| scalar | Scalar is an atomic value kind |
| str | Unicode string of characters |
def
nestPoint
Point which synchronizes data via a Nest connector.
meta
| def | nestPoint |
| is | connPoint |
| lib | lib:nest |
usage
| nestPoint point |
supertypes
| marker | Marker labels a dict with typing information |
| entity | Top-level dicts with a unique identifier |
| point | Data point such as a sensor or actuator |
| connPoint | Point associated with a connector for data synchronization with a remote system |
tags
| connTuningRef | Reference to a tuning configuration defined by a connTuning rec |
| cur | Supports current value |
| curCalibration | Calibration value to apply to adjust the value read from the connector before updating curVal |
| curConvert | Conversion to apply when reading curVal from connector |
| dis | Display name for an entity |
| disMacro | Display name using macro syntax |
| disabled | Indicates the entity is in a disabled state |
| enum | Defines an eumeration of string key names |
| equipRef | Reference to equip which contains this entity |
| ghgFactorHis | Identifies point record with interval emission factor data that the Greenhouse Gas Emission Engine uses to calculate emissions |
| his | Supports historization of data |
| hisConvert | Conversion to apply when reading history data from connector |
| id | Defines the unique identifier of an entity in system using a ref value type |
| kind | Kind name used to identity a value data type |
| maxVal | Inclusive maximum for a numeric value |
| minVal | Inclusive minimum for a numeric value |
| navName | Navigation name commonly used with disMacro to create computed display strings |
| nestConnRef | Used on a proxy point to reference its parent nestConn |
| nestCur | Nest address to use to get the current value |
| nestWrite | Nest address to use to write a point value |
| pointFunction | Classifies the point as a sensor, command, or setpoint |
| pointQuantity | Quantity the point senses or controls |
| pointSubject | What the point senses or controls |
| siteRef | Reference to site which contains the entity |
| spaceRef | Reference to space which contains this entity |
| systemRef | Reference to system |
| tz | Timezone identifier from standard timezone database |
| unit | Unit identifier from standard unit database |
| writable | Supports writing data |
| writeConvert | Conversion to apply when writing writeVal to the connector |
def
nestProjectId
The project identifier from your Google Device Access project. Follow the prerequisites to obtain this value.
meta
| def | nestProjectId |
| is | str |
| lib | lib:nest |
| tagOn | nestConn |
supertypes
| val | Data value type |
| scalar | Scalar is an atomic value kind |
| str | Unicode string of characters |
def
nestRefreshToken
The OAuth refresh_token for your application. Follow the prerequisites to obtain this value.
meta
| def | nestRefreshToken |
| is | password |
| lib | lib:nest |
| tagOn | nestConn |
| uiInput | ui::PasswordInput |
supertypes
| val | Data value type |
| scalar | Scalar is an atomic value kind |
| str | Unicode string of characters |
| password | Manages password which is hashed/stored to the password store |
def
nestWrite
Nest address to use to write a point value.
meta
| def | nestWrite |
| is | str |
| lib | lib:nest |
| tagOn | nestPoint |
supertypes
| val | Data value type |
| scalar | Scalar is an atomic value kind |
| str | Unicode string of characters |