Documentation ¶
Index ¶
- Constants
- func MarshalLocationUpdate(l LocationUpdate) *locationUpdateInfo
- func StartWebsocket(ctx context.Context, notifyCh chan fyne.Notification, doneCh chan struct{})
- type DeviceInfo
- type HassConfig
- func (c *HassConfig) Get(property string) (interface{}, error)
- func (h *HassConfig) GetEntityState(entity string) map[string]interface{}
- func (h *HassConfig) IsEntityDisabled(entity string) bool
- func (h *HassConfig) Refresh(ctx context.Context) error
- func (h *HassConfig) RequestData() json.RawMessage
- func (h *HassConfig) RequestType() request.RequestType
- func (h *HassConfig) ResponseHandler(resp bytes.Buffer)
- func (c *HassConfig) Set(property string, value interface{}) error
- func (h *HassConfig) Upgrade() error
- func (c *HassConfig) Validate() error
- type LocationUpdate
- type MockDeviceInfo
- func (_m *MockDeviceInfo) AppData() interface{}
- func (_m *MockDeviceInfo) AppID() string
- func (_m *MockDeviceInfo) AppName() string
- func (_m *MockDeviceInfo) AppVersion() string
- func (_m *MockDeviceInfo) DeviceID() string
- func (_m *MockDeviceInfo) DeviceName() string
- func (_m *MockDeviceInfo) Manufacturer() string
- func (_m *MockDeviceInfo) MarshalJSON() ([]byte, error)
- func (_m *MockDeviceInfo) Model() string
- func (_m *MockDeviceInfo) OsName() string
- func (_m *MockDeviceInfo) OsVersion() string
- func (_m *MockDeviceInfo) SupportsEncryption() bool
- type RegistrationDetails
- type RegistrationRequest
- type RegistrationResponse
- type WebSocket
- func (c *WebSocket) OnClose(socket *gws.Conn, err error)
- func (c *WebSocket) OnError(socket *gws.Conn, err error)
- func (c *WebSocket) OnMessage(socket *gws.Conn, message *gws.Message)
- func (c *WebSocket) OnOpen(socket *gws.Conn)
- func (c *WebSocket) OnPing(socket *gws.Conn, payload []byte)
- func (c *WebSocket) OnPong(socket *gws.Conn, payload []byte)
Constants ¶
const PingInterval = time.Minute
Variables ¶
This section is empty.
Functions ¶
func MarshalLocationUpdate ¶
func MarshalLocationUpdate(l LocationUpdate) *locationUpdateInfo
MarshalLocationUpdate will take a device type that implements LocationUpdate and marshal it into a locationUpdateInfo struct that can be sent as a request to HA
func StartWebsocket ¶ added in v0.3.5
Types ¶
type DeviceInfo ¶ added in v1.3.0
type HassConfig ¶ added in v0.0.6
type HassConfig struct {
// contains filtered or unexported fields
}
func NewHassConfig ¶ added in v0.0.6
func NewHassConfig(ctx context.Context) *HassConfig
func (*HassConfig) Get ¶ added in v1.0.0
func (c *HassConfig) Get(property string) (interface{}, error)
func (*HassConfig) GetEntityState ¶ added in v0.0.6
func (h *HassConfig) GetEntityState(entity string) map[string]interface{}
func (*HassConfig) IsEntityDisabled ¶ added in v0.0.7
func (h *HassConfig) IsEntityDisabled(entity string) bool
func (*HassConfig) Refresh ¶ added in v0.0.7
func (h *HassConfig) Refresh(ctx context.Context) error
func (*HassConfig) RequestData ¶ added in v0.0.6
func (h *HassConfig) RequestData() json.RawMessage
func (*HassConfig) RequestType ¶ added in v0.0.6
func (h *HassConfig) RequestType() request.RequestType
func (*HassConfig) ResponseHandler ¶ added in v0.0.6
func (h *HassConfig) ResponseHandler(resp bytes.Buffer)
func (*HassConfig) Set ¶ added in v1.0.0
func (c *HassConfig) Set(property string, value interface{}) error
func (*HassConfig) Upgrade ¶ added in v1.4.2
func (h *HassConfig) Upgrade() error
func (*HassConfig) Validate ¶ added in v1.0.0
func (c *HassConfig) Validate() error
type LocationUpdate ¶
type LocationUpdate interface { Gps() []float64 GpsAccuracy() int Battery() int Speed() int Altitude() int Course() int VerticalAccuracy() int }
LocationUpdate represents a location update from a platform/device. It provides a bridge between the platform/device specific location info and Home Assistant.
type MockDeviceInfo ¶ added in v1.4.3
MockDeviceInfo is an autogenerated mock type for the DeviceInfo type
func NewMockDeviceInfo ¶ added in v1.4.3
func NewMockDeviceInfo(t interface { mock.TestingT Cleanup(func()) }) *MockDeviceInfo
NewMockDeviceInfo creates a new instance of MockDeviceInfo. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockDeviceInfo) AppData ¶ added in v1.4.3
func (_m *MockDeviceInfo) AppData() interface{}
AppData provides a mock function with given fields:
func (*MockDeviceInfo) AppID ¶ added in v1.4.3
func (_m *MockDeviceInfo) AppID() string
AppID provides a mock function with given fields:
func (*MockDeviceInfo) AppName ¶ added in v1.4.3
func (_m *MockDeviceInfo) AppName() string
AppName provides a mock function with given fields:
func (*MockDeviceInfo) AppVersion ¶ added in v1.4.3
func (_m *MockDeviceInfo) AppVersion() string
AppVersion provides a mock function with given fields:
func (*MockDeviceInfo) DeviceID ¶ added in v1.4.3
func (_m *MockDeviceInfo) DeviceID() string
DeviceID provides a mock function with given fields:
func (*MockDeviceInfo) DeviceName ¶ added in v1.4.3
func (_m *MockDeviceInfo) DeviceName() string
DeviceName provides a mock function with given fields:
func (*MockDeviceInfo) Manufacturer ¶ added in v1.4.3
func (_m *MockDeviceInfo) Manufacturer() string
Manufacturer provides a mock function with given fields:
func (*MockDeviceInfo) MarshalJSON ¶ added in v1.4.3
func (_m *MockDeviceInfo) MarshalJSON() ([]byte, error)
MarshalJSON provides a mock function with given fields:
func (*MockDeviceInfo) Model ¶ added in v1.4.3
func (_m *MockDeviceInfo) Model() string
Model provides a mock function with given fields:
func (*MockDeviceInfo) OsName ¶ added in v1.4.3
func (_m *MockDeviceInfo) OsName() string
OsName provides a mock function with given fields:
func (*MockDeviceInfo) OsVersion ¶ added in v1.4.3
func (_m *MockDeviceInfo) OsVersion() string
OsVersion provides a mock function with given fields:
func (*MockDeviceInfo) SupportsEncryption ¶ added in v1.4.3
func (_m *MockDeviceInfo) SupportsEncryption() bool
SupportsEncryption provides a mock function with given fields:
type RegistrationDetails ¶ added in v1.3.0
type RegistrationDetails struct {
Server, Token binding.String
Device DeviceInfo
}
func (*RegistrationDetails) Validate ¶ added in v1.3.0
func (r *RegistrationDetails) Validate() bool
type RegistrationRequest ¶
type RegistrationRequest struct { AppData interface{} `json:"app_data,omitempty"` DeviceID string `json:"device_id"` AppID string `json:"app_id"` AppName string `json:"app_name"` AppVersion string `json:"app_version"` DeviceName string `json:"device_name"` Manufacturer string `json:"manufacturer"` Model string `json:"model"` OsName string `json:"os_name"` OsVersion string `json:"os_version"` SupportsEncryption bool `json:"supports_encryption"` }
type RegistrationResponse ¶
type RegistrationResponse struct { CloudhookURL string `json:"cloudhook_url"` RemoteUIURL string `json:"remote_ui_url"` Secret string `json:"secret"` WebhookID string `json:"webhook_id"` }
func RegisterWithHass ¶
func RegisterWithHass(registration *RegistrationDetails) (*RegistrationResponse, error)
func (*RegistrationResponse) GenerateAPIURL ¶ added in v1.4.3
func (rr *RegistrationResponse) GenerateAPIURL(host string) string
func (*RegistrationResponse) GenerateWebsocketURL ¶ added in v1.4.3
func (rr *RegistrationResponse) GenerateWebsocketURL(host string) string
type WebSocket ¶ added in v0.3.5
type WebSocket struct { ReadCh chan *webSocketData WriteCh chan *webSocketData // contains filtered or unexported fields }