Documentation
¶
Overview ¶
package homewizard implements basic API calls for reading HomeWizard data
Index ¶
- func DiscoverIP() (*net.IP, error)
- type Camera
- type ConfigFile
- type DiscoverResponse
- type Energylink
- type Energymeter
- type GetEnergyMetersInput
- type GetEnergyMetersOutput
- type GetSensorsInput
- type GetSensorsOutput
- type GetSwitchesInput
- type GetSwitchesOutput
- type GetThermometerGraphsDWOutput
- type GetThermometerGraphsInput
- type GetThermometerGraphsMYOutput
- type GetThermometersInput
- type GetThermometersOutput
- type HWInput
- type HWOutput
- type Handshake
- type HandshakeInput
- type HandshakeOutput
- type Heatlink
- type HomeWizard
- func (hw *HomeWizard) Do(in HWInput, out HWOutput) error
- func (hw *HomeWizard) GetEnergyMeters() (*GetEnergyMetersOutput, error)
- func (hw *HomeWizard) GetSensors() (*GetSensorsOutput, error)
- func (hw *HomeWizard) GetSwitches() (*GetSwitchesOutput, error)
- func (hw *HomeWizard) GetThermometerGraph(id int, period TimePeriod) (ThermGraph, error)
- func (hw *HomeWizard) GetThermometers() (*GetThermometersOutput, error)
- func (hw *HomeWizard) OperateSwitch(in *OperateSwitchInput) (*OperateSwitchOutput, error)
- type Hue
- type Kakusensor
- type OperateSwitchInput
- type OperateSwitchOutput
- type Preset
- type Rainmeter
- type ResponseElems
- type RouteInfo
- type Scene
- type Switch
- type SwitchStatus
- type SwitchType
- type Switches
- type ThermGraph
- type ThermGraphMinMax
- type ThermGraphPoint
- type ThermGraphT
- type Thermometer
- type Time
- type TimePeriod
- type Uvmeter
- type Weatherdisplay
- type Windmeter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverIP ¶
Types ¶
type Camera ¶
type Camera struct { ID int `json:"id"` IP string `json:"ip"` Mode int `json:"mode"` Model int `json:"model"` Name string `json:"name"` Password string `json:"password"` Port string `json:"port"` Presets []Preset `json:"presets"` URL struct { Auth string `json:"auth"` Path string `json:"path"` Query string `json:"query"` } `json:"url"` Username string `json:"username"` }
type ConfigFile ¶
func ReadConfig ¶
func ReadConfig(cfgFile string) (*ConfigFile, error)
type DiscoverResponse ¶
type Energylink ¶
type Energylink struct{} //TODO
type Energymeter ¶
type Energymeter struct { Code string `json:"code"` DayTotal float64 `json:"dayTotal"` Favorite string `json:"favorite"` ID int `json:"id"` Key string `json:"key"` LowBattery string `json:"lowBattery"` Name string `json:"name"` Po int `json:"po"` PoMax int `json:"po+"` PoMaxT string `json:"po+t"` PoMin int `json:"po-"` PoMinT string `json:"po-t"` }
type GetEnergyMetersInput ¶
type GetEnergyMetersInput struct{}
func (*GetEnergyMetersInput) Route ¶
func (i *GetEnergyMetersInput) Route() *RouteInfo
type GetEnergyMetersOutput ¶
type GetEnergyMetersOutput struct { ResponseElems Response []Energymeter `json:"response"` }
type GetSensorsInput ¶
type GetSensorsInput struct{}
func (*GetSensorsInput) Route ¶
func (i *GetSensorsInput) Route() *RouteInfo
type GetSensorsOutput ¶
type GetSensorsOutput struct { ResponseElems Response struct { Cameras []Camera `json:"cameras"` Energylinks []Energylink `json:"energylinks"` Energymeters []Energymeter `json:"energymeters"` Heatlinks []Heatlink `json:"heatlinks"` Hues []Hue `json:"hues"` Kakusensors []Kakusensor `json:"kakusensors"` Preset int `json:"preset"` Rainmeters []Rainmeter `json:"rainmeters"` Scenes []Scene `json:"scenes"` Switches []Switch `json:"switches"` Thermometers []Thermometer `json:"thermometers"` Time Time `json:"time"` Uvmeters []Uvmeter `json:"uvmeters"` Weatherdisplays []Weatherdisplay `json:"weatherdisplays"` Windmeters []Windmeter `json:"windmeters"` } `json:"response"` }
type GetSwitchesInput ¶
type GetSwitchesInput struct{}
func (*GetSwitchesInput) Route ¶
func (i *GetSwitchesInput) Route() *RouteInfo
type GetSwitchesOutput ¶
type GetSwitchesOutput struct { ResponseElems Response Switches `json:"response"` }
type GetThermometerGraphsDWOutput ¶
type GetThermometerGraphsDWOutput struct { ResponseElems Response []ThermGraphT `json:"response"` }
For day and week graphs
func (*GetThermometerGraphsDWOutput) Elem ¶
func (x *GetThermometerGraphsDWOutput) Elem(i uint) ThermGraphPoint
func (*GetThermometerGraphsDWOutput) Len ¶
func (x *GetThermometerGraphsDWOutput) Len() uint
type GetThermometerGraphsInput ¶
type GetThermometerGraphsInput struct { Id int Period TimePeriod //day-week-month-year }
func (*GetThermometerGraphsInput) Route ¶
func (i *GetThermometerGraphsInput) Route() *RouteInfo
type GetThermometerGraphsMYOutput ¶
type GetThermometerGraphsMYOutput struct { ResponseElems Response []ThermGraphMinMax `json:"response"` }
For month and year graphs
func (*GetThermometerGraphsMYOutput) Elem ¶
func (x *GetThermometerGraphsMYOutput) Elem(i uint) ThermGraphPoint
func (*GetThermometerGraphsMYOutput) Len ¶
func (x *GetThermometerGraphsMYOutput) Len() uint
type GetThermometersInput ¶
type GetThermometersInput struct{}
func (*GetThermometersInput) Route ¶
func (i *GetThermometersInput) Route() *RouteInfo
type GetThermometersOutput ¶
type GetThermometersOutput struct { ResponseElems Response []Thermometer `json:"response"` }
type HandshakeInput ¶
type HandshakeInput struct{}
func (*HandshakeInput) Route ¶
func (i *HandshakeInput) Route() *RouteInfo
type HandshakeOutput ¶
type HandshakeOutput struct { ResponseElems Response Handshake `json:"response"` }
type HomeWizard ¶
type HomeWizard struct { Name string IP net.IP Password string Verbose bool HTTPClient *http.Client }
HomeWizard is the main struct for calling all methods
func NewHomeWizard ¶
func NewHomeWizard(ip string, password string) *HomeWizard
func NewHomeWizardFromConfig ¶
func NewHomeWizardFromConfig(cfgFile string) (*HomeWizard, error)
func NewHomeWizardFromDiscovery ¶
func NewHomeWizardFromDiscovery(password string, verbose bool) (*HomeWizard, error)
func (*HomeWizard) GetEnergyMeters ¶
func (hw *HomeWizard) GetEnergyMeters() (*GetEnergyMetersOutput, error)
func (*HomeWizard) GetSensors ¶
func (hw *HomeWizard) GetSensors() (*GetSensorsOutput, error)
func (*HomeWizard) GetSwitches ¶
func (hw *HomeWizard) GetSwitches() (*GetSwitchesOutput, error)
func (*HomeWizard) GetThermometerGraph ¶
func (hw *HomeWizard) GetThermometerGraph(id int, period TimePeriod) (ThermGraph, error)
func (*HomeWizard) GetThermometers ¶
func (hw *HomeWizard) GetThermometers() (*GetThermometersOutput, error)
func (*HomeWizard) OperateSwitch ¶
func (hw *HomeWizard) OperateSwitch(in *OperateSwitchInput) (*OperateSwitchOutput, error)
type Kakusensor ¶
type OperateSwitchInput ¶
type OperateSwitchInput struct { ID int Type SwitchType DesiredStatus SwitchStatus DesiredTte float64 }
func (*OperateSwitchInput) Route ¶
func (i *OperateSwitchInput) Route() *RouteInfo
type OperateSwitchOutput ¶
type OperateSwitchOutput struct {
ResponseElems
}
type ResponseElems ¶
type ResponseElems struct { Request struct { Route string `json:"route"` } `json:"request"` Status string `json:"status"` Version string `json:"version"` }
func (*ResponseElems) GetStatus ¶
func (r *ResponseElems) GetStatus() string
func (*ResponseElems) GetVersion ¶
func (r *ResponseElems) GetVersion() string
type Switch ¶
type Switch struct { ID int `json:"id"` Name string `json:"name"` Type SwitchType `json:"type"` Status SwitchStatus `json:"status"` Favorite string `json:"favorite"` Tte float64 `json:"tte"` }
type SwitchStatus ¶
type SwitchStatus string
const ( SwitchStatusOn SwitchStatus = "on" SwitchStatusOff SwitchStatus = "off" )
func (SwitchStatus) Revert ¶
func (st SwitchStatus) Revert() SwitchStatus
type SwitchType ¶
type SwitchType string
const ( SwitchTypeSwitch SwitchType = "switch" SwitchTypeRadiator SwitchType = "radiator" SwitchTypeDimmer SwitchType = "dimmer" )
type Switches ¶
type Switches []Switch
func (Switches) ByType ¶
func (sws Switches) ByType(switchType SwitchType) []Switch
type ThermGraph ¶
type ThermGraph interface { Len() uint Elem(uint) ThermGraphPoint }
A ThermGraph is a slice of datapoints (graph data) Because HomeWizard returns a different JSON format for specific graphs we can use this interface to read all data
type ThermGraphMinMax ¶
type ThermGraphMinMax struct { T Time `json:"t"` TeMax float64 `json:"te+"` TeMin float64 `json:"te-"` HuMax int `json:"hu+"` HuMin int `json:"hu-"` }
func (*ThermGraphMinMax) Hum ¶
func (g *ThermGraphMinMax) Hum(p int8) int
func (*ThermGraphMinMax) Temp ¶
func (g *ThermGraphMinMax) Temp(p int8) float64
func (*ThermGraphMinMax) Time ¶
func (g *ThermGraphMinMax) Time() *Time
type ThermGraphPoint ¶
A ThermGraphPoint is a single datapoint in a slice of datapoints in graph data Because HomeWizard returns a different JSON format for specific graphs we can use this interface to read all data For Temp() and Time() you pass: - 0 : to get the current temp (or temp of that datapoint) - >0 : to get the maximum temp - <0 : to get the minimum temp
type ThermGraphT ¶
func (*ThermGraphT) Hum ¶
func (g *ThermGraphT) Hum(p int8) int
func (*ThermGraphT) Temp ¶
func (g *ThermGraphT) Temp(p int8) float64
func (*ThermGraphT) Time ¶
func (g *ThermGraphT) Time() *Time
type Thermometer ¶
type Thermometer struct { Code string `json:"code"` Favorite string `json:"favorite"` Hu int `json:"hu"` HuMax int `json:"hu+"` HuMaxT string `json:"hu+t"` HuMin int `json:"hu-"` HuMinT string `json:"hu-t"` ID int `json:"id"` LowBattery string `json:"lowBattery"` Model int `json:"model"` Name string `json:"name"` Outside string `json:"outside"` Te float64 `json:"te"` TeMax float64 `json:"te+"` TeMaxT string `json:"te+t"` TeMin float64 `json:"te-"` TeMinT string `json:"te-t"` Version float64 `json:"version"` }
type Time ¶
func (*Time) UnmarshalJSON ¶
Format: time: "2015-07-05 22:18"
type TimePeriod ¶
type TimePeriod string
const ( TimePeriodDay TimePeriod = "day" TimePeriodWeek TimePeriod = "week" TimePeriodMonth TimePeriod = "month" TimePeriodYear TimePeriod = "year" )
type Weatherdisplay ¶
type Weatherdisplay struct{} //TODO