sdmapi

package
v0.0.3-0...-16756a2 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	// contains filtered or unexported methods
}

func NewFanCommand

func NewFanCommand(timerEnabled bool, duration time.Duration) Command

func NewThermostatEcoCommand

func NewThermostatEcoCommand(enabled bool) Command

func NewThermostatModeCommand

func NewThermostatModeCommand(mode thermostatMode) Command

func NewThermostatTemperatureSetpointCoolCommand

func NewThermostatTemperatureSetpointCoolCommand(temp float32) Command

func NewThermostatTemperatureSetpointHeatCommand

func NewThermostatTemperatureSetpointHeatCommand(temp float32) Command

func NewThermostatTemperatureSetpointRangeCommand

func NewThermostatTemperatureSetpointRangeCommand(heatTemp, coolTemp float32) Command

func StCommandToSdmCommands

func StCommandToSdmCommands(stCommand *models.Command) ([]Command, error)

type Device

type Device struct {
	ID         string
	DeviceType string
	Traits     Traits
}

type DeviceConnectivityTraits

type DeviceConnectivityTraits struct {
	Online bool
}

func (DeviceConnectivityTraits) ToSmartthingsState

func (t DeviceConnectivityTraits) ToSmartthingsState(traits Traits) []*models.DeviceStateStatesItems0

type DeviceFanTraits

type DeviceFanTraits struct {
	TimerModeEnabled bool
	TimerTimeout     time.Time
}

func (DeviceFanTraits) ToSmartthingsState

func (t DeviceFanTraits) ToSmartthingsState(traits Traits) []*models.DeviceStateStatesItems0

type DeviceHumidityTraits

type DeviceHumidityTraits struct {
	AmbientHumidityPercent float32 `json:"ambientHumidityPercent"`
}

func (DeviceHumidityTraits) ToSmartthingsState

func (t DeviceHumidityTraits) ToSmartthingsState(traits Traits) []*models.DeviceStateStatesItems0

func (*DeviceHumidityTraits) Unmarshal

func (t *DeviceHumidityTraits) Unmarshal() interface{}

type DeviceInfoTraits

type DeviceInfoTraits struct {
	CustomName string `json:"customName"`
}

func (*DeviceInfoTraits) Unmarshal

func (t *DeviceInfoTraits) Unmarshal() interface{}

type DeviceSettingsTraits

type DeviceSettingsTraits struct {
	TemperatureScale TemperatureScale
}

type DeviceTemperatureTraits

type DeviceTemperatureTraits struct {
	AmbientTemperatureCelsius float32 `json:"ambientTemperatureCelsius"`
}

func (DeviceTemperatureTraits) ToSmartthingsState

func (t DeviceTemperatureTraits) ToSmartthingsState(traits Traits) []*models.DeviceStateStatesItems0

func (*DeviceTemperatureTraits) Unmarshal

func (t *DeviceTemperatureTraits) Unmarshal() interface{}

type DeviceThermostatEco

type DeviceThermostatEco struct {
	Enabled     bool
	HeatCelsius float32 `json:"heatCelsius"`
	CoolCelsius float32 `json:"coolCelsius"`
}

type DeviceThermostatHvac

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

func (DeviceThermostatHvac) ToSmartthingsState

func (t DeviceThermostatHvac) ToSmartthingsState(traits Traits) []*models.DeviceStateStatesItems0

type DeviceThermostatMode

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

func (DeviceThermostatMode) ToSmartthingsState

func (t DeviceThermostatMode) ToSmartthingsState(traits Traits) []*models.DeviceStateStatesItems0

type DeviceThermostatTemperatureSetpoint

type DeviceThermostatTemperatureSetpoint struct {
	HeatCelsius float32 `json:"heatCelsius"`
	CoolCelsius float32 `json:"coolCelsius"`
}

func (DeviceThermostatTemperatureSetpoint) ToSmartthingsState

func (*DeviceThermostatTemperatureSetpoint) Unmarshal

func (t *DeviceThermostatTemperatureSetpoint) Unmarshal() interface{}

type Live

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

func NewLiveClient

func NewLiveClient(sdmProjectID string) *Live

func (*Live) Devices

func (c *Live) Devices() ([]Device, error)

func (*Live) GetDevice

func (c *Live) GetDevice(deviceID string) (*Device, error)

func (*Live) MakeContext

func (c *Live) MakeContext() (context.Context, context.CancelFunc)

func (*Live) Rooms

func (c *Live) Rooms(structureID string) ([]Room, error)

func (*Live) SendCommand

func (c *Live) SendCommand(deviceID string, command Command) error

func (*Live) Structures

func (c *Live) Structures() ([]Structure, error)

func (*Live) WithAccessToken

func (c *Live) WithAccessToken(token string) SmartDeviceManagement

func (*Live) WithTimeout

func (c *Live) WithTimeout(d time.Duration) SmartDeviceManagement

type Room

type Room struct {
	ID         string
	CustomName string
	Traits     Traits
}

type RoomInfoTraits

type RoomInfoTraits struct {
	CustomName string `json:"customName"`
}

func (*RoomInfoTraits) Unmarshal

func (t *RoomInfoTraits) Unmarshal() interface{}

type SmartDeviceManagement

type SmartDeviceManagement interface {
	WithAccessToken(token string) SmartDeviceManagement
	WithTimeout(d time.Duration) SmartDeviceManagement
	Structures() ([]Structure, error)
	Rooms(structureID string) ([]Room, error)
	Devices() ([]Device, error)
	GetDevice(deviceID string) (*Device, error)
	SendCommand(deviceID string, command Command) error
}

type StCapability

type StCapability interface {
	ToSmartthingsState(traits Traits) []*models.DeviceStateStatesItems0
}

Convert data to a set of SmartThings device states ToSmartThingsState() may use data from other traits to compose the device state

type Structure

type Structure struct {
	ID         string
	CustomName string
	Traits     Traits
}

type StructuresInfoTraits

type StructuresInfoTraits struct {
	CustomName string `json:"customName"`
}

func (*StructuresInfoTraits) Unmarshal

func (t *StructuresInfoTraits) Unmarshal() interface{}

type TemperatureScale

type TemperatureScale int
const (
	TemperatureScaleCelsius TemperatureScale = iota
	TemperatureScaleFarenheit
)

type Traits

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

A set of traits for a device

func NewTraits

func NewTraits() Traits

func (*Traits) Parse

func (t *Traits) Parse(data []byte) error

Parse a set of traits from JSON into the trait set

func (*Traits) Trait

func (t *Traits) Trait(id traitID) interface{}

Return the trait data from the trait set given its ID

func (*Traits) TraitIDs

func (t *Traits) TraitIDs() []traitID

Return a list of traid IDs for the trait set

Jump to

Keyboard shortcuts

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