Skip to content

lib-ecobee 库参考 ​

原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793685028/FIN+5.3.1+lib-ecobee 中文整理基于 FIN 5.3.1

导读: Ecobee 库实现了对 Ecobee 恒温器的连接器支持。

以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。


目录(导读) ​


概述(中译) ​

Ecobee 连接器


API 正文(英文) ​

docs ​

Overview • Prerequisites • Connectivity • Current Values • Writable Points • History Points • Learn • API Rate Limiting


tags ​

ecobeeClientIdYour Ecobee API Key
ecobeeConnEcobee connector
ecobeeConnRefUsed on a proxy point to reference its parent ecobeeConn
ecobeeCurEcobee address to use to get the current value
ecobeeHisEcobee address to use to sync point history
ecobeePointPoint which synchronizes data via an Ecobee connector
ecobeeRefreshTokenThe refresh token you obtained for your API key
ecobeeWriteEcobee address to use to write a point value

lib ecobee ​

Overview ​

The Ecobee library implements connector support for Ecobee Thermostats.

Prerequisites ​

Before you can use the Ecobee connector, you need to follow these steps to acquire an API key and OAuth tokens for communicating with the API

  1. Register your device and create a developer account at this web page: https://www.ecobee.com/en-us/developers/
  2. Log into your Ecobee portal
    1. Go the the developer menu item
    2. Create your application using Create New
    3. Make note of your API key for the next step
  3. Open a command prompt or terminal and run the following commands
    1. cd <installation_home>
    2. ./bin/fan hxEcobee::EcobeeAuthorization -scope smartRead
      • To enable read/write to your thermostat, use -scope smartWrite instead.
      • Follow the instructions to obtain a PIN and authorize your application. After completing the steps the program will provide you with the set of tags that must be set on your connector as describe below.

Connectivity ​

The Ecobee API is a RESTful API over HTTPS. You can connect to all your registered devices by creating an ecobeeConn rec (the values in <> are obtained by completing the prerequisites):

dis: "My Home"
conn
ecobeeConn
ecobeeClientId: "<API key>"
ecobeeRefreshToken: "<refresh token>"

Current Values ​

The Ecobee connector uses the ecobeeCur tag on a point to get the current value of a particular device property. The value of this tag is specified as:

<ecobeeCur> := <thermostat-id>('/' property-path)*
<property-path> := <property name> | <property-selector>
<property-name> := Str
<property-selector> := <property-name> '[' [<property-name> '='] <value>']'
<value> := Str

NOTE: for the property-selector syntax you can omit the property-name if the value
corresponds to an object's unique id.

Ecobee thermostats are represented in JSON format. This syntax is basically a way to navigate down the tree of JSON objects to get the property value you want. For more details on the Ecobee Thermostat object representation, see the Ecobee Thermostat Object Documentation

For example: to get the the temperature currently reported by the thermostat, this is the actualTemperature property of the runtime object on the Thermostat. The ecobeeCur for this property on thremostat with id 12345:

// The thermostat actual temperature
ecobeeCur: "/12345/runtime/actualTemperature"

// Thermostat JSON
{
  "identifier": "12345",
  "runtime": {
    "actualTemperature": 705
    ...
  }
  ...
}

Your thermostat may have multiple remote sensors connected to it. If you want to get the temperature being reported by a remote sensor you will need to use the <property-selector> syntax like below (because there are multiple remote sensors). The property-selector syntax must be used whenever an object is a list.

// The temperature reported by the "Game Room" remote sensor
ecobeeCur: "/12345/remoteSensors[rs:100]/capability[type=temperature]/value"

// Thermostat JSON
{
  "identifier": "12345",
  ...
  "remoteSensors": [
    {
      "id": "rs:100",
      "name": "Game Room",
      ...
      "capability": [
        {
          "id": "1",
          "type": "temperature",
          "value": "705"
        },
        {
          "id": "2",
          "type": "occupancy",
          "value": "false"
        }
      ]
    },
    {
      "id": "ei:0",
      "name": "Upstairs Thermostat",
      ...
      "capability": [
        {
          "id": "1",
          "type": "temperature",
          "value": "759"
        },
        {
          "id": "2",
          "type": "humidity",
          "value": "31"
        },
        {
          "id": "3",
          "type": "occupancy",
          "value": "true"
        }
      ]
    }
  ]
}

Writable Points ​

The connector supports writing values to an Ecobee thermostat. Use the ecobeeWrite tag to configure the address for the point to write. It uses the same syntax defined above for ecobeeCur.

History Points ​

The connector supports reading historical trend data from the thermostat. Use the ecobeeHis tag to configure the address for the historical point to trend. It uses a similar syntax as defined above for ecobeeCur. Only runtime report data is currently supported.

ecobeeHis: <thermostat-id>/runtime/<runtimeReportProperty>

The connector learn handles configuring this tag for the most common points but you can configure additional history points. See Ecobee Runtime Reports for more details on available runtime report properties and how they are reported.

Learn ​

The Ecobee connector supports connLearn() to learn the most common points from your Thermostat. It will not show you all properties that can be learned about a thermostat - just the most common. You can always manually create a point and specify the ecobeeCur and ecobeeWrite using the syntax outlined above.

API Rate Limiting ​

As detailed in the Ecobee API Docs, polling for API changes should be limited to once every 3 minutes. The connector handles this for your. Even if your connector is configured with a pollTime of less than 3 minutes, the connector will only attempt to sync current data values at 3 minute intervals.



def ​

ecobeeClientId ​

Your Ecobee API Key


meta ​

defecobeeClientId
ispassword
liblib:ecobee
tagOnecobeeConn
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 ​

ecobeeConn ​

Ecobee connector


meta ​

connFeatures
defecobeeConn
iconecobee
isconn
liblib:ecobee

usage ​

ecobeeConn  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
ecobeeClientIdYour Ecobee API Key
ecobeeRefreshTokenThe refresh token you obtained for your API key
idDefines the unique identifier of an entity in system using a ref value type


def ​

ecobeeConnRef ​

Used on a proxy point to reference its parent ecobeeConn


meta ​

defecobeeConnRef
isref
liblib:ecobee
ofecobeeConn
tagOnecobeePoint

supertypes ​

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


def ​

ecobeeCur ​

Ecobee address to use to get the current value.


meta ​

defecobeeCur
isstr
liblib:ecobee
tagOnecobeePoint

supertypes ​

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


def ​

ecobeeHis ​

Ecobee address to use to sync point history.


meta ​

defecobeeHis
isstr
liblib:ecobee
tagOnecobeePoint

supertypes ​

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


def ​

ecobeePoint ​

Point which synchronizes data via an Ecobee connector.


meta ​

defecobeePoint
isconnPoint
liblib:ecobee

usage ​

ecobeePoint  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
ecobeeConnRefUsed on a proxy point to reference its parent ecobeeConn
ecobeeCurEcobee address to use to get the current value
ecobeeHisEcobee address to use to sync point history
ecobeeWriteEcobee address to use to write a point value
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
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 ​

ecobeeRefreshToken ​

The refresh token you obtained for your API key


meta ​

defecobeeRefreshToken
ispassword
liblib:ecobee
tagOnecobeeConn
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 ​

ecobeeWrite ​

Ecobee address to use to write a point value.


meta ​

defecobeeWrite
isstr
liblib:ecobee
tagOnecobeePoint

supertypes ​

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