Skip to content

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 ​

nestClientIdThe OAuth client_id for your application
nestClientSecretThe OAuth client_secret for your application
nestConnGoogle Nest connector
nestConnRefUsed on a proxy point to reference its parent nestConn
nestCurNest address to use to get the current value
nestPointPoint which synchronizes data via a Nest connector
nestProjectIdThe project identifier from your Google Device Access project
nestRefreshTokenThe OAuth refresh_token for your application
nestWriteNest 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:

  1. A project id from the Device Access project you created
  2. The following OAuth settings:
    1. client_id
    2. client_secret
    3. refresh_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> := Str

For 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 device
  • Temperature.ambientTermperatureCelsius - the temperature, measured in degrees Celsius, measured at the device
  • ThermostatMode.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 mode
  • ThermostatTemperatureSetpoint.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 ​

defnestClientId
ispassword
liblib:nest
tagOnnestConn
uiInputui::PasswordInput

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters
passwordManages 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 ​

defnestClientSecret
ispassword
liblib:nest
tagOnnestConn
uiInputui::PasswordInput

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters
passwordManages password which is hashed/stored to the password store


def ​

nestConn ​

Google Nest connector


meta ​

connFeatures
defnestConn
iconnest
isconn
liblib:nest

usage ​

nestConn  conn

supertypes ​

markerMarker labels a dict with typing information
entityTop-level dicts with a unique identifier
connConnector for communication to a remote system

tags ​

actorTimeoutTimeout for messages send to the connector's actor thread
connErrError message associated when connStatus indicates an error condition
connLingerLinger timeout used to keep a connector open
connOpenRetryFreqDuration used for connector open retries
connPingFreqDuration used to configure the auto-ping feature on a given connector
connStateCurrent connection state of a connector as one of the predefined strings
connStatusCurrent status of a connector as one of the predefined strings See Connectors
connTuningRefReference to a tuning configuration defined by a connTuning rec
disDisplay name for an entity
disabledIndicates the entity is in a disabled state
idDefines the unique identifier of an entity in system using a ref value type
nestClientIdThe OAuth client_id for your application
nestClientSecretThe OAuth client_secret for your application
nestProjectIdThe project identifier from your Google Device Access project
nestRefreshTokenThe OAuth refresh_token for your application


def ​

nestConnRef ​

Used on a proxy point to reference its parent nestConn


meta ​

defnestConnRef
isref
liblib:nest
ofnestConn
tagOnnestPoint

supertypes ​

valData value type
scalarScalar is an atomic value kind
refReference to an entity


def ​

nestCur ​

Nest address to use to get the current value.


meta ​

defnestCur
isstr
liblib:nest
tagOnnestPoint

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

nestPoint ​

Point which synchronizes data via a Nest connector.


meta ​

defnestPoint
isconnPoint
liblib:nest

usage ​

nestPoint  point

supertypes ​

markerMarker labels a dict with typing information
entityTop-level dicts with a unique identifier
pointData point such as a sensor or actuator
connPointPoint associated with a connector for data synchronization with a remote system

tags ​

connTuningRefReference to a tuning configuration defined by a connTuning rec
curSupports current value
curCalibrationCalibration value to apply to adjust the value read from the connector before updating curVal
curConvertConversion to apply when reading curVal from connector
disDisplay name for an entity
disMacroDisplay name using macro syntax
disabledIndicates the entity is in a disabled state
enumDefines an eumeration of string key names
equipRefReference to equip which contains this entity
ghgFactorHisIdentifies point record with interval emission factor data that the Greenhouse Gas Emission Engine uses to calculate emissions
hisSupports historization of data
hisConvertConversion to apply when reading history data from connector
idDefines the unique identifier of an entity in system using a ref value type
kindKind name used to identity a value data type
maxValInclusive maximum for a numeric value
minValInclusive minimum for a numeric value
navNameNavigation name commonly used with disMacro to create computed display strings
nestConnRefUsed on a proxy point to reference its parent nestConn
nestCurNest address to use to get the current value
nestWriteNest address to use to write a point value
pointFunctionClassifies the point as a sensor, command, or setpoint
pointQuantityQuantity the point senses or controls
pointSubjectWhat the point senses or controls
siteRefReference to site which contains the entity
spaceRefReference to space which contains this entity
systemRefReference to system
tzTimezone identifier from standard timezone database
unitUnit identifier from standard unit database
writableSupports writing data
writeConvertConversion 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 ​

defnestProjectId
isstr
liblib:nest
tagOnnestConn

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters


def ​

nestRefreshToken ​

The OAuth refresh_token for your application. Follow the prerequisites to obtain this value.


meta ​

defnestRefreshToken
ispassword
liblib:nest
tagOnnestConn
uiInputui::PasswordInput

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters
passwordManages password which is hashed/stored to the password store


def ​

nestWrite ​

Nest address to use to write a point value.


meta ​

defnestWrite
isstr
liblib:nest
tagOnnestPoint

supertypes ​

valData value type
scalarScalar is an atomic value kind
strUnicode string of characters