tado

package module
v0.0.0-...-3a83051 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GoDoc Build Status Go Report Card codecov

go-tado

Basic Tado API client written in go.

Work in progress

Documentation

Index

Constants

View Source
const (
	// HomeStateHome is the value of presence used when home
	HomeStateHome = "HOME"

	// HomeStateAway is the value of presence used when away
	HomeStateAway = "AWAY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client is the main client used to communicate with the Tado API.

func NewClient

func NewClient(username, password string) *Client

NewClient returns a new Tado client.

func (*Client) DeleteOverlay

func (c *Client) DeleteOverlay(in *DeleteOverlayInput) (*DeleteOverlayOutput, error)

DeleteOverlay deletes an overlay for a zone.

func (*Client) GetDayReport

func (c *Client) GetDayReport(in *GetDayReportInput) (*GetDayReportOutput, error)

GetDayReport returns a detailed zone report of a specific date.

func (*Client) GetDevices

func (c *Client) GetDevices(in *GetDevicesInput) (GetDevicesOutput, error)

GetDevices returns the devices in a home.

func (*Client) GetHome

func (c *Client) GetHome(in *GetHomeInput) (*GetHomeOutput, error)

GetHome returns the Home data for a single home.

func (*Client) GetHomeState

func (c *Client) GetHomeState(in *GetHomeStateInput) (*GetHomeStateOutput, error)

GetHomeState returns the presence state for a single home.

func (*Client) GetMe

func (c *Client) GetMe() (*GetMeOutput, error)

GetMe returns the users data from the API.

func (*Client) GetUsers

func (c *Client) GetUsers(in *GetUsersInput) (GetUsersOutput, error)

GetUsers returns the users in a home.

func (*Client) GetWeather

func (c *Client) GetWeather(in *GetWeatherInput) (*GetWeatherOutput, error)

GetWeather returns the weather info for a home.

func (*Client) GetZoneState

func (c *Client) GetZoneState(in *GetZoneStateInput) (*GetZoneStateOutput, error)

GetZoneState returns the state for a single zone within a home.

func (*Client) GetZones

func (c *Client) GetZones(in *GetZonesInput) (GetZonesOutput, error)

GetZones returns the zones for a single home.

func (*Client) PutOverlay

func (c *Client) PutOverlay(in *PutOverlayInput) (*PutOverlayOutput, error)

PutOverlay sets an overlay in a zone, it can be used to contol settings overruling a schema. For example to set the heating or hot water.

type DayReport

type DayReport struct {
	ZoneType string `json:"zoneType"`
	Interval struct {
		From time.Time `json:"from"`
		To   time.Time `json:"to"`
	} `json:"interval"`
	HoursInDay   int `json:"hoursInDay"`
	MeasuredData struct {
		MeasuringDeviceConnected struct {
			TimeSeriesType string `json:"timeSeriesType"`
			ValueType      string `json:"valueType"`
			DataIntervals  []struct {
				From  time.Time `json:"from"`
				To    time.Time `json:"to"`
				Value bool      `json:"value"`
			} `json:"dataIntervals"`
		} `json:"measuringDeviceConnected"`
		InsideTemperature struct {
			TimeSeriesType string `json:"timeSeriesType"`
			ValueType      string `json:"valueType"`
			Min            struct {
				Celsius    float64 `json:"celsius"`
				Fahrenheit float64 `json:"fahrenheit"`
			} `json:"min"`
			Max struct {
				Celsius    float64 `json:"celsius"`
				Fahrenheit float64 `json:"fahrenheit"`
			} `json:"max"`
			DataPoints []struct {
				Timestamp time.Time `json:"timestamp"`
				Value     struct {
					Celsius    float64 `json:"celsius"`
					Fahrenheit float64 `json:"fahrenheit"`
				} `json:"value"`
			} `json:"dataPoints"`
		} `json:"insideTemperature"`
		Humidity struct {
			TimeSeriesType string  `json:"timeSeriesType"`
			ValueType      string  `json:"valueType"`
			PercentageUnit string  `json:"percentageUnit"`
			Min            float64 `json:"min"`
			Max            float64 `json:"max"`
			DataPoints     []struct {
				Timestamp time.Time `json:"timestamp"`
				Value     float64   `json:"value"`
			} `json:"dataPoints"`
		} `json:"humidity"`
	} `json:"measuredData"`
	Stripes struct {
		TimeSeriesType string `json:"timeSeriesType"`
		ValueType      string `json:"valueType"`
		DataIntervals  []struct {
			From  time.Time `json:"from"`
			To    time.Time `json:"to"`
			Value struct {
				StripeType string `json:"stripeType"`
				Setting    struct {
					Type        string `json:"type"`
					Power       string `json:"power"`
					Temperature struct {
						Celsius    float64 `json:"celsius"`
						Fahrenheit float64 `json:"fahrenheit"`
					} `json:"temperature"`
				} `json:"setting"`
			} `json:"value"`
		} `json:"dataIntervals"`
	} `json:"stripes"`
	Settings struct {
		TimeSeriesType string `json:"timeSeriesType"`
		ValueType      string `json:"valueType"`
		DataIntervals  []struct {
			From  time.Time `json:"from"`
			To    time.Time `json:"to"`
			Value struct {
				Type        string `json:"type"`
				Power       string `json:"power"`
				Temperature struct {
					Celsius    float64 `json:"celsius"`
					Fahrenheit float64 `json:"fahrenheit"`
				} `json:"temperature"`
			} `json:"value"`
		} `json:"dataIntervals"`
	} `json:"settings"`
	CallForHeat struct {
		TimeSeriesType string `json:"timeSeriesType"`
		ValueType      string `json:"valueType"`
		DataIntervals  []struct {
			From  time.Time `json:"from"`
			To    time.Time `json:"to"`
			Value string    `json:"value"`
		} `json:"dataIntervals"`
	} `json:"callForHeat"`
	Weather struct {
		Condition struct {
			TimeSeriesType string `json:"timeSeriesType"`
			ValueType      string `json:"valueType"`
			DataIntervals  []struct {
				From  time.Time `json:"from"`
				To    time.Time `json:"to"`
				Value struct {
					State       string `json:"state"`
					Temperature struct {
						Celsius    float64 `json:"celsius"`
						Fahrenheit float64 `json:"fahrenheit"`
					} `json:"temperature"`
				} `json:"value"`
			} `json:"dataIntervals"`
		} `json:"condition"`
		Sunny struct {
			TimeSeriesType string `json:"timeSeriesType"`
			ValueType      string `json:"valueType"`
			DataIntervals  []struct {
				From  time.Time `json:"from"`
				To    time.Time `json:"to"`
				Value bool      `json:"value"`
			} `json:"dataIntervals"`
		} `json:"sunny"`
		Slots struct {
			TimeSeriesType string `json:"timeSeriesType"`
			ValueType      string `json:"valueType"`
			Slots          struct {
				Zero400 struct {
					State       string `json:"state"`
					Temperature struct {
						Celsius    float64 `json:"celsius"`
						Fahrenheit float64 `json:"fahrenheit"`
					} `json:"temperature"`
				} `json:"04:00"`
				Zero800 struct {
					State       string `json:"state"`
					Temperature struct {
						Celsius    float64 `json:"celsius"`
						Fahrenheit float64 `json:"fahrenheit"`
					} `json:"temperature"`
				} `json:"08:00"`
				One200 struct {
					State       string `json:"state"`
					Temperature struct {
						Celsius    float64 `json:"celsius"`
						Fahrenheit float64 `json:"fahrenheit"`
					} `json:"temperature"`
				} `json:"12:00"`
				One600 struct {
					State       string `json:"state"`
					Temperature struct {
						Celsius    float64 `json:"celsius"`
						Fahrenheit float64 `json:"fahrenheit"`
					} `json:"temperature"`
				} `json:"16:00"`
				Two000 struct {
					State       string `json:"state"`
					Temperature struct {
						Celsius    float64 `json:"celsius"`
						Fahrenheit float64 `json:"fahrenheit"`
					} `json:"temperature"`
				} `json:"20:00"`
			} `json:"slots"`
		} `json:"slots"`
	} `json:"weather"`
}

DayReport contains the daily report info

type DeleteOverlayInput

type DeleteOverlayInput struct {
	HomeID int
	ZoneID int
}

DeleteOverlayInput is the input for DeleteOverlay

type DeleteOverlayOutput

type DeleteOverlayOutput struct{}

DeleteOverlayOutput is the output for DeleteOverlay

type Device

type Device struct {
	DeviceType       string `json:"deviceType"`
	SerialNo         string `json:"serialNo"`
	ShortSerialNo    string `json:"shortSerialNo"`
	CurrentFwVersion string `json:"currentFwVersion"`
	ConnectionState  struct {
		Value     bool      `json:"value"`
		Timestamp time.Time `json:"timestamp"`
	} `json:"connectionState"`
	Characteristics struct {
		Capabilities []string `json:"capabilities"`
	} `json:"characteristics"`
	InPairingMode bool `json:"inPairingMode,omitempty"`
	MountingState struct {
		Value     string    `json:"value"`
		Timestamp time.Time `json:"timestamp"`
	} `json:"mountingState,omitempty"`
	BatteryState string `json:"batteryState,omitempty"`
}

type GetDayReportInput

type GetDayReportInput struct {
	HomeID int
	ZoneID int
	Date   time.Time
}

GetDayReportInput is the input for GetDayReport

type GetDayReportOutput

type GetDayReportOutput struct {
	DayReport
}

GetDayReportOutput is the output for GetDayReport

type GetDevicesInput

type GetDevicesInput struct {
	HomeID int
}

GetDevicesInput is the input for GetDevices

type GetDevicesOutput

type GetDevicesOutput []Device

GetDevicesOutput is the output for GetDevices

type GetHomeInput

type GetHomeInput struct {
	HomeID int
}

GetHomeInput is the input for GetHome

type GetHomeOutput

type GetHomeOutput struct {
	Home
}

GetHomeOutput is the output for GetHome

type GetHomeStateInput

type GetHomeStateInput struct {
	HomeID int
}

GetHomeStateInput is the input for GetHomeState

type GetHomeStateOutput

type GetHomeStateOutput struct {
	HomeState
}

GetHomeStateOutput is the output for GetHomeState

type GetMeInput

type GetMeInput struct{}

GetMeInput is the input for GetMe

type GetMeOutput

type GetMeOutput struct {
	Me
}

GetMeOutput is the output for GetMe

type GetUsersInput

type GetUsersInput struct {
	HomeID int
}

GetUsersInput is the input for GetUsers

type GetUsersOutput

type GetUsersOutput []User

GetUsersOutput is the output for GetUsers

type GetWeatherInput

type GetWeatherInput struct {
	HomeID int
}

GetWeatherInput is the input for GetWeather

type GetWeatherOutput

type GetWeatherOutput struct {
	Weather
}

GetWeatherOutput is the output for GetWeather

type GetZoneStateInput

type GetZoneStateInput struct {
	HomeID int
	ZoneID int
}

GetZoneStateInput is the input for GetZoneState

type GetZoneStateOutput

type GetZoneStateOutput struct {
	ZoneState
}

GetZoneStateOutput is the output for GetZoneState

type GetZonesInput

type GetZonesInput struct {
	HomeID int
}

GetZonesInput is the input for GetZones

type GetZonesOutput

type GetZonesOutput []Zone

GetZonesOutput is the output for GetZones

type Home

type Home struct {
	ID                         int           `json:"id"`
	Name                       string        `json:"name"`
	DateTimeZone               string        `json:"dateTimeZone"`
	DateCreated                time.Time     `json:"dateCreated"`
	TemperatureUnit            string        `json:"temperatureUnit"`
	InstallationCompleted      bool          `json:"installationCompleted"`
	Partner                    string        `json:"partner"`
	SimpleSmartScheduleEnabled bool          `json:"simpleSmartScheduleEnabled"`
	AwayRadiusInMeters         float64       `json:"awayRadiusInMeters"`
	UsePreSkillsApps           bool          `json:"usePreSkillsApps"`
	Skills                     []interface{} `json:"skills"` // TODO
	ChristmasModeEnabled       bool          `json:"christmasModeEnabled"`
	ShowAutoAssistReminders    bool          `json:"showAutoAssistReminders"`
	ContactDetails             struct {
		Name  string `json:"name"`
		Email string `json:"email"`
		Phone string `json:"phone"`
	} `json:"contactDetails"`
	Address struct {
		AddressLine1 string `json:"addressLine1"`
		AddressLine2 string `json:"addressLine2"`
		ZipCode      string `json:"zipCode"`
		City         string `json:"city"`
		State        string `json:"state"`
		Country      string `json:"country"`
	} `json:"address"`
	Geolocation struct {
		Latitude  float64 `json:"latitude"`
		Longitude float64 `json:"longitude"`
	} `json:"geolocation"`
	ConsentGrantSkippable bool `json:"consentGrantSkippable"`
}

Home is the info for a single home

type HomeState

type HomeState struct {
	Presence string `json:"presence"`
}

HomeState is the state of a home

type Me

type Me struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Username string `json:"username"`
	ID       string `json:"id"`
	Homes    []struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"homes"`
	Locale        string `json:"locale"`
	MobileDevices []struct {
		Name     string `json:"name"`
		ID       int    `json:"id"`
		Settings struct {
			GeoTrackingEnabled bool `json:"geoTrackingEnabled"`
		} `json:"settings"`
		DeviceMetadata struct {
			Platform  string `json:"platform"`
			OsVersion string `json:"osVersion"`
			Model     string `json:"model"`
			Locale    string `json:"locale"`
		} `json:"deviceMetadata"`
	} `json:"mobileDevices"`
}

Me contains the users data

type OverlayInput

type OverlayInput struct {
	Setting     OverlayInputSetting     `json:"setting"`
	Termination OverlayInputTermination `json:"termination"`
}

OverlayInput is the main input for an overlay

type OverlayInputSetting

type OverlayInputSetting struct {
	Type        string                  `json:"type"`
	Power       string                  `json:"power"`
	Temperature OverlayInputTemperature `json:"temperature"`
}

OverlayInputSetting contains the settings for the overlay

type OverlayInputTemperature

type OverlayInputTemperature struct {
	Celsius    float64 `json:"celsius,omitempty"`
	Fahrenheit float64 `json:"fahrenheit,omitempty"`
}

OverlayInputTemperature contains the temperature settings for the overlay

type OverlayInputTermination

type OverlayInputTermination struct {
	Type              TerminationType `json:"type"`
	DurationInSeconds int             `json:"durationInSeconds,omitempty"`
}

OverlayInputTermination contains the termination settings for the overlay

type OverlayOutput

type OverlayOutput struct {
	Type    string `json:"type"`
	Setting struct {
		Type        string `json:"type"`
		Power       string `json:"power"`
		Temperature struct {
			Celsius    float64 `json:"celsius"`
			Fahrenheit float64 `json:"fahrenheit"`
		} `json:"temperature"`
	} `json:"setting"`
	Termination struct {
		Type                   string    `json:"type"`
		TypeSkillBasedApp      string    `json:"typeSkillBasedApp"`
		DurationInSeconds      int       `json:"durationInSeconds"`
		Expiry                 time.Time `json:"expiry"`
		RemainingTimeInSeconds int       `json:"remainingTimeInSeconds"`
		ProjectedExpiry        time.Time `json:"projectedExpiry"`
	} `json:"termination"`
}

OverlayOutput is the output for a successful overlay update

type PutOverlayInput

type PutOverlayInput struct {
	HomeID int
	ZoneID int
	OverlayInput
}

PutOverlayInput is the input for PutOverlay

type PutOverlayOutput

type PutOverlayOutput struct {
	OverlayOutput
}

PutOverlayOutput is the output for PutOverlay

type TerminationType

type TerminationType string

TerminationType is an enum type for overlay termination types

const (
	//TerminationTypeManual is used for manual termination
	TerminationTypeManual TerminationType = "MANUAL"

	// TerminationTypeTimer is used for automation termination, use property DurationInSeconds to set the timer duration
	TerminationTypeTimer TerminationType = "TIMER"

	// TerminationTypeTadoMode is used to terminate this setting by Tado, the overlay ends when the schema changes
	TerminationTypeTadoMode TerminationType = "TADO_MODE"
)

type User

type User struct {
	Name     string `json:"name"`
	Email    string `json:"email"`
	Username string `json:"username"`
	ID       string `json:"id"`
	Homes    []struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"homes"`
	Locale        string `json:"locale"`
	MobileDevices []struct {
		Name     string `json:"name"`
		ID       int    `json:"id"`
		Settings struct {
			GeoTrackingEnabled bool `json:"geoTrackingEnabled"`
		} `json:"settings"`
		DeviceMetadata struct {
			Platform  string `json:"platform"`
			OsVersion string `json:"osVersion"`
			Model     string `json:"model"`
			Locale    string `json:"locale"`
		} `json:"deviceMetadata"`
	} `json:"mobileDevices"`
}

type Weather

type Weather struct {
	SolarIntensity struct {
		Type       string    `json:"type"`
		Percentage float64   `json:"percentage"`
		Timestamp  time.Time `json:"timestamp"`
	} `json:"solarIntensity"`
	OutsideTemperature struct {
		Celsius    float64   `json:"celsius"`
		Fahrenheit float64   `json:"fahrenheit"`
		Timestamp  time.Time `json:"timestamp"`
		Type       string    `json:"type"`
		Precision  struct {
			Celsius    float64 `json:"celsius"`
			Fahrenheit float64 `json:"fahrenheit"`
		} `json:"precision"`
	} `json:"outsideTemperature"`
	WeatherState struct {
		Type      string    `json:"type"`
		Value     string    `json:"value"`
		Timestamp time.Time `json:"timestamp"`
	} `json:"weatherState"`
}

Weather is the weather info for a home

type Zone

type Zone struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Type        string    `json:"type"`
	DateCreated time.Time `json:"dateCreated"`
	DeviceTypes []string  `json:"deviceTypes"`
	Devices     []struct {
		DeviceType       string `json:"deviceType"`
		SerialNo         string `json:"serialNo"`
		ShortSerialNo    string `json:"shortSerialNo"`
		CurrentFwVersion string `json:"currentFwVersion"`
		ConnectionState  struct {
			Value     bool      `json:"value"`
			Timestamp time.Time `json:"timestamp"`
		} `json:"connectionState"`
		Characteristics struct {
			Capabilities []string `json:"capabilities"`
		} `json:"characteristics"`
		MountingState struct {
			Value     string    `json:"value"`
			Timestamp time.Time `json:"timestamp"`
		} `json:"mountingState"`
		BatteryState string   `json:"batteryState"`
		Duties       []string `json:"duties"`
	} `json:"devices"`
	ReportAvailable bool `json:"reportAvailable"`
	SupportsDazzle  bool `json:"supportsDazzle"`
	DazzleEnabled   bool `json:"dazzleEnabled"`
	DazzleMode      struct {
		Supported bool `json:"supported"`
		Enabled   bool `json:"enabled"`
	} `json:"dazzleMode"`
	OpenWindowDetection struct {
		Supported        bool `json:"supported"`
		Enabled          bool `json:"enabled"`
		TimeoutInSeconds int  `json:"timeoutInSeconds"`
	} `json:"openWindowDetection"`
}

Zone contains info about a single zone

type ZoneState

type ZoneState struct {
	TadoMode                       string      `json:"tadoMode"`
	GeolocationOverride            bool        `json:"geolocationOverride"`
	GeolocationOverrideDisableTime interface{} `json:"geolocationOverrideDisableTime"` // TODO
	Preparation                    interface{} `json:"preparation"`                    // TODO
	Setting                        struct {
		Type        string `json:"type"`
		Power       string `json:"power"`
		Temperature struct {
			Celsius    float64 `json:"celsius"`
			Fahrenheit float64 `json:"fahrenheit"`
		} `json:"temperature"`
	} `json:"setting"`
	OverlayType string `json:"overlayType"`
	Overlay     struct {
		Type    string `json:"type"`
		Setting struct {
			Type        string `json:"type"`
			Power       string `json:"power"`
			Temperature struct {
				Celsius    float64 `json:"celsius"`
				Fahrenheit float64 `json:"fahrenheit"`
			} `json:"temperature"`
		} `json:"setting"`
		Termination struct {
			Type                   string    `json:"type"`
			TypeSkillBasedApp      string    `json:"typeSkillBasedApp"`
			DurationInSeconds      int       `json:"durationInSeconds"`
			Expiry                 time.Time `json:"expiry"`
			RemainingTimeInSeconds int       `json:"remainingTimeInSeconds"`
			ProjectedExpiry        time.Time `json:"projectedExpiry"`
		} `json:"termination"`
	} `json:"overlay"`
	OpenWindow         interface{} `json:"openWindow"` // TODO
	NextScheduleChange struct {
		Start   time.Time `json:"start"`
		Setting struct {
			Type        string `json:"type"`
			Power       string `json:"power"`
			Temperature struct {
				Celsius    float64 `json:"celsius"`
				Fahrenheit float64 `json:"fahrenheit"`
			} `json:"temperature"`
		} `json:"setting"`
	} `json:"nextScheduleChange"`
	NextTimeBlock struct {
		Start time.Time `json:"start"`
	} `json:"nextTimeBlock"`
	Link struct {
		State string `json:"state"`
	} `json:"link"`
	ActivityDataPoints struct {
		HeatingPower struct {
			Type       string    `json:"type"`
			Percentage float64   `json:"percentage"`
			Timestamp  time.Time `json:"timestamp"`
		} `json:"heatingPower"`
	} `json:"activityDataPoints"`
	SensorDataPoints struct {
		InsideTemperature struct {
			Celsius    float64   `json:"celsius"`
			Fahrenheit float64   `json:"fahrenheit"`
			Timestamp  time.Time `json:"timestamp"`
			Type       string    `json:"type"`
			Precision  struct {
				Celsius    float64 `json:"celsius"`
				Fahrenheit float64 `json:"fahrenheit"`
			} `json:"precision"`
		} `json:"insideTemperature"`
		Humidity struct {
			Type       string    `json:"type"`
			Percentage float64   `json:"percentage"`
			Timestamp  time.Time `json:"timestamp"`
		} `json:"humidity"`
	} `json:"sensorDataPoints"`
}

ZoneState is the state of a single zone

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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