Documentation
¶
Overview ¶
Package tado provides an API Client for the Tadoº smart thermostat devices
NOTE: the tado package currently only supports heating devices. Hot water & AC devices are not supported. If you have access to these devices, let me know, so I can add support for these in a later release.
Multi-home accounts ¶
Most Tado users will only have a single home associated with their Tado account. If an account has multiple homes, this package will by default use the first home associated with the account. To use the package's API for another home, use SetActiveHomeByName to set the active home. All subsequent commands will be executed against that home.
Index ¶
- type APIClient
- func (c *APIClient) DeleteZoneOverlay(ctx context.Context, zoneID int) error
- func (c *APIClient) GetAccount(ctx context.Context) (Account, error)
- func (c *APIClient) GetActiveHome(ctx context.Context) (Home, bool)
- func (c *APIClient) GetActiveTimeTable(ctx context.Context, zoneID int) (timeTable Timetable, err error)
- func (c *APIClient) GetAirComfort(ctx context.Context) (airComfort AirComfort, err error)
- func (c *APIClient) GetConsumption(ctx context.Context, country string, start, end time.Time) (consumption Consumption, err error)
- func (c *APIClient) GetDefaultOverlay(ctx context.Context, zoneID int) (DefaultOverlay, error)
- func (c *APIClient) GetEnergySavings(ctx context.Context) (reports []EnergySavingsReport, err error)
- func (c *APIClient) GetHeatingCircuits(ctx context.Context) (output []HeatingCircuit, err error)
- func (c *APIClient) GetHomeInfo(ctx context.Context) (homeInfo HomeInfo, err error)
- func (c *APIClient) GetHomeState(ctx context.Context) (homeState HomeState, err error)
- func (c *APIClient) GetHomes(ctx context.Context) (zones Homes, err error)
- func (c *APIClient) GetMobileDevices(ctx context.Context) (tadoMobileDevices []MobileDevice, err error)
- func (c *APIClient) GetRunningTimes(ctx context.Context, from, to time.Time) (runningTimes []RunningTime, err error)
- func (c *APIClient) GetTimeTableBlocks(ctx context.Context, zoneID int, timetableID TimetableID) (blocks []Block, err error)
- func (c *APIClient) GetTimeTableBlocksForDayType(ctx context.Context, zoneID int, timetableID TimetableID, dayType DayType) (blocks []Block, err error)
- func (c *APIClient) GetTimeTables(ctx context.Context, zoneID int) (timeTables []Timetable, err error)
- func (c *APIClient) GetUsers(ctx context.Context) (users []User, err error)
- func (c *APIClient) GetWeatherInfo(ctx context.Context) (weatherInfo WeatherInfo, err error)
- func (c *APIClient) GetZoneAutoConfiguration(ctx context.Context, zoneID int) (configuration ZoneAwayConfiguration, err error)
- func (c *APIClient) GetZoneCapabilities(ctx context.Context, zoneID int) (tadoZoneCapabilities ZoneCapabilities, err error)
- func (c *APIClient) GetZoneDayReport(ctx context.Context, zoneID int, date time.Time) (report DayReport, err error)
- func (c *APIClient) GetZoneEarlyStart(ctx context.Context, zoneID int) (earlyStart bool, err error)
- func (c *APIClient) GetZoneInfo(ctx context.Context, zoneID int) (tadoZoneInfo ZoneInfo, err error)
- func (c *APIClient) GetZoneMeasuringDevice(ctx context.Context, zoneID int) (measuringDevice ZoneMeasuringDevice, err error)
- func (c *APIClient) GetZones(ctx context.Context) (zones Zones, err error)
- func (c *APIClient) SetActiveHome(ctx context.Context, id int) (err error)
- func (c *APIClient) SetActiveHomeByName(ctx context.Context, name string) (err error)
- func (c *APIClient) SetActiveTimeTable(ctx context.Context, zoneID int, timeTable Timetable) error
- func (c *APIClient) SetDefaultOverlay(ctx context.Context, zoneID int, mode DefaultOverlay) error
- func (c *APIClient) SetHomeState(ctx context.Context, home bool) error
- func (c *APIClient) SetTimeTableBlocksForDayType(ctx context.Context, zoneID int, timetableID TimetableID, dayType DayType, ...) error
- func (c *APIClient) SetZoneAwayAutoAdjust(ctx context.Context, zoneID int, comfortLevel ComfortLevel) error
- func (c *APIClient) SetZoneAwayManual(ctx context.Context, zoneID int, temperature float64) error
- func (c *APIClient) SetZoneEarlyStart(ctx context.Context, zoneID int, earlyAccess bool) error
- func (c *APIClient) SetZoneOverlay(ctx context.Context, zoneID int, temperature float64) (err error)
- func (c *APIClient) SetZoneTemporaryOverlay(ctx context.Context, zoneID int, temperature float64, duration time.Duration) (err error)
- func (c *APIClient) UnsetHomeState(ctx context.Context) error
- type APIError
- type Account
- type AirComfort
- type Block
- type ComfortLevel
- type Consumption
- type ConsumptionDetails
- type ConsumptionPerDay
- type DayReport
- type DayType
- type DefaultOverlay
- type Device
- type EnergySavingsReport
- type FloatValue
- type HeatingCircuit
- type Home
- type HomeInfo
- type HomeState
- type Homes
- type IntValue
- type MobileDevice
- type MobileDeviceLocation
- type MobileDeviceLocationState
- type MobileDeviceSettings
- type OverlayTerminationMode
- type Percentage
- type RunningTime
- type State
- type Temperature
- type Timetable
- type TimetableID
- type UnprocessableEntryError
- type User
- type Value
- type WeatherInfo
- type Zone
- type ZoneAirComfort
- type ZoneAwayConfiguration
- type ZoneCapabilities
- type ZoneInfo
- type ZoneInfoActivityDataPoints
- type ZoneInfoOpenWindow
- type ZoneInfoOverlay
- type ZoneInfoOverlayTermination
- type ZoneInfoSensorDataPoints
- type ZoneMeasuringDevice
- type ZonePowerSetting
- type Zones
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// HTTPClient is used to perform HTTP requests
HTTPClient *http.Client
// contains filtered or unexported fields
}
APIClient represents a Tado API client.
func New ¶ added in v0.5.0
New creates a new Tado API client
clientSecret can typically be left blank. If the default secret does not work, your client secret can be found by visiting https://my.tado.com/webapp/env.js after logging in to https://my.tado.com
func NewWithContext ¶ added in v1.2.0
func NewWithContext(ctx context.Context, username, password, clientSecret string) (*APIClient, error)
NewWithContext creates a new Tado API client for the provided Context. The API Client will no longer be valid when the Context is cancelled.
clientSecret can typically be left blank. If the default secret does not work, your client secret can be found by visiting https://my.tado.com/webapp/env.js after logging in to https://my.tado.com
func (*APIClient) DeleteZoneOverlay ¶
DeleteZoneOverlay deletes the overlay (manual temperature setting) for the specified ZoneID
Example ¶
package main
import (
"context"
"fmt"
"github.com/clambin/tado"
"os"
)
func main() {
c, _ := tado.New(os.Getenv("TADO_USERNAME"), os.Getenv("TADO_PASSWORD"), "")
ctx := context.Background()
zones, err := c.GetZones(ctx)
if err != nil {
panic(err)
}
for _, zone := range zones {
info, err := c.GetZoneInfo(ctx, zone.ID)
if err != nil {
panic(err)
}
if info.Overlay.GetMode() == tado.PermanentOverlay {
if err = c.DeleteZoneOverlay(ctx, zone.ID); err != nil {
panic(err)
}
fmt.Printf("removed permanent overlay from zone %s\n", zone.Name)
}
}
}
Output:
func (*APIClient) GetAccount ¶ added in v0.10.0
GetAccount returns the Account information for the account used to log into the Tado API servers.
func (*APIClient) GetActiveHome ¶ added in v0.10.0
GetActiveHome returns the current active Home
func (*APIClient) GetActiveTimeTable ¶ added in v0.10.0
func (c *APIClient) GetActiveTimeTable(ctx context.Context, zoneID int) (timeTable Timetable, err error)
GetActiveTimeTable returns the active Timetable for the provided zone
Example ¶
package main
import (
"context"
"fmt"
"github.com/clambin/tado"
"os"
)
func main() {
c, _ := tado.New(os.Getenv("TADO_USERNAME"), os.Getenv("TADO_PASSWORD"), "")
ctx := context.Background()
zones, err := c.GetZones(ctx)
if err != nil {
panic(err)
}
for _, zone := range zones {
activeTimetable, err := c.GetActiveTimeTable(ctx, zone.ID)
if err != nil {
panic(err)
}
blocks, err := c.GetTimeTableBlocks(ctx, zone.ID, activeTimetable.ID)
if err != nil {
panic(err)
}
for _, block := range blocks {
setting := block.Setting.Power
if setting == "ON" {
setting += fmt.Sprintf(" %.1fºC", block.Setting.Temperature.Celsius)
}
fmt.Printf("%-20s: %-20s: %s-%3s %s\n", zone.Name, block.DayType, block.Start, block.End, setting)
}
}
}
Output:
func (*APIClient) GetAirComfort ¶ added in v0.10.0
func (c *APIClient) GetAirComfort(ctx context.Context) (airComfort AirComfort, err error)
GetAirComfort returns the AirComfort for the active Home
Example ¶
package main
import (
"context"
"fmt"
"github.com/clambin/tado"
)
func main() {
c, _ := tado.New("me@example.com", "password", "")
ctx := context.Background()
zones, err := c.GetZones(ctx)
if err != nil {
panic(err)
}
info, err := c.GetAirComfort(ctx)
if err != nil {
panic(err)
}
fmt.Printf("overall freshness: %s\n", info.Freshness)
for _, room := range info.Comfort {
if zone, ok := zones.GetZone(room.RoomID); ok {
fmt.Printf("%s: %s / %s\n", zone.Name, room.TemperatureLevel, room.HumidityLevel)
} else {
fmt.Printf("unknown room: %d\n", room.RoomID)
}
}
}
Output:
func (*APIClient) GetConsumption ¶ added in v0.10.0
func (c *APIClient) GetConsumption(ctx context.Context, country string, start, end time.Time) (consumption Consumption, err error)
GetConsumption returns Consumption report for the specified period. This includes both the total consumption, as well as the consumption per day of the period
TODO:
- not clear what values are supported for country, or how the server uses it
- /consumption also supports "ngsw-bypass" (true/false) parameter, but unclear what it does
func (*APIClient) GetDefaultOverlay ¶ added in v0.11.0
GetDefaultOverlay returns the default overlay for the specified zone, which defines what happens when a user sets a manual temperature setting ("overlay") on the TRV.
func (*APIClient) GetEnergySavings ¶ added in v0.10.0
func (c *APIClient) GetEnergySavings(ctx context.Context) (reports []EnergySavingsReport, err error)
GetEnergySavings returns all available energy savings reports
Example ¶
package main
import (
"context"
"fmt"
"github.com/clambin/tado"
)
func main() {
c, _ := tado.New("me@example.com", "password", "")
ctx := context.Background()
info, err := c.GetEnergySavings(ctx)
if err != nil {
panic(err)
}
for _, report := range info {
fmt.Printf("%s - %s: %.1f%%\n",
report.CoveredInterval.Start,
report.CoveredInterval.End,
report.TotalSavings.Value,
)
}
}
Output:
func (*APIClient) GetHeatingCircuits ¶ added in v0.10.0
func (c *APIClient) GetHeatingCircuits(ctx context.Context) (output []HeatingCircuit, err error)
GetHeatingCircuits returns all registered heating circuits
func (*APIClient) GetHomeInfo ¶ added in v0.10.0
GetHomeInfo returns detailed information about the active Home
func (*APIClient) GetHomeState ¶ added in v0.11.0
GetHomeState returns the home state (HOME/AWAY)
func (*APIClient) GetHomes ¶ added in v0.10.0
GetHomes returns all homes registered under the account used to log into the Tado API servers.
func (*APIClient) GetMobileDevices ¶
func (c *APIClient) GetMobileDevices(ctx context.Context) (tadoMobileDevices []MobileDevice, err error)
GetMobileDevices retrieves the status of all registered mobile devices.
func (*APIClient) GetRunningTimes ¶ added in v0.10.0
func (c *APIClient) GetRunningTimes(ctx context.Context, from, to time.Time) (runningTimes []RunningTime, err error)
GetRunningTimes returns the amount of time heating was on per day and per zone. from is mandatory. to is optional.
func (*APIClient) GetTimeTableBlocks ¶ added in v0.10.0
func (c *APIClient) GetTimeTableBlocks(ctx context.Context, zoneID int, timetableID TimetableID) (blocks []Block, err error)
GetTimeTableBlocks returns all Block entries for a zone and timetable
func (*APIClient) GetTimeTableBlocksForDayType ¶ added in v0.10.0
func (c *APIClient) GetTimeTableBlocksForDayType(ctx context.Context, zoneID int, timetableID TimetableID, dayType DayType) (blocks []Block, err error)
GetTimeTableBlocksForDayType returns all Block entries for a zone, timetable and day type.
func (*APIClient) GetTimeTables ¶ added in v0.10.0
func (c *APIClient) GetTimeTables(ctx context.Context, zoneID int) (timeTables []Timetable, err error)
GetTimeTables returns the possible Timetable options for the provided zone
func (*APIClient) GetUsers ¶ added in v0.10.0
GetUsers returns all users registered for the Tado account
Example ¶
package main
import (
"context"
"fmt"
"github.com/clambin/tado"
"os"
)
func main() {
c, _ := tado.New(os.Getenv("TADO_USERNAME"), os.Getenv("TADO_PASSWORD"), "")
ctx := context.Background()
users, err := c.GetUsers(ctx)
if err != nil {
panic(err)
}
for _, user := range users {
var home tado.MobileDeviceLocationState
for _, device := range user.MobileDevices {
home = device.IsHome()
if home == tado.DeviceHome {
break
}
}
var status string
switch home {
case tado.DeviceHome:
status = "(home)"
case tado.DeviceAway:
status = "(away)"
case tado.DeviceUnknown:
}
fmt.Printf("%s (%s) %s\n", user.Name, user.Username, status)
}
}
Output:
func (*APIClient) GetWeatherInfo ¶
func (c *APIClient) GetWeatherInfo(ctx context.Context) (weatherInfo WeatherInfo, err error)
GetWeatherInfo retrieves current weather information for the user's Home
Example ¶
package main
import (
"context"
"fmt"
"github.com/clambin/tado"
"os"
)
func main() {
c, _ := tado.New(os.Getenv("TADO_USERNAME"), os.Getenv("TADO_PASSWORD"), "")
ctx := context.Background()
info, err := c.GetWeatherInfo(ctx)
if err != nil {
panic(err)
}
fmt.Printf("weather: %s\n", info.WeatherState.Value)
fmt.Printf("temperature: %.1fºC\n", info.OutsideTemperature.Celsius)
fmt.Printf("solar intensity: %.1f%%\n", info.SolarIntensity.Percentage)
}
Output:
func (*APIClient) GetZoneAutoConfiguration ¶ added in v0.10.0
func (c *APIClient) GetZoneAutoConfiguration(ctx context.Context, zoneID int) (configuration ZoneAwayConfiguration, err error)
GetZoneAutoConfiguration returns the ZoneAwayConfiguration for the specified zone
func (*APIClient) GetZoneCapabilities ¶ added in v0.10.0
func (c *APIClient) GetZoneCapabilities(ctx context.Context, zoneID int) (tadoZoneCapabilities ZoneCapabilities, err error)
GetZoneCapabilities gets the capabilities for the specified zone
func (*APIClient) GetZoneDayReport ¶ added in v0.11.0
func (c *APIClient) GetZoneDayReport(ctx context.Context, zoneID int, date time.Time) (report DayReport, err error)
GetZoneDayReport returns the DayReport for the specified zone on the specified day
func (*APIClient) GetZoneEarlyStart ¶ added in v0.10.0
GetZoneEarlyStart checks if "early start" is enabled for the specified zone
func (*APIClient) GetZoneInfo ¶
GetZoneInfo gets the info for the specified ZoneID
Example ¶
package main
import (
"context"
"fmt"
"github.com/clambin/tado"
)
func main() {
c, _ := tado.New("me@example.com", "password", "")
ctx := context.Background()
zones, err := c.GetZones(ctx)
if err != nil {
panic(err)
}
for _, zone := range zones {
info, err := c.GetZoneInfo(ctx, zone.ID)
if err != nil {
panic(err)
}
fmt.Printf("%s: %s\n", zone.Name, info.Overlay.GetMode())
}
}
Output:
func (*APIClient) GetZoneMeasuringDevice ¶ added in v0.11.0
func (c *APIClient) GetZoneMeasuringDevice(ctx context.Context, zoneID int) (measuringDevice ZoneMeasuringDevice, err error)
GetZoneMeasuringDevice returns information on the measuring device at the specified zone
func (*APIClient) GetZones ¶
GetZones retrieves the different Zones configured for the user's Home ID
Example ¶
package main
import (
"context"
"fmt"
"github.com/clambin/tado"
"os"
)
func main() {
c, _ := tado.New(os.Getenv("TADO_USERNAME"), os.Getenv("TADO_PASSWORD"), "")
ctx := context.Background()
zones, err := c.GetZones(ctx)
if err != nil {
panic(err)
}
for _, zone := range zones {
info, err := c.GetZoneInfo(ctx, zone.ID)
if err != nil {
panic(err)
}
heating := info.Setting.Power
if heating == "ON" {
heating = fmt.Sprintf("%.1f%%, target temperature: %.1fºC",
info.ActivityDataPoints.HeatingPower.Percentage,
info.Setting.Temperature.Celsius,
)
}
fmt.Printf("%s: temperature: %.1fºC, humidity: %.1f%%, heating: %s\n",
zone.Name,
info.SensorDataPoints.InsideTemperature.Celsius,
info.SensorDataPoints.Humidity.Percentage,
heating,
)
}
}
Output:
func (*APIClient) SetActiveHome ¶ added in v0.10.0
SetActiveHome sets the active home for all subsequent API calls. By default, the first registered home is used.
func (*APIClient) SetActiveHomeByName ¶ added in v0.11.0
SetActiveHomeByName sets the active home for all subsequent API calls. By default, the first registered home is used.
func (*APIClient) SetActiveTimeTable ¶ added in v0.10.0
SetActiveTimeTable sets the active Timetable for the provided zone
func (*APIClient) SetDefaultOverlay ¶ added in v0.11.0
SetDefaultOverlay sets the DefaultOverlay for the specified zone, which defines what happens when a user sets a manual temperature setting ("overlay") on the TRV.
func (*APIClient) SetHomeState ¶ added in v0.11.0
SetHomeState sets the home state (HOME/AWAY)
func (*APIClient) SetTimeTableBlocksForDayType ¶ added in v0.10.0
func (c *APIClient) SetTimeTableBlocksForDayType(ctx context.Context, zoneID int, timetableID TimetableID, dayType DayType, blocks []Block) error
SetTimeTableBlocksForDayType sets the Block entries for a zone, timetable and day type.
The DayType must be valid for the type of timetable that it will be added to. See DayType for details.
Example ¶
package main
import (
"context"
"github.com/clambin/tado"
)
func main() {
c, _ := tado.New("me@example.com", "password", "")
ctx := context.Background()
blocks, err := c.GetTimeTableBlocksForDayType(ctx, 1, tado.OneDay, "MONDAY_TO_SUNDAY")
if err != nil {
panic(err)
}
for _, block := range blocks {
if block.Setting.Temperature.Celsius > 5 {
block.Setting.Temperature.Celsius = 21
}
}
err = c.SetTimeTableBlocksForDayType(ctx, 1, tado.OneDay, "MONDAY_TO_SUNDAY", blocks)
if err != nil {
panic(err)
}
}
Output:
func (*APIClient) SetZoneAwayAutoAdjust ¶ added in v0.11.0
func (c *APIClient) SetZoneAwayAutoAdjust(ctx context.Context, zoneID int, comfortLevel ComfortLevel) error
SetZoneAwayAutoAdjust configures the zone to autoAdjust mode when the home is in "away" mode. ComfortLevel determines when to start heating the zone again.
func (*APIClient) SetZoneAwayManual ¶ added in v0.11.0
SetZoneAwayManual configures the zone to be heated to the specified temperature when the home is in "away" mode. If the specified temperature is 5ºC or less, it will not be heated.
func (*APIClient) SetZoneEarlyStart ¶ added in v0.10.0
SetZoneEarlyStart enabled or disables earlyStart for the specified zone
func (*APIClient) SetZoneOverlay ¶
func (c *APIClient) SetZoneOverlay(ctx context.Context, zoneID int, temperature float64) (err error)
SetZoneOverlay sets an overlay (manual temperature setting) for the specified ZoneID
func (*APIClient) SetZoneTemporaryOverlay ¶ added in v0.10.0
func (c *APIClient) SetZoneTemporaryOverlay(ctx context.Context, zoneID int, temperature float64, duration time.Duration) (err error)
SetZoneTemporaryOverlay sets a temporary overlay (manual temperature setting) for the specified ZoneID for the specified amount of time. If duration is zero, it is equivalent to calling SetZoneOverlay().
type APIError ¶ added in v0.11.1
type APIError struct {
Errors []errorEntry `json:"errors"`
}
APIError contains errors received from the Tado servers when calling an API
type Account ¶ added in v0.10.0
type Account struct {
Name string `json:"name"`
Email string `json:"email"`
Username string `json:"username"`
ID string `json:"id"`
Homes Homes `json:"homes"`
Locale string `json:"locale"`
MobileDevices []MobileDevice `json:"mobileDevices"`
}
Account contains details of the account used to log into the Tado API servers. Other than user id information, it contains all homes and all mobile devices registered under the account.
type AirComfort ¶ added in v0.10.0
type AirComfort struct {
Freshness struct {
Value string `json:"value"`
LastOpenWindow time.Time `json:"lastOpenWindow"`
} `json:"freshness"`
Comfort []ZoneAirComfort `json:"comfort"`
}
AirComfort contains the air comfort for a home. This contains the overall air freshness for the house, along with details for each zone.
type Block ¶ added in v0.10.0
type Block struct {
DayType DayType `json:"dayType"`
Start string `json:"start"`
End string `json:"end"`
GeolocationOverride bool `json:"geolocationOverride"`
Setting ZonePowerSetting `json:"setting"`
}
A Block is an entry in a Timetable. It specifies the heating settings (as per the Setting attribute) for the zone at the specified DayType and time range (specified by Start and End times).
The DayType must be valid for the type of timetable that it will be added to. See DayType for details.
type ComfortLevel ¶ added in v0.11.0
type ComfortLevel int
ComfortLevel determines how the heating should be switched back on when one or more users return home.
const ( // Eco mode Eco ComfortLevel = 0 // Balance mode Balance ComfortLevel = 50 // Comfort mode Comfort ComfortLevel = 100 )
type Consumption ¶ added in v0.10.0
type Consumption struct {
Currency string `json:"currency"`
Tariff string `json:"tariff"`
TariffInfo struct {
CurrencySign string `json:"currencySign"`
ConsumptionUnit string `json:"consumptionUnit"`
TariffInCents float64 `json:"tariffInCents"`
CustomTariff bool `json:"customTariff"`
} `json:"tariffInfo"`
CustomTariff bool `json:"customTariff"`
ConsumptionInputState string `json:"consumptionInputState"`
Unit string `json:"unit"`
Details ConsumptionDetails `json:"details"`
}
Consumption contains the consumption for the total period, both in terms of how much was consumed and the associated cost
type ConsumptionDetails ¶ added in v0.10.0
type ConsumptionDetails struct {
TotalConsumption float64 `json:"totalConsumption"`
TotalCostInCents float64 `json:"totalCostInCents"`
PerDay []ConsumptionPerDay `json:"perDay"`
}
ConsumptionDetails contains the consumption for the total period, both in terms of how much was consumed and the associated cost
type ConsumptionPerDay ¶ added in v0.10.0
type ConsumptionPerDay struct {
Date string `json:"date"`
Consumption float64 `json:"consumption"`
CostInCents float64 `json:"costInCents"`
}
ConsumptionPerDay contains the consumption for one day, both in terms of how much was consumed and the associated cost
type DayReport ¶ added in v0.11.0
type DayReport struct {
CallForHeat struct {
DataIntervals []struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
Value string `json:"value"`
} `json:"dataIntervals"`
TimeSeriesType string `json:"timeSeriesType"`
ValueType string `json:"valueType"`
} `json:"callForHeat"`
HoursInDay int `json:"hoursInDay"`
Interval struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
} `json:"interval"`
MeasuredData struct {
Humidity struct {
DataPoints []struct {
Timestamp time.Time `json:"timestamp"`
Value float64 `json:"value"`
} `json:"dataPoints"`
Max float64 `json:"max"`
Min float64 `json:"min"`
PercentageUnit string `json:"percentageUnit"`
TimeSeriesType string `json:"timeSeriesType"`
ValueType string `json:"valueType"`
} `json:"humidity"`
InsideTemperature struct {
DataPoints []struct {
Timestamp time.Time `json:"timestamp"`
Value Temperature `json:"value"`
} `json:"dataPoints"`
Max Temperature `json:"max"`
Min Temperature `json:"min"`
TimeSeriesType string `json:"timeSeriesType"`
ValueType string `json:"valueType"`
} `json:"insideTemperature"`
MeasuringDeviceConnected struct {
DataIntervals []struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
Value bool `json:"value"`
} `json:"dataIntervals"`
TimeSeriesType string `json:"timeSeriesType"`
ValueType string `json:"valueType"`
} `json:"measuringDeviceConnected"`
} `json:"measuredData"`
Settings struct {
DataIntervals []struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
Value struct {
Power string `json:"power"`
Temperature Temperature `json:"temperature"`
Type string `json:"type"`
} `json:"value"`
} `json:"dataIntervals"`
TimeSeriesType string `json:"timeSeriesType"`
ValueType string `json:"valueType"`
} `json:"settings"`
Stripes struct {
DataIntervals []struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
Value struct {
Setting struct {
Power string `json:"power"`
Temperature Temperature `json:"temperature"`
Type string `json:"type"`
} `json:"setting"`
StripeType string `json:"stripeType"`
} `json:"value"`
} `json:"dataIntervals"`
TimeSeriesType string `json:"timeSeriesType"`
ValueType string `json:"valueType"`
} `json:"stripes"`
Weather struct {
Condition struct {
DataIntervals []struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
Value struct {
State string `json:"state"`
Temperature Temperature `json:"temperature"`
} `json:"value"`
} `json:"dataIntervals"`
TimeSeriesType string `json:"timeSeriesType"`
ValueType string `json:"valueType"`
} `json:"condition"`
Slots struct {
Slots struct {
Field1 struct {
State string `json:"state"`
Temperature Temperature `json:"temperature"`
} `json:"04:00"`
Field2 struct {
State string `json:"state"`
Temperature Temperature `json:"temperature"`
} `json:"08:00"`
Field3 struct {
State string `json:"state"`
Temperature Temperature `json:"temperature"`
} `json:"12:00"`
Field4 struct {
State string `json:"state"`
Temperature Temperature `json:"temperature"`
} `json:"16:00"`
Field5 struct {
State string `json:"state"`
Temperature Temperature `json:"temperature"`
} `json:"20:00"`
} `json:"slots"`
TimeSeriesType string `json:"timeSeriesType"`
ValueType string `json:"valueType"`
} `json:"slots"`
Sunny struct {
DataIntervals []struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
Value bool `json:"value"`
} `json:"dataIntervals"`
TimeSeriesType string `json:"timeSeriesType"`
ValueType string `json:"valueType"`
} `json:"sunny"`
} `json:"weather"`
ZoneType string `json:"zoneType"`
}
DayReport gives overview of heating, temperature, humidity, etc. for a given zone on a given day
type DayType ¶ added in v0.11.1
type DayType string
DayType is the type of day. Valid DayType values depend on the Timetable that the block will be included in:
- for the OneDay timetable: MONDAY_TO_SUNDAY
- for the ThreeDay timetable: MONDAY_TO_FRIDAY, SATURDAY, SUNDAY
- for the SevenDay timetable: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
type DefaultOverlay ¶ added in v0.11.0
type DefaultOverlay struct {
TerminationCondition struct {
Type string `json:"type"`
DurationInSeconds int `json:"durationInSeconds"`
} `json:"terminationCondition"`
}
DefaultOverlay defines what happens when a user sets a manual temperature setting ("overlay") on the TRV. Type can be "MANUAL", "TADO_MODE" or "TIMER". For "TIMER", the DurationInSeconds must be set.
type Device ¶
type Device struct {
DeviceType string `json:"deviceType"`
SerialNo string `json:"serialNo"`
ShortSerialNo string `json:"shortSerialNo"`
CurrentFwVersion string `json:"currentFwVersion"`
ConnectionState State `json:"connectionState"`
Characteristics struct {
Capabilities []string `json:"capabilities"`
} `json:"characteristics"`
InPairingMode bool `json:"inPairingMode,omitempty"`
BatteryState string `json:"batteryState"`
Duties []string `json:"duties"`
MountingState Value `json:"mountingState,omitempty"`
MountingStateWithError string `json:"mountingStateWithError,omitempty"`
ChildLockEnabled bool `json:"childLockEnabled,omitempty"`
}
Device contains attributes of a Tado device
type EnergySavingsReport ¶ added in v0.10.0
type EnergySavingsReport struct {
CoveredInterval struct {
Start time.Time `json:"start"`
End time.Time `json:"end"`
} `json:"coveredInterval"`
WithAutoAssist struct {
DetectedAwayDuration IntValue `json:"detectedAwayDuration"`
OpenWindowDetectionTimes int `json:"openWindowDetectionTimes"`
} `json:"withAutoAssist"`
SunshineDuration IntValue `json:"sunshineDuration"`
TotalSavingsInThermostaticMode IntValue `json:"totalSavingsInThermostaticMode"`
ManualControlSaving FloatValue `json:"manualControlSaving"`
TotalSavings FloatValue `json:"totalSavings"`
SetbackScheduleDurationPerDay FloatValue `json:"setbackScheduleDurationPerDay"`
AwayDuration IntValue `json:"awayDuration"`
YearMonth string `json:"yearMonth"`
OpenWindowDetectionTimes int `json:"openWindowDetectionTimes"`
CommunityNews *struct {
Type string `json:"type,omitempty"`
HumidityLevelDurations struct {
TooLow FloatValue `json:"tooLow"`
Optimum FloatValue `json:"optimum"`
TooHigh FloatValue `json:"tooHigh"`
} `json:"humidityLevelDurations,omitempty"`
OpenWindowComparison struct {
UserDifference int `json:"userDifference"`
AreaAverage int `json:"areaAverage"`
} `json:"openWindowComparison,omitempty"`
States []struct {
Name string `json:"name"`
Value float64 `json:"value"`
Unit string `json:"unit"`
} `json:"states,omitempty"`
AverageTotalSavings FloatValue `json:"averageTotalSavings,omitempty"`
HomeCountry string `json:"homeCountry,omitempty"`
AverageNightTemperature struct {
IndoorInCelsius float64 `json:"indoorInCelsius"`
OutdoorInCelsius float64 `json:"outdoorInCelsius"`
} `json:"averageNightTemperature,omitempty"`
Value string `json:"value,omitempty"`
AreaAverageTemperatureInCelsius float64 `json:"areaAverageTemperatureInCelsius,omitempty"`
HomeAverageTemperatureInCelsius float64 `json:"homeAverageTemperatureInCelsius,omitempty"`
TurnOnDateForMajorityOfTadoUsers string `json:"turnOnDateForMajorityOfTadoUsers,omitempty"`
TurnOnDateForMajorityOfUsersInLocalRegion string `json:"turnOnDateForMajorityOfUsersInLocalRegion,omitempty"`
} `json:"communityNews"`
Home int `json:"home"`
HasAutoAssist bool `json:"hasAutoAssist"`
ShowSavingsInThermostaticMode bool `json:"showSavingsInThermostaticMode"`
HideSunshineDuration bool `json:"hideSunshineDuration"`
TotalSavingsInThermostaticModeAvailable bool `json:"totalSavingsInThermostaticModeAvailable"`
TotalSavingsAvailable bool `json:"totalSavingsAvailable"`
HideOpenWindowDetection bool `json:"hideOpenWindowDetection"`
}
EnergySavingsReport is the savings report for the specified CoveredInterval
type FloatValue ¶ added in v0.10.0
FloatValue contains a float value
type HeatingCircuit ¶ added in v0.10.0
type HeatingCircuit struct {
DriverSerialNo string `json:"driverSerialNo"`
DriverShortSerialNo string `json:"driverShortSerialNo"`
Number int `json:"number"`
}
HeatingCircuit contains details on a Tado heating circuit
type HomeInfo ¶ added in v0.10.0
type HomeInfo struct {
Address struct {
AddressLine1 string `json:"addressLine1"`
AddressLine2 interface{} `json:"addressLine2"`
ZipCode string `json:"zipCode"`
City string `json:"city"`
State interface{} `json:"state"`
Country string `json:"country"`
} `json:"address"`
ContactDetails struct {
Name string `json:"name"`
Email string `json:"email"`
Phone string `json:"phone"`
} `json:"contactDetails"`
Name string `json:"name"`
DateTimeZone string `json:"dateTimeZone"`
TemperatureUnit string `json:"temperatureUnit"`
Partner interface{} `json:"partner"`
Geolocation struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
} `json:"geolocation"`
ID int `json:"id"`
InstallationCompleted bool `json:"installationCompleted"`
SimpleSmartScheduleEnabled bool `json:"simpleSmartScheduleEnabled"`
}
HomeInfo contains detailed information about a registered Home
type HomeState ¶ added in v0.11.0
type HomeState struct {
Presence string `json:"presence"`
PresenceLocked bool `json:"presenceLocked"`
}
HomeState contains the home state (HOME/AWAY)
type Homes ¶ added in v0.11.0
type Homes []Home
type MobileDevice ¶
type MobileDevice struct {
ID int `json:"id"`
Name string `json:"name"`
Settings MobileDeviceSettings `json:"settings"`
DeviceMetadata struct {
Platform string `json:"platform"`
OsVersion string `json:"osVersion"`
Model string `json:"model"`
Locale string `json:"locale"`
} `json:"deviceMetadata"`
Location MobileDeviceLocation `json:"location"`
}
MobileDevice contains the response to /api/v2/homes/<HomeID>/mobileDevices
func (*MobileDevice) IsHome ¶ added in v0.2.90
func (mobileDevice *MobileDevice) IsHome() (state MobileDeviceLocationState)
IsHome returns the location of the MobileDevice
type MobileDeviceLocation ¶
type MobileDeviceLocation struct {
Stale bool `json:"stale"`
AtHome bool `json:"atHome"`
BearingFromHome struct {
Degrees float64 `json:"degrees"`
Radians float64 `json:"radians"`
} `json:"bearingFromHome"`
RelativeDistanceFromHomeFence float64 `json:"relativeDistanceFromHomeFence"`
}
MobileDeviceLocation is a sub-structure of MobileDevice
type MobileDeviceLocationState ¶ added in v0.2.90
type MobileDeviceLocationState int
MobileDeviceLocationState is the state of the user's device (mobile phone), i.e. home or away
const ( // DeviceUnknown means the device state is not known. Typically this means the device isn't enabled for geotracking. DeviceUnknown MobileDeviceLocationState = iota // DeviceHome means the user's device is home DeviceHome // DeviceAway means the user's device is not home DeviceAway )
type MobileDeviceSettings ¶
type MobileDeviceSettings struct {
GeoTrackingEnabled bool `json:"geoTrackingEnabled"`
SpecialOffersEnabled bool `json:"specialOffersEnabled"`
OnDemandLogRetrievalEnabled bool `json:"onDemandLogRetrievalEnabled"`
PushNotifications struct {
LowBatteryReminder bool `json:"lowBatteryReminder"`
AwayModeReminder bool `json:"awayModeReminder"`
HomeModeReminder bool `json:"homeModeReminder"`
OpenWindowReminder bool `json:"openWindowReminder"`
EnergySavingsReportReminder bool `json:"energySavingsReportReminder"`
IncidentDetection bool `json:"incidentDetection"`
EnergyIqReminder bool `json:"energyIqReminder"`
} `json:"pushNotifications"`
}
MobileDeviceSettings is a sub-structure of MobileDevice
type OverlayTerminationMode ¶ added in v0.11.0
type OverlayTerminationMode int
const ( UnknownOverlay OverlayTerminationMode = iota NoOverlay PermanentOverlay TimerOverlay NextBlockOverlay )
func (OverlayTerminationMode) String ¶ added in v0.11.1
func (m OverlayTerminationMode) String() string
String returns a string representation of an OverlayTerminationMode
type Percentage ¶
type Percentage struct {
Percentage float64 `json:"percentage"`
}
Percentage contains a percentage (0-100%)
type RunningTime ¶ added in v0.10.0
type RunningTime struct {
RunningTimeInSeconds int `json:"runningTimeInSeconds"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
Zones []struct {
ID int `json:"id"`
RunningTimeInSeconds int `json:"runningTimeInSeconds"`
} `json:"zones"`
}
RunningTime reports the amount of time heating was on between StartTime and RunningTime, both for the home and for each individual zone.
type Temperature ¶
type Temperature struct {
Celsius float64 `json:"celsius"`
}
Temperature contains a temperature in degrees Celsius
func (Temperature) MarshalJSON ¶ added in v0.10.0
func (t Temperature) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler. This is needed to support SetTimeTableBlocksForDayType, since the server expects "null" when the temperature has not been set: {"celsius": 0} throws an error.
type Timetable ¶ added in v0.10.0
type Timetable struct {
ID TimetableID `json:"id"`
Type string `json:"type"`
}
Timetable is the type of heating schedule for a Zone. Tado supports three schedule Types:
- ONE_DAY: same schedule for each day of the week
- THREE_DAY: one schedule for weekdays, one for Saturday and one for Sunday
- SEVEN_DAY: each day of the week has a dedicated schedule
type TimetableID ¶ added in v0.10.0
type TimetableID int
TimetableID is the ID of the type of timetable
const ( // OneDay timetables have one setting for all days of the week OneDay TimetableID = 0 // ThreeDay timetables have one setting for working days, one for Saturday and one for Sunday ThreeDay TimetableID = 1 // SevenDay timetables have individual settings for each day of the week SevenDay TimetableID = 2 )
type UnprocessableEntryError ¶ added in v0.11.0
type UnprocessableEntryError struct {
// contains filtered or unexported fields
}
UnprocessableEntryError indicates an API call returned http.StatusUnprocessableEntity, meaning the Tado servers could not parse the request
func (*UnprocessableEntryError) Error ¶ added in v0.11.0
func (e *UnprocessableEntryError) Error() string
Error implements the Error interface. It returns a string representation of the error.
func (*UnprocessableEntryError) Is ¶ added in v0.11.0
func (e *UnprocessableEntryError) Is(e2 error) bool
Is returns true if e2 is an UnprocessableEntryError
func (*UnprocessableEntryError) Unwrap ¶ added in v0.11.0
func (e *UnprocessableEntryError) Unwrap() error
Unwrap returns the wrapped APIError
type User ¶ added in v0.10.0
type User struct {
Name string `json:"name"`
Email string `json:"email"`
Username string `json:"username"`
Homes []Home `json:"homes"`
Locale string `json:"locale"`
MobileDevices []MobileDevice `json:"mobileDevices"`
}
User is a registered user for the Tado account, along with their registered mobile device
type Value ¶
type Value struct {
Value string `json:"value"`
}
Value contains a string value TODO: does this have a type as well?
type WeatherInfo ¶
type WeatherInfo struct {
OutsideTemperature Temperature `json:"outsideTemperature"`
SolarIntensity Percentage `json:"solarIntensity"`
WeatherState Value `json:"weatherState"`
}
WeatherInfo contains the response to /api/v2/homes/<HomeID>/weather
This structure provides the following key information:
OutsideTemperature.Celsius: outside temperate, in degrees Celsius SolarIntensity.Percentage: solar intensity (0-100%) WeatherState.Value: string describing current weather (list TBD)
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 []Device `json:"devices"`
ReportAvailable bool `json:"reportAvailable"`
ShowScheduleSetup bool `json:"showScheduleSetup"`
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 the configuration of a given zone
type ZoneAirComfort ¶ added in v0.10.0
type ZoneAirComfort struct {
RoomID int `json:"roomId"`
TemperatureLevel string `json:"temperatureLevel"`
HumidityLevel string `json:"humidityLevel"`
Coordinate struct {
Radial float64 `json:"radial"`
Angular int `json:"angular"`
} `json:"coordinate"`
}
ZoneAirComfort contains the air comfort for one zone in the home
type ZoneAwayConfiguration ¶ added in v0.10.0
type ZoneAwayConfiguration struct {
Type string `json:"type"`
AutoAdjust bool `json:"autoAdjust"`
ComfortLevel ComfortLevel `json:"comfortLevel"`
Setting ZonePowerSetting `json:"setting"`
}
ZoneAwayConfiguration determines how a Zone will be heated when all users are away and the home is in "away" mode. If AdjustType is true, the zone's heating will be switched off. When the heating is switched back on is determined by ComfortLevel (Eco, Balance, Comfort). If AdjustType is false, the zone will be heated as per the Settings field.
E.g. using the following ZoneAwayConfigutation will heat the room at 16ºC:
{
"type": "HEATING",
"autoAdjust": false,
"setting": {
"type": "HEATING",
"power": "ON",
"temperature": {
"celsius": 16,
}
}
}
type ZoneCapabilities ¶ added in v0.10.0
type ZoneCapabilities struct {
Temperatures struct {
Celsius struct {
Max int `json:"max"`
Min int `json:"min"`
Step float64 `json:"step"`
} `json:"celsius"`
Fahrenheit struct {
Max int `json:"max"`
Min int `json:"min"`
Step float64 `json:"step"`
} `json:"fahrenheit"`
} `json:"temperatures"`
Type string `json:"type"`
}
ZoneCapabilities returns the "capabilities" of a Tado zone
type ZoneInfo ¶
type ZoneInfo struct {
TadoMode string `json:"tadoMode"`
GeolocationOverride bool `json:"geolocationOverride"`
// TODO
GeolocationOverrideDisableTime interface{} `json:"geolocationOverrideDisableTime"`
// TODO
Preparation interface{} `json:"preparation"`
Setting ZonePowerSetting `json:"setting"`
OverlayType string `json:"overlayType"`
Overlay ZoneInfoOverlay `json:"overlay,omitempty"`
OpenWindow ZoneInfoOpenWindow `json:"openwindow,omitempty"`
NextScheduleChange struct {
Start time.Time `json:"start"`
Setting struct {
Type string `json:"type"`
Power string `json:"power"`
Temperature Temperature `json:"temperature"`
} `json:"setting"`
} `json:"nextScheduleChange"`
NextTimeBlock struct {
Start time.Time `json:"start"`
} `json:"nextTimeBlock"`
Link struct {
State string `json:"state"`
} `json:"link"`
ActivityDataPoints ZoneInfoActivityDataPoints `json:"activityDataPoints"`
SensorDataPoints ZoneInfoSensorDataPoints `json:"sensorDataPoints"`
}
ZoneInfo contains the response to /api/v2/homes/<HomeID>/zones/<zoneID>/state
type ZoneInfoActivityDataPoints ¶
type ZoneInfoActivityDataPoints struct {
HeatingPower Percentage `json:"heatingPower"`
}
ZoneInfoActivityDataPoints contains the zone's heating info
type ZoneInfoOpenWindow ¶
type ZoneInfoOpenWindow struct {
DetectedTime time.Time `json:"detectedTime"`
DurationInSeconds int `json:"durationInSeconds"`
Expiry time.Time `json:"expiry"`
RemainingTimeInSeconds int `json:"remainingTimeInSeconds"`
}
ZoneInfoOpenWindow contains info on an open window. Only set if a window is open
type ZoneInfoOverlay ¶
type ZoneInfoOverlay struct {
Type string `json:"type"`
Setting ZonePowerSetting `json:"setting"`
Termination ZoneInfoOverlayTermination `json:"termination"`
}
ZoneInfoOverlay contains the zone's manual settings.
Tado supports three types of overlays: permanent ones (no expiry), timer-based ones (with a fixed time) and overlays that expire at the next block change on the timeTable. Use GetMode() to help determine the type of overlay.
func (ZoneInfoOverlay) GetMode ¶ added in v0.11.0
func (z ZoneInfoOverlay) GetMode() OverlayTerminationMode
GetMode determines the type of overlay, i.e. permanent, timer-based or expiring at the next block change.
type ZoneInfoOverlayTermination ¶
type ZoneInfoOverlayTermination 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"`
}
ZoneInfoOverlayTermination contains the termination parameters for the zone's overlay. Timers will only be populated for non-permanent modes.
type ZoneInfoSensorDataPoints ¶
type ZoneInfoSensorDataPoints struct {
InsideTemperature Temperature `json:"insideTemperature"`
Humidity Percentage `json:"humidity"`
}
ZoneInfoSensorDataPoints contains the zone's current temperature & humidity
type ZoneMeasuringDevice ¶ added in v0.11.0
type ZoneMeasuringDevice struct {
BatteryState string `json:"batteryState"`
Characteristics struct {
Capabilities []string `json:"capabilities"`
} `json:"characteristics"`
ConnectionState State
CurrentFwVersion string `json:"currentFwVersion"`
DeviceType string `json:"deviceType"`
SerialNo string `json:"serialNo"`
ShortSerialNo string `json:"shortSerialNo"`
}
ZoneMeasuringDevice contains configuration parameters of a measuring device at a given zone
type ZonePowerSetting ¶ added in v0.10.0
type ZonePowerSetting struct {
Type string `json:"type"`
Power string `json:"power"`
Temperature Temperature `json:"temperature"`
}
ZonePowerSetting contains the zone's overlay settings