nestStructure

package module
v0.0.0-...-466b168 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2017 License: Apache-2.0 Imports: 9 Imported by: 9

README

Nest API in Go

Build Status Build size Go Report Card Coverage Status GoDoc License

Package NestStructure

The NestStructure package provides APIs for nest device.

Nest API Go

If you want, I have a runtime client which uses this API.

License

The code is licensed under the permissive Apache v2.0 licence. This means you can do what you like with the software, as long as you include the required notices. Read this for a summary.

Documentation

Overview

Package nestStructure calls rest API Nest, puts it in the structure and gives somes functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	AccessToken   string  `json:"access_token"`
	ClientVersion float64 `json:"client_version"`
}

Metadata sub structure from NestStructure

type Nest

type Nest interface {
	GetDeviceID() string
	GetSoftwareVersion() string
	GetAmbientTemperatureC() float64
	GetTargetTemperatureC() float64
	GetAmbientTemperatureF() float64
	GetTargetTemperatureF() float64
	GetHumidity() float64
	GetAway() string
	GetNestStruct() NestStructure
	Refresh()
	RefreshFromBody(body []byte)
	GetLastCall() string
}

Nest is the Interface NestStructure

func New

func New(url, token string, mock bool, l *logrus.Logger) Nest

New calls Nest and get structureNest

type NestStructure

type NestStructure struct {
	Devices struct {
		Thermostats struct {
			ThermostatID ThermostatID `json:"noNeeded"`
		} `json:"thermostats"`
	} `json:"devices"`
	Metadata   Metadata `json:"metadata"`
	Structures struct {
		StructureID StructureID `json:"noNeeded"`
	} `json:"structures"`
}

NestStructure generate by http://mervine.net/json2struct you must replace your ThermostatID and you structure ID

type StructureID

type StructureID struct {
	Away        string   `json:"away"`
	CountryCode string   `json:"country_code"`
	Name        string   `json:"name"`
	StructureID string   `json:"structure_id"`
	Thermostats []string `json:"thermostats"`
}

StructureID sub structure from NestStructure

type ThermostatID

type ThermostatID struct {
	AmbientTemperatureC    float64 `json:"ambient_temperature_c"`
	AmbientTemperatureF    float64 `json:"ambient_temperature_f"`
	AwayTemperatureHighC   float64 `json:"away_temperature_high_c"`
	AwayTemperatureHighF   float64 `json:"away_temperature_high_f"`
	AwayTemperatureLowC    float64 `json:"away_temperature_low_c"`
	AwayTemperatureLowF    float64 `json:"away_temperature_low_f"`
	CanCool                bool    `json:"can_cool"`
	CanHeat                bool    `json:"can_heat"`
	DeviceID               string  `json:"device_id"`
	FanTimerActive         bool    `json:"fan_timer_active"`
	HasFan                 bool    `json:"has_fan"`
	HasLeaf                bool    `json:"has_leaf"`
	Humidity               float64 `json:"humidity"`
	HvacMode               string  `json:"hvac_mode"`
	IsOnline               bool    `json:"is_online"`
	IsUsingEmergencyHeat   bool    `json:"is_using_emergency_heat"`
	LastConnection         string  `json:"last_connection"`
	Locale                 string  `json:"locale"`
	Name                   string  `json:"name"`
	NameLong               string  `json:"name_long"`
	SoftwareVersion        string  `json:"software_version"`
	StructureID            string  `json:"structure_id"`
	TargetTemperatureC     float64 `json:"target_temperature_c"`
	TargetTemperatureF     float64 `json:"target_temperature_f"`
	TargetTemperatureHighC float64 `json:"target_temperature_high_c"`
	TargetTemperatureHighF float64 `json:"target_temperature_high_f"`
	TargetTemperatureLowC  float64 `json:"target_temperature_low_c"`
	TargetTemperatureLowF  float64 `json:"target_temperature_low_f"`
	TemperatureScale       string  `json:"temperature_scale"`
}

ThermostatID sub structure from NestStructure

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL