Documentation
¶
Index ¶
- Constants
- type CameraService
- type Client
- type Error
- type Event
- type EventsType
- type SmokeCoAlarmService
- type Stream
- type ThermostatService
- func (svc *ThermostatService) Get(deviceid string) (*device.Thermostat, error)
- func (svc *ThermostatService) GetFanTimerActive(deviceid string) error
- func (svc *ThermostatService) SetFanTimerDuration(deviceid string, duration int) error
- func (svc *ThermostatService) SetHVACMode(deviceid string, state hvacMode) error
- func (svc *ThermostatService) SetLabel(deviceid string, label string) error
- func (svc *ThermostatService) SetTargetTemperature(deviceid string, scale tempScale, target int) error
- func (svc *ThermostatService) SetTargetTemperatureRange(deviceid string, scale tempScale, low, high int) error
- func (svc *ThermostatService) SetTemperatureScale(deviceid string, scale tempScale) error
- func (svc *ThermostatService) Stream(deviceID string) (*Stream, error)
Constants ¶
const ( // Heat mode Heat hvacMode = "heat" // Cool mode Cool hvacMode = "cool" // HeatCool mode HeatCool hvacMode = "heat-cool" // Eco mode Eco hvacMode = "eco" // Off mode Off hvacMode = "off" )
const ( // F represents Farenheight F tempScale = "F" // C represents celcius C tempScale = "C" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CameraService ¶
type CameraService service
CameraService provides read and control for Camera devices. Most of the device calls are read-only, thus a majority of the time, a call to Get() will fetch all of the appropriate attributes although convenience methods for writing certain values are provided.
func NewCameraService ¶
func NewCameraService(client *Client) *CameraService
NewCameraService creates a new service.
func (*CameraService) Get ¶
func (svc *CameraService) Get(deviceid string) (*device.Camera, error)
Get fetches an updated camera object given a device id. https://developers.nest.com/reference/api-camera
func (*CameraService) Stream ¶
func (svc *CameraService) Stream(deviceID string) (*Stream, error)
Stream opens an event stream to monitor changes on the Camera https://developers.nest.com/guides/api/rest-streaming-guide
type Client ¶
type Client struct { Thermostats *ThermostatService SmokeCoAlarms *SmokeCoAlarmService Cameras *CameraService // contains filtered or unexported fields }
Client provides API functionality to Nest APIs
type Error ¶
type Error struct { Err string `json:"error"` Type string `json:"type"` Message string `json:"message"` Instance string `json:"instance"` }
Error represents an error from API call
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event represents a response when changes occur in structure or device data.
type EventsType ¶ added in v0.9.1
type EventsType string
EventsType describes the supported event types (usually based on device)
const ( Thermostats EventsType = "thermostats" SmokeCoAlarms EventsType = "smoke_co_alarms" Cameras EventsType = "cameras" KeepAlive EventsType = "keep-alive" EventError EventsType = "error" )
all the event types
type SmokeCoAlarmService ¶
type SmokeCoAlarmService service
SmokeCoAlarmService interacts with Smoke+CO Alarm devices to read device data.
func NewSmokeCoAlarmService ¶
func NewSmokeCoAlarmService(client *Client) *SmokeCoAlarmService
NewSmokeCoAlarmService creates a new service to interact with Smoke+CO alarms.
func (*SmokeCoAlarmService) Get ¶
func (svc *SmokeCoAlarmService) Get(deviceid string) (*device.SmokeAlarm, error)
Get fetches an updated smokecoalarm object given a device id. https://developers.nest.com/reference/api-smoke-co-alarm
func (*SmokeCoAlarmService) Stream ¶
func (svc *SmokeCoAlarmService) Stream(deviceID string) (*Stream, error)
Stream opens an event stream to monitor changes on the smokecoalarm. https://developers.nest.com/guides/api/rest-streaming-guide https://developers.nest.com/reference/api-smoke-co-alarm
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream represents an open connection to the Nest APIs for device and structure changes. This will maintain an open socket for every stream connected to a device.
type ThermostatService ¶
type ThermostatService service
ThermostatService interacts with Thermostat devices to control and read device data.
func NewThermostatService ¶
func NewThermostatService(client *Client) *ThermostatService
NewThermostatService creates a new service to interact with Thermostats.
func (*ThermostatService) Get ¶
func (svc *ThermostatService) Get(deviceid string) (*device.Thermostat, error)
Get fetches an updated thermostat object given a deviceID. https://developers.nest.com/guides/api/thermostat-guide See Thermostat Identifiers
func (*ThermostatService) GetFanTimerActive ¶
func (svc *ThermostatService) GetFanTimerActive(deviceid string) error
GetFanTimerActive indicates if the fan timer is engaged. This is typically set with SetFanTimerDuration See https://developers.nest.com/reference/api-thermostat#fan_timer_active
func (*ThermostatService) SetFanTimerDuration ¶
func (svc *ThermostatService) SetFanTimerDuration(deviceid string, duration int) error
SetFanTimerDuration specifies the length of time (in minutes) that the fan is set to run. See https://developers.nest.com/reference/api-thermostat#fan_timer_duration
func (*ThermostatService) SetHVACMode ¶
func (svc *ThermostatService) SetHVACMode(deviceid string, state hvacMode) error
SetHVACMode sets thermostat to the given mode. Current modes supported: (heat, cool, heat-cool, eco, off) Indicates HVAC system heating/cooling modes, like Heat•Cool for systems with heating and cooling capacity, or Eco Temperatures for energy savings.
See https://developers.nest.com/reference/api-thermostat#hvac_mode
func (*ThermostatService) SetLabel ¶
func (svc *ThermostatService) SetLabel(deviceid string, label string) error
SetLabel sets a custom label for a thermostat. See https://developers.nest.com/reference/api-thermostat#label
func (*ThermostatService) SetTargetTemperature ¶
func (svc *ThermostatService) SetTargetTemperature(deviceid string, scale tempScale, target int) error
SetTargetTemperature changes the target temperature on the Thermostat. See https://developers.nest.com/guides/thermostat-guide#target_temperature
func (*ThermostatService) SetTargetTemperatureRange ¶
func (svc *ThermostatService) SetTargetTemperatureRange(deviceid string, scale tempScale, low, high int) error
SetTargetTemperatureRange changes the target temperature on the Thermostat with a given range. See https://developers.nest.com/guides/thermostat-guide# target_temperature_low(f|c) target_temperature_high(f|c)
func (*ThermostatService) SetTemperatureScale ¶
func (svc *ThermostatService) SetTemperatureScale(deviceid string, scale tempScale) error
SetTemperatureScale sets the temperature scale display to F or C.
func (*ThermostatService) Stream ¶
func (svc *ThermostatService) Stream(deviceID string) (*Stream, error)
Stream opens an event stream to monitor changes on the Thermostat https://developers.nest.com/guides/api/rest-streaming-guide