Documentation
¶
Index ¶
- type APIResponse
- type App
- func (a *App) Groups() []Group
- func (a *App) Sensors() []MotionSensor
- func (a *App) Start(ctx context.Context)
- func (a *App) UpdateGroup(ctx context.Context, id string, on bool, brightness float64, ...) (Group, error)
- func (a *App) UpdateSensor(ctx context.Context, id string, enabled bool) (MotionSensor, error)
- type Color
- type ColorTemperature
- type Config
- type Device
- type DeviceByID
- type DevicePower
- type DevicePowerByOwner
- type Dimming
- type Event
- type Group
- type GroupByTypeAndName
- type GroupedLight
- type Light
- type LightLevel
- type LightLevelByOwner
- type Motion
- type MotionByOwner
- type MotionSensor
- type MotionSensorByName
- type MotionValue
- type On
- type Room
- type Temperature
- type TemperatureByOwner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse[T any] struct { Data []T `json:"data"` Errors []struct { Description string `json:"description"` } `json:"errors"` }
APIResponse description
type App ¶
type App struct {
// contains filtered or unexported fields
}
App stores information and secret of API
func New ¶
func New(config Config, meterProvider metric.MeterProvider) (*App, error)
New creates new App from Config
func (*App) Sensors ¶
func (a *App) Sensors() []MotionSensor
func (*App) UpdateGroup ¶
func (a *App) UpdateGroup(ctx context.Context, id string, on bool, brightness float64, transitionTime time.Duration) (Group, error)
UpdateGroup status
func (*App) UpdateSensor ¶
type ColorTemperature ¶ added in v1.23.0
type ColorTemperature struct {
Mirek int `json:"mirek"`
}
type Device ¶
type Device struct {
ProductData struct {
ManufacturerName string `json:"manufacturer_name"`
ModelID string `json:"model_id"`
ProductArchetype string `json:"product_archetype"`
ProductName string `json:"product_name"`
SoftwareVersion string `json:"software_version"`
Certified bool `json:"certified"`
} `json:"product_data"`
Metadata struct {
Archetype string `json:"archetype"`
Name string `json:"name"`
} `json:"metadata"`
ID string `json:"id"`
IDV1 string `json:"id_v1"`
Type string `json:"type"`
Services []deviceReference `json:"services"`
}
Device description
type DeviceByID ¶
type DeviceByID []Device
DeviceByID sort Device by ID
func (DeviceByID) Len ¶
func (a DeviceByID) Len() int
func (DeviceByID) Less ¶
func (a DeviceByID) Less(i, j int) bool
func (DeviceByID) Swap ¶
func (a DeviceByID) Swap(i, j int)
type DevicePower ¶
type DevicePower struct {
Owner deviceReference `json:"owner"`
ID string `json:"id"`
PowerState struct {
BatteryState string `json:"battery_state"`
BatteryLevel int64 `json:"battery_level"`
} `json:"power_state"`
}
DevicePower description
type DevicePowerByOwner ¶
type DevicePowerByOwner []DevicePower
DevicePowerByOwner sort DevicePower by Owner
func (DevicePowerByOwner) Len ¶
func (a DevicePowerByOwner) Len() int
func (DevicePowerByOwner) Less ¶
func (a DevicePowerByOwner) Less(i, j int) bool
func (DevicePowerByOwner) Swap ¶
func (a DevicePowerByOwner) Swap(i, j int)
type Event ¶
type Event struct {
Type string `json:"type"`
Data []struct {
Motion *MotionValue `json:"motion,omitempty"`
ColorTemperature *ColorTemperature `json:"color_temperature,omitempty"`
Color *Color `json:"color,omitempty"`
Dimming *Dimming `json:"dimming,omitempty"`
On *On `json:"on,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Owner deviceReference `json:"owner"`
ID string `json:"id"`
Type string `json:"type"`
PowerState struct {
BatteryState string `json:"battery_state"`
BatteryLevel int64 `json:"battery_level"`
}
Light struct {
Level int64 `json:"light_level"`
} `json:"light"`
Temperature struct {
Temperature float64 `json:"temperature"`
} `json:"temperature"`
} `json:"data"`
}
Event from the server sent event
type Group ¶
type Group struct {
GroupedLights map[string]GroupedLight
ID string
Name string
Lights []*Light
Bridge bool
Plug bool
}
Group description
type GroupByTypeAndName ¶
type GroupByTypeAndName []Group
GroupByTypeAndName sort Group by Type then, Name
func (GroupByTypeAndName) Len ¶
func (a GroupByTypeAndName) Len() int
func (GroupByTypeAndName) Less ¶
func (a GroupByTypeAndName) Less(i, j int) bool
func (GroupByTypeAndName) Swap ¶
func (a GroupByTypeAndName) Swap(i, j int)
type GroupedLight ¶
type GroupedLight struct {
ID string `json:"id"`
Alert struct {
ActionValues []string `json:"action_values"`
} `json:"alert"`
Dimming Dimming `json:"dimming"`
On On `json:"on"`
}
GroupedLight description
type LightLevel ¶
type LightLevelByOwner ¶
type LightLevelByOwner []LightLevel
func (LightLevelByOwner) Len ¶
func (a LightLevelByOwner) Len() int
func (LightLevelByOwner) Less ¶
func (a LightLevelByOwner) Less(i, j int) bool
func (LightLevelByOwner) Swap ¶
func (a LightLevelByOwner) Swap(i, j int)
type Motion ¶
type Motion struct {
Owner deviceReference `json:"owner"`
ID string `json:"id"`
Motion MotionValue `json:"motion"`
Enabled bool `json:"enabled"`
}
type MotionByOwner ¶
type MotionByOwner []Motion
func (MotionByOwner) Len ¶
func (a MotionByOwner) Len() int
func (MotionByOwner) Less ¶
func (a MotionByOwner) Less(i, j int) bool
func (MotionByOwner) Swap ¶
func (a MotionByOwner) Swap(i, j int)
type MotionSensor ¶
type MotionSensor struct {
ID string `json:"id"`
MotionID string `json:"motion_id"`
Name string `json:"name"`
BatteryState string `json:"battery_state"`
LightLevel int64 `json:"light_level"`
Temperature float64 `json:"temperature"`
BatteryLevel int64 `json:"battery_level"`
Enabled bool `json:"enabled"`
Motion bool `json:"motion"`
}
type MotionSensorByName ¶
type MotionSensorByName []MotionSensor
func (MotionSensorByName) Len ¶
func (a MotionSensorByName) Len() int
func (MotionSensorByName) Less ¶
func (a MotionSensorByName) Less(i, j int) bool
func (MotionSensorByName) Swap ¶
func (a MotionSensorByName) Swap(i, j int)
type MotionValue ¶
type Room ¶
type Room struct {
ID string `json:"id"`
Metadata struct {
Name string `json:"name"`
} `json:"metadata"`
Services []deviceReference `json:"services"`
Children []deviceReference `json:"children"`
}
Room description
type Temperature ¶
type TemperatureByOwner ¶
type TemperatureByOwner []Temperature
func (TemperatureByOwner) Len ¶
func (a TemperatureByOwner) Len() int
func (TemperatureByOwner) Less ¶
func (a TemperatureByOwner) Less(i, j int) bool
func (TemperatureByOwner) Swap ¶
func (a TemperatureByOwner) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.