hass

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
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

func StartWebsocket(ctx context.Context, notifyCh chan fyne.Notification, doneCh chan struct{})

Types

type DeviceInfo added in v1.3.0

type DeviceInfo interface {
	DeviceID() string
	AppID() string
	AppName() string
	AppVersion() string
	DeviceName() string
	Manufacturer() string
	Model() string
	OsName() string
	OsVersion() string
	SupportsEncryption() bool
	AppData() interface{}
	MarshalJSON() ([]byte, error)
}

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

type MockDeviceInfo struct {
	mock.Mock
}

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
}

func NewWebsocket

func NewWebsocket(ctx context.Context, notifyCh chan fyne.Notification, doneCh chan struct{}) *WebSocket

func (*WebSocket) OnClose added in v0.3.5

func (c *WebSocket) OnClose(socket *gws.Conn, err error)

func (*WebSocket) OnError added in v0.3.5

func (c *WebSocket) OnError(socket *gws.Conn, err error)

func (*WebSocket) OnMessage added in v0.3.5

func (c *WebSocket) OnMessage(socket *gws.Conn, message *gws.Message)

func (*WebSocket) OnOpen added in v0.3.5

func (c *WebSocket) OnOpen(socket *gws.Conn)

func (*WebSocket) OnPing added in v0.3.5

func (c *WebSocket) OnPing(socket *gws.Conn, payload []byte)

func (*WebSocket) OnPong added in v0.3.5

func (c *WebSocket) OnPong(socket *gws.Conn, payload []byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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