msgs

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes struct {
	DeviceClass  string `json:"device_class"`
	FriendlyName string `json:"friendly_name"`
	MotionValid  *bool  `json:"motion_valid"`
}

type AuthRequest

type AuthRequest struct {
	Type        MsgType `json:"type"`
	AccessToken string  `json:"access_token"`
}

type AuthResponse

type AuthResponse struct {
	Type      MsgType `json:"type"`
	HaVersion string  `json:"ha_version"`
}

type BaseError

type BaseError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type BaseMessage

type BaseMessage struct {
	Id   uint64  `json:"id"`
	Type MsgType `json:"type"`
}

func (*BaseMessage) SetId

func (r *BaseMessage) SetId(seq uint64)

type BaseResult

type BaseResult struct {
	BaseMessage
	Success *bool      `json:"success"`
	Error   *BaseError `json:"error"`
}

type EventContainer

type EventContainer struct {
	Variables VariablesContainer `json:"variables"`
}

type EventResponse

type EventResponse struct {
	BaseMessage
	Event EventContainer `json:"event"`
}

type MsgType

type MsgType string
const (
	AuthRequired         MsgType = "auth_required"
	Auth                 MsgType = "auth"
	AuthOk               MsgType = "auth_ok"
	AuthInvalid          MsgType = "auth_invalid"
	Result               MsgType = "result"
	SubscribeEvents      MsgType = "subscribe_events"
	Event                MsgType = "event"
	SubscribeTrigger     MsgType = "subscribe_trigger"
	UnsubscribeEvents    MsgType = "unsubscribe_events"
	FireEvent            MsgType = "fire_event"
	CallService          MsgType = "call_service"
	GetStates            MsgType = "get_states"
	GetConfig            MsgType = "get_config"
	GetServices          MsgType = "get_services"
	GetPanels            MsgType = "get_panels"
	MediaPlayerThumbnail MsgType = "media_player_thumbnail"
	Ping                 MsgType = "ping"
	Pong                 MsgType = "pong"
	ValidateConfig       MsgType = "validate_config"
)

type SensorState

type SensorState struct {
	Attributes Attributes `json:"attributes"`
	EntityID   string     `json:"entity_id"`
	State      string     `json:"state"`
}

type StateResult

type StateResult struct {
	BaseResult
	Result []SensorState `json:"result"`
}

func (*StateResult) GetEntityIdWithPrefixAndType

func (s *StateResult) GetEntityIdWithPrefixAndType(prefix string, stype string) string

type SubscribeStateRequest

type SubscribeStateRequest struct {
	BaseMessage
	Trigger TriggerDetails `json:"trigger"`
}

type TriggerContainer

type TriggerContainer struct {
	Platform  string      `json:"platform"`
	EntityID  string      `json:"entity_id"`
	FromState SensorState `json:"from_state"`
	ToState   SensorState `json:"to_state"`
}

type TriggerDetails

type TriggerDetails struct {
	Platform string  `json:"platform"`
	EntityID string  `json:"entity_id"`
	From     *string `json:"from,omitempty"`
	To       *string `json:"to,omitempty"`
}

type UnsubscribeRequest

type UnsubscribeRequest struct {
	BaseMessage
	Subscription uint64 `json:"subscription"`
}

type VariablesContainer

type VariablesContainer struct {
	Trigger TriggerContainer `json:"trigger"`
}

Jump to

Keyboard shortcuts

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