Documentation
¶
Index ¶
- Constants
- type Context
- type Data
- type Error
- type Event
- type EventType
- type Histories
- type History
- type Message
- func (m *Message) Attributes() map[string]interface{}
- func (m *Message) Domain() string
- func (m *Message) DomainEntity() string
- func (m *Message) EntityID() string
- func (m *Message) FriendlyName() string
- func (m *Message) OldAttributes() map[string]interface{}
- func (m *Message) OldState() *string
- func (m *Message) State() string
- func (m *Message) StateFloat() (float64, error)
- type MessageType
- type OnAirQualityHandler
- type OnAlarmControlPanelHandler
- type OnBinarySensorHandler
- type OnButtonHandler
- type OnCameraHandler
- type OnClimateHandler
- type OnCoverHandler
- type OnDeviceTrackerHandler
- type OnEntityHandlers
- type OnFanHandler
- type OnHumidifierHandler
- type OnIntroductionHandler
- type OnLightHandler
- type OnLockHandler
- type OnMediaPlayerHandler
- type OnNumberHandler
- type OnRemoteHandler
- type OnSelectHandler
- type OnSensorHandler
- type OnSirenHandler
- type OnSwitchHandler
- type OnTextHandler
- type OnTypeHandlers
- type OnUpdateHandler
- type OnVacuumHandler
- type OnWaterHeaterHandler
- type OnWeatherHandler
- type Result
- type State
Constants ¶
View Source
const ( MessageTypeAuthRequired MessageType = "auth_required" MessageTypeAuth = "auth" MessageTypeAuthOK = "auth_ok" MessageTypeSubscribeEvents = "subscribe_events" MessageTypeSubscribeTrigger = "subscribe_trigger" MessageTypeEvent = "event" MessageTypePing = "ping" MessageTypeGetStates = "get_states" MessageTypeGetServices = "get_services" MessageTypeGetEntityRegistry = "config/entity_registry/list" MessageTypeGetDeviceRegistry = "config/device_registry/list" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
ID *int `json:"id,omitempty"`
Type MessageType `json:"type"`
AccessToken *string `json:"access_token,omitempty"`
Success *bool `json:"success,omitempty"`
EventType *EventType `json:"event_type,omitempty"`
Error *Error `json:"error,omitempty"`
Event *Event `json:"event,omitempty"`
Result []Result `json:"result,omitempty"`
ServiceResult map[string]interface{} `json:"service_result,omitempty"`
Raw []byte `json:"-"`
}
func ParseMessage ¶
func (*Message) Attributes ¶
func (*Message) DomainEntity ¶
func (*Message) FriendlyName ¶
func (*Message) OldAttributes ¶
func (*Message) StateFloat ¶
type MessageType ¶
type MessageType string
func (MessageType) Valid ¶
func (mt MessageType) Valid() bool
type OnAirQualityHandler ¶
type OnAirQualityHandler func(message *Message, newAttrs, oldAttrs *entities.AirQuality)
type OnAlarmControlPanelHandler ¶
type OnAlarmControlPanelHandler func(message *Message, newAttrs, oldAttrs *entities.AlarmControlPanel)
type OnBinarySensorHandler ¶
type OnBinarySensorHandler func(message *Message, newAttrs, oldAttrs *entities.BinarySensor)
type OnButtonHandler ¶
type OnCameraHandler ¶
type OnClimateHandler ¶
type OnCoverHandler ¶
type OnDeviceTrackerHandler ¶
type OnDeviceTrackerHandler func(message *Message, newAttrs, oldAttrs *entities.DeviceTracker)
type OnEntityHandlers ¶
func (OnEntityHandlers) Run ¶
func (o OnEntityHandlers) Run(message *Message) bool
func (OnEntityHandlers) RunStates ¶
func (o OnEntityHandlers) RunStates(message *Message)
type OnFanHandler ¶
type OnHumidifierHandler ¶
type OnHumidifierHandler func(message *Message, newAttrs, oldAttrs *entities.Humidifier)
type OnIntroductionHandler ¶
type OnIntroductionHandler func(message *Message, newAttrs, oldAttrs *entities.Introduction)
type OnLightHandler ¶
type OnLockHandler ¶
type OnMediaPlayerHandler ¶
type OnMediaPlayerHandler func(message *Message, newAttrs, oldAttrs *entities.MediaPlayer)
type OnNumberHandler ¶
type OnRemoteHandler ¶
type OnSelectHandler ¶
type OnSensorHandler ¶
type OnSirenHandler ¶
type OnSwitchHandler ¶
type OnTextHandler ¶
type OnTypeHandlers ¶
type OnTypeHandlers struct {
OnAirQuality OnAirQualityHandler
OnAlarmControlPanel OnAlarmControlPanelHandler
OnBinarySensor OnBinarySensorHandler
OnButton OnButtonHandler
OnCamera OnCameraHandler
OnClimate OnClimateHandler
OnCover OnCoverHandler
OnDeviceTracker OnDeviceTrackerHandler
OnFan OnFanHandler
OnHumidifier OnHumidifierHandler
OnIntroduction OnIntroductionHandler
OnLight OnLightHandler
OnLock OnLockHandler
OnMediaPlayer OnMediaPlayerHandler
OnNumber OnNumberHandler
OnRemote OnRemoteHandler
OnSelect OnSelectHandler
OnSensor OnSensorHandler
OnSiren OnSirenHandler
OnSwitch OnSwitchHandler
OnText OnTextHandler
OnUpdate OnUpdateHandler
OnVacuum OnVacuumHandler
OnWaterHeater OnWaterHeaterHandler
OnWeather OnWeatherHandler
}
func (*OnTypeHandlers) Run ¶
func (o *OnTypeHandlers) Run(message *Message) bool
func (*OnTypeHandlers) RunStates ¶
func (o *OnTypeHandlers) RunStates(message *Message)
type OnUpdateHandler ¶
type OnVacuumHandler ¶
type OnWaterHeaterHandler ¶
type OnWaterHeaterHandler func(message *Message, newAttrs, oldAttrs *entities.WaterHeater)
type OnWeatherHandler ¶
type Result ¶
type Result struct {
EntityId *string `json:"entity_id,omitempty"`
EntityState *string `json:"state,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
LastChanged *time.Time `json:"last_changed,omitempty"`
LastUpdated *time.Time `json:"last_updated,omitempty"`
Context *Context `json:"context,omitempty"`
AreaId *string `json:"area_id"`
ConfigEntryId *string `json:"config_entry_id"`
DeviceId *string `json:"device_id"`
DisabledBy *string `json:"disabled_by"`
EntityCategory *string `json:"entity_category"`
HasEntityName bool `json:"has_entity_name"`
HiddenBy interface{} `json:"hidden_by"`
Icon *string `json:"icon"`
Id string `json:"id"`
Name *string `json:"name"`
Options struct {
SensorPrivate struct {
SuggestedUnitOfMeasurement string `json:"suggested_unit_of_measurement"`
} `json:"sensor.private,omitempty"`
} `json:"options"`
OriginalName *string `json:"original_name"`
Platform string `json:"platform"`
TranslationKey *string `json:"translation_key"`
UniqueId string `json:"unique_id"`
ConfigurationUrl *string `json:"configuration_url"`
ConfigEntries []string `json:"config_entries"`
Connections [][]string `json:"connections"`
EntryType *string `json:"entry_type"`
HwVersion *string `json:"hw_version"`
Identifiers [][]interface{} `json:"identifiers"`
Manufacturer *string `json:"manufacturer"`
Model *string `json:"model"`
NameByUser *string `json:"name_by_user"`
SwVersion *string `json:"sw_version"`
ViaDeviceId *string `json:"via_device_id"`
}
func (*Result) DomainEntity ¶
type State ¶
type State struct {
EntityId *string `json:"entity_id,omitempty"`
LastChanged *time.Time `json:"last_changed,omitempty"`
State *string `json:"state,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"`
LastUpdated *time.Time `json:"last_updated,omitempty"`
Context *Context `json:"context,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.