honeywell

package module
v0.0.0-...-f4dde09 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2016 License: MIT Imports: 11 Imported by: 2

README

honeywell

golang library for monitoring and controlling Honeywell WIFI thermostat products that use the https://mytotalconnectcomfort.com portal.

##Documentation See godoc

##Installation

go get github.com/go-home-iot/honeywell

##Using the library To use the library, see the examples in honeywell_test.go You will need to know your device ID for the device you wish to control. The deviceID has to be determined manually, log in to the mytotalconnectcomfort website,navigate to your device, then the URL will look something like https://mytotalconnectcomfort.com/portal/Device/CheckDataSession/123456, you need to copy the number that is in place of the 123456 and use that as your device ID.

Once you have your device ID you can create a thermostat instance, call Connect() first, then call the other methods, e.g. if we want to temporarily set the temperature to 68 degrees for 30 minutes we would do:

ctx := context.TODO()
ts := honeywell.NewThermostat(DEVICEID)
err := ts.Connect(ctx, LOGIN, PASSWORD)
if err != nil {
  //handle error
}

err = ts.HeatMode(ctx, 68.0, time.Minute*30)
if err != nil {
  //handle error
}

##Version History ###0.1.0 Initial release, support for Heat/Cool/Cancel and getting the current state

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

Auth will be returned from a successful Login() call, you should use this to call functions such as FetchStatus() that require auth information

type DRData

type DRData struct {
	CoolSetpLimit float32 `json:"CoolSetpLimit"`
	HeatSetpLimit float32 `json:"HeatSetpLimit"`
	Phase         float32 `json:"Phase"`
	OptOutable    bool    `json:"OptOutable"`
	DeltaCoolSP   float32 `json:"DeltaCoolSP"`
	DeltaHeatSP   float32 `json:"DeltaHeatSP"`
	Load          float32 `json:"Load"`
}

DRData block returned from the server

type FanData

type FanData struct {
	FanMode                      float32 `json:"fanMode"`
	FanModeAutoAllowed           bool    `json:"fanModeAutoAllowed"`
	FanModeOnAllowed             bool    `json:"fanModeOnAllowed"`
	FanModeCirculateAllowed      bool    `json:"fanModeCirculateAllowed"`
	FanModeFollowScheduleAllowed bool    `json:"fanModeFollowScheduleAllowed"`
	FanIsRunning                 bool    `json:"fanIsRunning"`
}

FanData block returned from the server

type LatestData

type LatestData struct {
	HasFan                   bool    `json:"hasFan"`
	CanControlHumidification bool    `json:"canControlHumidification"`
	UIData                   UIData  `json:"uiData"`
	FanData                  FanData `json:"fanData"`
	DRData                   DRData  `json:"drData"`
}

LatestData block returned from the server

type Status

type Status struct {
	Success           bool       `json:"success"`
	DeviceLive        bool       `json:"deviceLive"`
	CommunicationLost bool       `json:"communicationLost"`
	LatestData        LatestData `json:"latestData"`
}

Status block returned from the server

type Thermostat

type Thermostat interface {
	// Connect connects to the mytotalconnectcomform service and authenticates the caller
	Connect(ctx context.Context, login, password string) error

	// FetchStatus fetches the current status of the device. NOTE: you must have called Connect()
	// first to authenticate the caller before calling this function, otherwise it will fail
	FetchStatus(ctx context.Context) (*Status, error)

	// CoolMode enables cool mode to the desired temp and duration. Pass 0 for period to run to next
	// schedule point
	CoolMode(ctx context.Context, temp float32, period time.Duration) error

	// HeatMode enables heat mode to the desired temp and duration. Pass 0 for period to run to next
	// schedule point
	HeatMode(ctx context.Context, temp float32, period time.Duration) error

	// FanMode switches between on and auto.  You can pass "on" or "auto" for mode
	FanMode(ctx context.Context, mode string) error

	// Cancel reverts the thermostat back to the schedule
	Cancel(ctx context.Context) error
}

Thermostat is an interface to a thermostat device

func NewThermostat

func NewThermostat(deviceID int) Thermostat

NewThermostat returns an initialzed thermostat instance. The deviceID has to be determined manually, log in to the mytotalconnectcomfort website, navigate to your device, then the URL will look something like https://mytotalconnectcomfort.com/portal/Device/CheckDataSession/123456, you need to copy the number that is in place of the 123456 and use that as your device ID.

type UIData

type UIData struct {
	DispTemperature                  float32
	HeatSetpoint                     float32
	CoolSetpoint                     float32
	DisplayUnits                     string
	StatusHeat                       float32
	StatusCool                       float32
	HoldUntilCapable                 bool
	ScheduleCapable                  bool
	VacationHold                     float32
	DualSetpointStatus               bool
	HeatNextPeriod                   float32
	CoolNextPeriod                   float32
	HeatLowerSetptLimit              float32
	HeatUpperSetptLimit              float32
	CoolLowerSetptLimit              float32
	CoolUpperSetptLimit              float32
	ScheduleHeatSp                   float32
	ScheduleCoolSp                   float32
	SwitchAutoAllowed                bool
	SwitchCoolAllowed                bool
	SwitchOffAllowed                 bool
	SwitchHeatAllowed                bool
	SwitchEmergencyHeatAllowed       bool
	SystemSwitchPosition             float32
	Deadband                         float32
	IndoorHumidity                   float32
	DeviceID                         int
	Commercial                       bool
	DispTemperatureAvailable         bool
	IndoorHumiditySensorAvailable    bool
	IndoorHumiditySensorNotFault     bool
	VacationHoldUntilTime            float32
	TemporaryHoldUntilTime           float32
	IsInVacationHoldMode             bool
	VacationHoldCancelable           bool
	SetpointChangeAllowed            bool
	OutdoorTemperature               float32
	OutdoorHumidity                  float32
	OutdoorHumidityAvailable         bool
	OutdoorTemperatureAvailable      bool
	DispTemperatureStatus            float32
	IndoorHumidStatus                float32
	OutdoorTempStatus                float32
	OutdoorHumidStatus               float32
	OutdoorTemperatureSensorNotFault bool
	OutdoorHumiditySensorNotFault    bool
	CurrentSetpointStatus            float32
	EquipmentOutputStatus            float32
}

UIData contains information returned from the honeywell service about a thermostat

Jump to

Keyboard shortcuts

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