Documentation ¶
Index ¶
- Constants
- func GetApiKey(host string, port int, user string, password string, integrationName string) (string, error)
- type Action
- type Apartment
- type ApartmentAttributes
- type ApartmentIncluded
- type ApartmentStatus
- type ApartmentStatusIncluded
- type ApplicationDetail
- type Area
- type ButtonInputMode
- type ButtonInputType
- type ButtonInputs
- type ButtonInputsAttributes
- type ChannelType
- type Client
- type ClientOptions
- type Controller
- type ControllerAttributes
- type Device
- type DeviceAttributes
- type DeviceChangeCallback
- type DeviceProperties
- type DeviceStatus
- type DeviceStatusAttributes
- type DeviceType
- type EventTypedeprecated
- type FunctionBlock
- type FunctionBlockAttributes
- type Installation
- type InstallationAttribute
- type Metering
- type MeteringAttributes
- type MeteringOrigin
- type MeteringType
- type MeteringValue
- type MeteringValueAttributes
- type MeteringValues
- type Meterings
- type NewApiKeyRequest
- type NewApiKeyRequestAttributes
- type NewApiKeyRequestData
- type NotificationCallback
- type NotificationType
- type Output
- type OutputAttributes
- type OutputMode
- type OutputType
- type OutputValue
- type OutputValueStatus
- type Registry
- type ScenarioApplication
- type ScenarioAttributes
- type ScenarioType
- type Scenarios
- type SensorInputType
- type SensorInputUsage
- type SensorInputs
- type SensorInputsAttributes
- type SetOutputValue
- type SetOutputValueOperation
- type Submodule
- type SubmoduleApplication
- type SubmoduleAttributes
- type WebsocketInitMessage
- type WebsocketNotification
- type WebsocketNotificationArgument
- type Zone
- type ZoneAttributes
Constants ¶
const WEBSOCKET_RECONNECT_DELAY = 5 * time.Second
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Apartment ¶
type Apartment struct { ApartmentId string `mapstructure:"id"` Attributes ApartmentAttributes `mapstructure:"attributes"` Included ApartmentIncluded `mapstructure:"included"` }
Appartment structure
type ApartmentAttributes ¶
type ApartmentIncluded ¶
type ApartmentIncluded struct { // Before mapping this, you need to add the "include" in the query Installation Installation `mapstructure:"installation"` Devices []Device `mapstructure:"dsDevices"` Submodules []Submodule `mapstructure:"submodules"` FunctionBlocks []FunctionBlock `mapstructure:"functionBlocks"` Zones []Zone `mapstructure:"zones"` Controllers []Controller `mapstructure:"controllers"` Meterings []Metering `mapstructure:"meterings"` }
type ApartmentStatus ¶
type ApartmentStatus struct { ApartmentId string `mapstructure:"id"` Included ApartmentStatusIncluded `mapstructure:"included"` }
type ApartmentStatusIncluded ¶
type ApartmentStatusIncluded struct {
Devices []DeviceStatus `mapstructure:"dsDevices"`
}
type ApplicationDetail ¶
type ButtonInputMode ¶
type ButtonInputMode string
const ( ButtonInputModeDisabled ButtonInputMode = "disabled" ButtonInputModeButton1way ButtonInputMode = "button1way" ButtonInputModeButton2way ButtonInputMode = "button2way" )
type ButtonInputType ¶
type ButtonInputType string
const ( ButtonInputTypeDevice ButtonInputType = "device" ButtonInputTypeArea1 ButtonInputType = "area1" ButtonInputTypeArea2 ButtonInputType = "area2" ButtonInputTypeArea3 ButtonInputType = "area3" ButtonInputTypeArea4 ButtonInputType = "area4" ButtonInputTypeZone ButtonInputType = "zone" ButtonInputTypeZone1 ButtonInputType = "zone1" ButtonInputTypeZone2 ButtonInputType = "zone2" ButtonInputTypeZone3 ButtonInputType = "zone3" ButtonInputTypeZone4 ButtonInputType = "zone4" ButtonInputTypeZonex1 ButtonInputType = "zonex1" ButtonInputTypeZonex2 ButtonInputType = "zonex2" ButtonInputTypeZonex3 ButtonInputType = "zonex3" ButtonInputTypeZonex4 ButtonInputType = "zonex4" ButtonInputTypeApplication ButtonInputType = "application" ButtonInputTypeGroup ButtonInputType = "group" ButtonInputTypeAppmode ButtonInputType = "appmode" )
type ButtonInputs ¶
type ButtonInputs struct { ButtonInputId string `mapstructure:"id"` Attributes ButtonInputsAttributes `mapstructure:"attributes"` }
type ButtonInputsAttributes ¶
type ButtonInputsAttributes struct { TechnicalName string `mapstructure:"technicalName"` Type ButtonInputType `mapstructure:"type"` Mode ButtonInputMode `mapstructure:"mode"` }
type ChannelType ¶
type ChannelType string
const ( ChannelTypeBrightness ChannelType = "brightness" ChannelTypeHue ChannelType = "hue" )
type Client ¶
type Client interface { // Connect will perform login on the DigitalStrom server. Connect() error // Disconnect from the server by closing all idle connections, closing the // event loop if running and unsubscribing from the server. Disconnect() error GetApartment() (*Apartment, error) GetApartmentStatus() (*ApartmentStatus, error) GetMeterings() (*Meterings, error) GetMeteringStatus() (*MeteringValues, error) // DeviceSetOutputValue Sets a list of outputs to a give values DeviceSetOutputValue(deviceId string, functionBlockId string, outputId string, value float64) error NotificationSubscribe(id string, callback NotificationCallback) error NotificationUnsubscribe(id string) error }
Client is the interface definition as used by this library, the interface is primarily to allow mocking tests.
func NewClient ¶
func NewClient(options *ClientOptions) Client
NewClient will create a DigitalStrom client with all the options specified in the provided ClientOptions. The client must have the Connect() method called on it before it may be used.
type ClientOptions ¶
ClientOptions contains configurable options for a Digitalstrom Client.
func NewClientOptions ¶
func NewClientOptions() *ClientOptions
NewClientOptions will create a new ClientClientOptions type with some default values.
Host: dss.local Port: 8080
func (*ClientOptions) SetApiKey ¶
func (o *ClientOptions) SetApiKey(u string) *ClientOptions
SetUsername will set the username to be used by this client when connecting to the DigitalStrom server.
func (*ClientOptions) SetHost ¶
func (o *ClientOptions) SetHost(host string) *ClientOptions
SetHost will set the address for the DigitalStrom server to connect.
func (*ClientOptions) SetPort ¶
func (o *ClientOptions) SetPort(port int) *ClientOptions
SetPort will set the port for the DigitalStrom server to connect.
type Controller ¶
type Controller struct { ControllerId string `mapstructure:"id"` Attributes ControllerAttributes `mapstructure:"attributes"` }
type ControllerAttributes ¶
type Device ¶
type Device struct { DeviceId string `mapstructure:"id"` Attributes DeviceAttributes `mapstructure:"attributes"` }
type DeviceAttributes ¶
type DeviceAttributes struct { Name string `mapstructure:"name"` Dsid string `mapstructure:"dsid"` DisplayId string `mapstructure:"displayId"` Present bool `mapstructure:"present"` Submodules []string `mapstructure:"submodules"` Zone string `mapstructure:"zone"` Scenarios []string `mapstructure:"scenarios"` Controller string `mapstructure:"controller"` }
type DeviceChangeCallback ¶
type DeviceProperties ¶
Properties a device can have and helps us better understand how it works. Note that all these properties are inferred from the attributes in the Device structure.
type DeviceStatus ¶
type DeviceStatus struct { DeviceId string `mapstructure:"id"` Type string `mapstructure:"type"` Attributes DeviceStatusAttributes `mapstructure:"attributes"` }
type DeviceStatusAttributes ¶
type DeviceStatusAttributes struct { FunctionBlocks []struct { FunctionBlockId string `mapstructure:"id"` Outputs []OutputValue `mapstructure:"outputs,omitempty"` } `mapstructure:"functionBlocks"` Submodules []struct { SubmoduleId string `mapstructure:"id"` OperationsLocked bool `mapstructure:"operationsLocked"` } `mapstructure:"submodules"` States []struct { StateId string `mapstructure:"id"` Value string `mapstructure:"value"` } `mapstructure:"states,omitempty"` }
type DeviceType ¶
type DeviceType string
const ( DeviceTypeLight DeviceType = "GE" DeviceTypeBlind DeviceType = "GR" DeviceTypeJoker DeviceType = "SW" DeviceTypeUnknown DeviceType = "Unknown" )
type EventType
deprecated
type EventType string
Deprecated: use new API instead
const ( EventTypeCallScene EventType = "callScene" EventTypeUndoScene EventType = "undoScene" EventTypeButtonClick EventType = "buttonClick" EventTypeDeviceSensor EventType = "deviceSensorEvent" EventTypeRunning EventType = "running" EventTypeModelReady EventType = "model_ready" EventTypeDsMeterReady EventType = "dsMeter_ready" )
type FunctionBlock ¶
type FunctionBlock struct { FunctionBlockId string `mapstructure:"id"` Attributes FunctionBlockAttributes `mapstructure:"attributes"` }
func (*FunctionBlock) DeviceType ¶
func (functionBlock *FunctionBlock) DeviceType() DeviceType
Returns the device type given its hardware technicalName
func (*FunctionBlock) Properties ¶
func (functionBlock *FunctionBlock) Properties() DeviceProperties
Returns some inferred properties from the device.
type FunctionBlockAttributes ¶
type FunctionBlockAttributes struct { Name string `mapstructure:"name"` TechnicalName string `mapstructure:"technicalName"` Active bool `mapstructure:"active"` Outputs []Output `mapstructure:"outputs"` ButtonInputs []ButtonInputs `mapstructure:"buttonInputs"` SensorInputs []SensorInputs `mapstructure:"sensorInputs"` Submodule string `mapstructure:"submodule"` DeviceAdapter string `mapstructure:"deviceAdapter"` }
type Installation ¶
type Installation struct { InstallationId string `mapstructure:"id"` Type string `mapstructure:"type"` Attributes InstallationAttribute `mapstructure:"attributes"` }
type InstallationAttribute ¶
type Metering ¶
type Metering struct { MeteringId string `mapstructure:"id"` Attributes MeteringAttributes `mapstructure:"attributes"` }
type MeteringAttributes ¶
type MeteringAttributes struct { Unit string `mapstructure:"unit"` TechnicalName string `mapstructure:"technicalName"` Origin MeteringOrigin `mapstructure:"origin"` }
type MeteringOrigin ¶
type MeteringOrigin struct { MeteringOriginId string `mapstructure:"id"` Type MeteringType `mapstructure:"type"` }
type MeteringType ¶
type MeteringType string
const ( MeteringTypeApartment MeteringType = "apartment" MeteringTypeController MeteringType = "controller" )
type MeteringValue ¶
type MeteringValue struct { Id string `mapstructure:"id"` Attributes MeteringValueAttributes `mapstructure:"attributes"` }
type MeteringValueAttributes ¶
type MeteringValueAttributes struct {
Value float64 `json:"value"`
}
type MeteringValues ¶
type MeteringValues struct {
Values []MeteringValue `mapstructure:"values"`
}
type Meterings ¶
type Meterings struct {
Meterings []Metering `mapstructure:"meterings"`
}
Meterings
type NewApiKeyRequest ¶
type NewApiKeyRequest struct {
Data NewApiKeyRequestData `json:"data"`
}
type NewApiKeyRequestAttributes ¶
type NewApiKeyRequestAttributes struct {
Name string `json:"name"`
}
type NewApiKeyRequestData ¶
type NewApiKeyRequestData struct { Type string `json:"type"` Attributes NewApiKeyRequestAttributes `json:"attributes"` }
type NotificationCallback ¶
type NotificationCallback func(notification WebsocketNotification)
type NotificationType ¶
type NotificationType string
const ( NotificationTypeApartmentStructureChanged NotificationType = "apartmentStructureChanged" NotificationTypeApartmentStatusChanged NotificationType = "apartmentStatusChanged" )
type Output ¶
type Output struct { OutputId string `mapstructure:"id"` Attributes OutputAttributes `mapstructure:"attributes"` }
type OutputAttributes ¶
type OutputAttributes struct { TechnicalName string `mapstructure:"technicalName"` Type OutputType `mapstructure:"type"` Function string `mapstructure:"function"` Mode OutputMode `mapstructure:"mode"` Min float64 `mapstructure:"min"` Max float64 `mapstructure:"max"` Resolution float64 `mapstructure:"resolution"` }
type OutputMode ¶
type OutputMode string
const ( OutputModeDisabled OutputMode = "disabled" OutputModeSwitched OutputMode = "switched" OutputModeGradual OutputMode = "gradual" OutputModePositional OutputMode = "positional" OutputModeInternal OutputMode = "internal" )
type OutputType ¶
type OutputType string
const ( OutputTypeLightBrightness OutputType = "lightBrightness" OutputTypeLightHue OutputType = " lightHue" OutputTypeLightSaturation OutputType = " lightSaturation" OutputTypeLightTemperature OutputType = " lightTemperature" OutputTypeLightCieX OutputType = " lightCieX" OutputTypeLightCieY OutputType = " lightCieY" OutputTypeShadePositionOutside OutputType = " shadePositionOutside" OutputTypeShadePositionIndoor OutputType = " shadePositionIndoor" OutputTypeShadeOpeningAngleOutside OutputType = " shadeOpeningAngleOutside" OutputTypeShadeOpeningAngleIndoor OutputType = " shadeOpeningAngleIndoor" OutputTypeShadeTransparency OutputType = " shadeTransparency" OutputTypeAirFlowIntensity OutputType = " airFlowIntensity" OutputTypeAirFlowDirection OutputType = " airFlowDirection" OutputTypeAirFlapOpeningAngle OutputType = " airFlapOpeningAngle" OutputTypeVentilationLouverPosition OutputType = " ventilationLouverPosition" OutputTypeHeatingPower OutputType = " heatingPower" OutputTypeCoolingCapacity OutputType = " coolingCapacity" OutputTypeAudioVolume OutputType = " audioVolume" OutputTypePowerState OutputType = " powerState" OutputTypeVentilationSwingMode OutputType = " ventilationSwingMode" OutputTypeVentilationAutoIntensity OutputType = " ventilationAutoIntensity" OutputTypeWaterTemperature OutputType = " waterTemperature" OutputTypeWaterFlowRate OutputType = " waterFlowRate" OutputTypePowerLevel OutputType = " powerLevel" OutputTypeVideoStation OutputType = " videoStation" OutputTypeVideoInputSource OutputType = " videoInputSource" )
type OutputValue ¶
type OutputValue struct { OutputId string `mapstructure:"id"` Value float64 `mapstructure:"value"` Status OutputValueStatus `mapstructure:"status"` TargetValue float64 `mapstructure:"targetValue"` Level int `mapstructure:"level,omitempty"` }
type OutputValueStatus ¶
type OutputValueStatus string
const ( OutputValueStatusOk OutputValueStatus = "ok" OutputValueStatusMoving OutputValueStatus = "moving" OutputValueStatusDimming OutputValueStatus = "dimming" OutputValueStatusOverload OutputValueStatus = "overload" OutputValueStatusBlocked OutputValueStatus = "blocked" OutputValueStatusError OutputValueStatus = "error" OutputValueStatusStandby OutputValueStatus = "standby" )
type Registry ¶
type Registry interface { Start() error Stop() error GetDevices() ([]Device, error) GetDevice(deviceId string) (Device, error) GetFunctionBlockForDevice(deviceId string) (FunctionBlock, error) GetOutputsOfDevice(deviceId string) ([]Output, error) GetOutputValuesOfDevice(deviceId string) ([]OutputValue, error) GetControllers() ([]Controller, error) GetControllerById(controllerId string) (Controller, error) GetMeterings() ([]Metering, error) DeviceChangeSubscribe(deviceId string, callback DeviceChangeCallback) error DeviceChangeUnsubscribe(deviceId string) error }
Registry The registry hold the current structure of the appartement and the latest known state
func NewRegistry ¶
type ScenarioApplication ¶
type ScenarioApplication string
const ( ScenarioApplicationLights ScenarioApplication = "lights" ScenarioApplicationShades ScenarioApplication = "shades" ScenarioApplicationAwnings ScenarioApplication = "awnings" ScenarioApplicationAudio ScenarioApplication = "audio" ScenarioApplicationVideo ScenarioApplication = "video" ScenarioApplicationSecurity ScenarioApplication = "security" ScenarioApplicationAccess ScenarioApplication = "access" ScenarioApplicationHeating ScenarioApplication = "heating" ScenarioApplicationCooling ScenarioApplication = "cooling" ScenarioApplicationTemperature ScenarioApplication = "temperature" ScenarioApplicationVentilation ScenarioApplication = "ventilation" ScenarioApplicationRecirculation ScenarioApplication = "recirculation" ScenarioApplicationWindow ScenarioApplication = "window" ScenarioApplicationJoker ScenarioApplication = "joker" )
type ScenarioAttributes ¶
type ScenarioAttributes struct { Name string `mapstructure:"name"` ActionId string `mapstructure:"actionId"` Context string `mapstructure:"context"` Submodules []string `mapstructure:"submodules"` Devices []string `mapstructure:"dsDevices"` Zone string `mapstructure:"zone"` Application ScenarioApplication `mapstructure:"application"` }
type ScenarioType ¶
type ScenarioType string
const ( ScenarioTypeApplicationZoneScenario ScenarioType = "applicationZoneScenario" ScenarioTypeDeviceScenario ScenarioType = "deviceScenario" ScenarioTypeUserDefinedAction ScenarioType = "userDefinedAction" )
type Scenarios ¶
type Scenarios struct { ScenarioId string `mapstructure:"id"` Type ScenarioType `mapstructure:"type"` Attributes ScenarioAttributes `mapstructure:"attributes"` }
type SensorInputType ¶
type SensorInputType string
const ( SensorInputTypeTemperature SensorInputType = "temperature" SensorInputTypeBrightness SensorInputType = "brightness" SensorInputTypeHumidity SensorInputType = "humidity" SensorInputTypeCarbonDioxide SensorInputType = "carbonDioxide" SensorInputTypeTemperatureSetpoint SensorInputType = "temperatureSetpoint" SensorInputTypeTemperatureControlValue SensorInputType = "temperatureControlValue" SensorInputTypeEnergy SensorInputType = "energy" SensorInputTypeEnergyCounter SensorInputType = "energyCounter" )
type SensorInputUsage ¶
type SensorInputUsage string
const ( SensorInputUsageZone SensorInputUsage = "zone" SensorInputUsageOutdoor SensorInputUsage = "outdoor" SensorInputUsageSettings SensorInputUsage = "settings" SensorInputUsageDevice SensorInputUsage = "device" SensorInputUsageDeviceLastRun SensorInputUsage = "deviceLastRun" SensorInputUsageDeviceAverage SensorInputUsage = "deviceAverage" )
type SensorInputs ¶
type SensorInputs struct { SensorInputId string `mapstructure:"id"` Attributes SensorInputsAttributes `mapstructure:"attributes"` }
type SensorInputsAttributes ¶
type SensorInputsAttributes struct { TechnicalName string `mapstructure:"technicalName"` Type SensorInputType `mapstructure:"type"` Mode SensorInputUsage `mapstructure:"usage"` Min float64 `mapstructure:"min"` Max float64 `mapstructure:"max"` Resolution float64 `mapstructure:"resolution"` }
type SetOutputValue ¶
type SetOutputValue struct { Op SetOutputValueOperation `json:"op"` Path string `json:"path"` Value string `json:"value"` }
type SetOutputValueOperation ¶
type SetOutputValueOperation string
const ( SetOutputValueOperationAdd SetOutputValueOperation = "add" SetOutputValueOperationRemove SetOutputValueOperation = "remove" SetOutputValueOperationReplace SetOutputValueOperation = "replace" SetOutputValueOperationMove SetOutputValueOperation = "move" SetOutputValueOperationCopy SetOutputValueOperation = "copy" SetOutputValueOperationTest SetOutputValueOperation = "test" )
type Submodule ¶
type Submodule struct { SubmoduleId string `mapstructure:"id"` Attributes SubmoduleAttributes `mapstructure:"attributes"` }
type SubmoduleApplication ¶
type SubmoduleApplication string
const ( SubmoduleTypeLights SubmoduleApplication = "lights" SubmoduleTypeShades SubmoduleApplication = "shades" SubmoduleTypeAwnings SubmoduleApplication = "awnings" SubmoduleTypeAudio SubmoduleApplication = "audio" SubmoduleTypeVideo SubmoduleApplication = "video" SubmoduleTypeSecurity SubmoduleApplication = "security" SubmoduleTypeAccess SubmoduleApplication = "access" SubmoduleTypeHeating SubmoduleApplication = "heating" SubmoduleTypeCooling SubmoduleApplication = "cooling" SubmoduleTypeTemperature SubmoduleApplication = "temperature" SubmoduleTypeVentilation SubmoduleApplication = "ventilation" SubmoduleTypeRecirculation SubmoduleApplication = "recirculation" SubmoduleTypeWindow SubmoduleApplication = "window" SubmoduleTypeJoker SubmoduleApplication = "joker" )
type SubmoduleAttributes ¶
type SubmoduleAttributes struct { Name string `mapstructure:"name"` TechnicalName string `mapstructure:"technicalName"` DeviceId string `mapstructure:"dsDevice"` FunctionBlocks []string `mapstructure:"functionBlocks"` Zone string `mapstructure:"zone"` Application SubmoduleApplication `mapstructure:"application"` Scenarios []string `mapstructure:"scenarios"` Controller string `mapstructure:"controller"` }
type WebsocketInitMessage ¶
type WebsocketNotification ¶
type WebsocketNotification struct { Type int `json:"type"` Target string `json:"target"` Arguments []WebsocketNotificationArgument `json:"arguments"` }
type WebsocketNotificationArgument ¶
type WebsocketNotificationArgument struct {
Type NotificationType `json:"type"`
}
type Zone ¶
type Zone struct { ZoneId string `mapstructure:"id"` Attributes ZoneAttributes `mapstructure:"attributes"` }
Zone representation.
type ZoneAttributes ¶
type ZoneAttributes struct { Name string `mapstructure:"name"` Floor string `mapstructure:"floor"` OrderId float64 `mapstructure:"orderId"` Submodules []string `mapstructure:"submodules"` Applications []string `mapstructure:"applications"` ApplicationTypes []string `mapstructure:"applicationTypes"` ApplicationDetails []ApplicationDetail `mapstructure:"applicationDetails"` }