entities

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MPL-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ButtonEntity

type ButtonEntity struct {
	Entity
	Commands map[ButtonEntityCommand]func(ButtonEntity) int `json:"-"`
}

func NewButtonEntity

func NewButtonEntity(id string, name LanguageText, area string) *ButtonEntity

func (*ButtonEntity) AddCommand

func (e *ButtonEntity) AddCommand(command ButtonEntityCommand, function func(ButtonEntity) int)

Register a function for the Entity command

func (*ButtonEntity) AddFeature

func (e *ButtonEntity) AddFeature(feature ButtonEntityFeatures)

Add a feature to this Button

func (*ButtonEntity) HandleCommand

func (e *ButtonEntity) HandleCommand(cmd_id string) int

Call the registred function for this entity_command

func (*ButtonEntity) MapCommand

func (e *ButtonEntity) MapCommand(command ButtonEntityCommand, f func() error)

Map a Light EntityCommand to a function call without params

func (*ButtonEntity) UpdateEntity

func (e *ButtonEntity) UpdateEntity(newEntity ButtonEntity) error

type ButtonEntityAttribute

type ButtonEntityAttribute EntityAttribute
const (
	StateEntityAttribute ButtonEntityAttribute = "state"
)

type ButtonEntityCommand

type ButtonEntityCommand EntityCommand
const (
	PushButtonEntityCommand ButtonEntityCommand = "push"
)

type ButtonEntityFeatures

type ButtonEntityFeatures EntityFeature
const (
	PressButtonEntityFeatures ButtonEntityFeatures = "press"
)

type ButtonEntityState

type ButtonEntityState EntityState

type ClimateEntity

type ClimateEntity struct {
	Entity
	Commands map[ClimateEntityCommand]func(ClimateEntity, map[string]interface{}) int `json:"-"`
}

func NewClimateEntity

func NewClimateEntity(id string, name LanguageText, area string) *ClimateEntity

func (*ClimateEntity) AddCommand

func (e *ClimateEntity) AddCommand(command ClimateEntityCommand, function func(ClimateEntity, map[string]interface{}) int)

Register a function for the Entity command

func (*ClimateEntity) AddFeature

func (e *ClimateEntity) AddFeature(feature ClimateEntityFeatures)

Add a Feature to this Climat Entity Based on the Feature, the correct Attributes will be added

func (*ClimateEntity) HandleCommand

func (e *ClimateEntity) HandleCommand(cmd_id string, params map[string]interface{}) int

Call the registred function for this entity_command

func (*ClimateEntity) UpdateEntity

func (e *ClimateEntity) UpdateEntity(newEntity ClimateEntity) error

type ClimateEntityAttributes

type ClimateEntityAttributes EntityAttribute
const (
	StateClimateEntityAttribute                 ClimateEntityAttributes = "state"
	CurrentTemperatureClimateEntityAttribute    ClimateEntityAttributes = "current_temperature"
	TargetTemperatureClimateEntityAttribute     ClimateEntityAttributes = "target_temperature"
	TargetTemperatureHighClimateEntityAttribute ClimateEntityAttributes = "target_temperature_high"
	TargetTemperatureLowClimateEntityAttribute  ClimateEntityAttributes = "target_temperature_low"
	FanModeClimateEntityAttribute               ClimateEntityAttributes = " fan_mode"
)

type ClimateEntityCommand

type ClimateEntityCommand EntityCommand
const (
	OnClimateEntityCommand                     ClimateEntityCommand = "on"
	OffClimateEntityCommand                    ClimateEntityCommand = "off"
	HVACModeClimateEntityCommand               ClimateEntityCommand = "hvac_mode"
	TargetTemperatureClimateEntityCommand      ClimateEntityCommand = "target_temperature"
	TargetTemperatureRangeClimateEntityCommand ClimateEntityCommand = "target_temperature_range"
	FanModeClimateEntityCommand                ClimateEntityCommand = "fan_mode"
)

type ClimateEntityFeatures

type ClimateEntityFeatures EntityFeature
const (
	OnOffClimateEntityFeatures                 ClimateEntityFeatures = "on_off"
	HeatClimateEntityFeatures                  ClimateEntityFeatures = "heat"
	CoolClimateEntityFeatures                  ClimateEntityFeatures = "cool"
	CurrentTemperatureClimateEntityFeatures    ClimateEntityFeatures = "current_temperature"
	TargetTemperaturClimateEntityFeatures      ClimateEntityFeatures = "target_temperatur"
	TargetTemperaturRangeClimateEntityFeatures ClimateEntityFeatures = "target_temperature_range"
	FanClimateEntityFeatures                   ClimateEntityFeatures = "fan"
)

type ClimateEntityState

type ClimateEntityState EntityState
const (
	OffClimateEntityState      ClimateEntityState = "OFF"
	HeatClimateEntityState     ClimateEntityState = "HEAT"
	CoolClimateEntityState     ClimateEntityState = "Cool"
	HeatCoolClimateEntityState ClimateEntityState = "HEAT_COOL"
	FanClimateEntityState      ClimateEntityState = "FAN"
	AutoClimateEntityStat      ClimateEntityState = "Auto"
)

type CommonEvent

type CommonEvent struct {
	Kind string `json:"kind"`
	Msg  string `json:"msg"`
	Cat  string `json:"cat"`
	Ts   string `json:"ts,omitempty"`
}

type CommonReq

type CommonReq struct {
	Kind string `json:"kind"`
	Id   int    `json:"id"`
	Msg  string `json:"msg"`
}

Common

type CommonResp

type CommonResp struct {
	Kind string `json:"kind"`
	Id   int    `json:"id"`
	Msg  string `json:"msg"`
	Code int    `json:"code"`
}

type CoverEntity

type CoverEntity struct {
	Entity
	Commands map[CoverEntityCommand]func(CoverEntity, map[string]interface{}) int `json:"-"`
}

func NewCoverEntity

func NewCoverEntity(id string, name LanguageText, area string) *CoverEntity

func (*CoverEntity) AddCommand

func (e *CoverEntity) AddCommand(command CoverEntityCommand, function func(CoverEntity, map[string]interface{}) int)

Register a function for the Entity command

func (*CoverEntity) AddFeature

func (e *CoverEntity) AddFeature(feature CoverEntityFeatures)

Register a function for the Entity command Based on the Feature, the correct Attributes will be added

func (*CoverEntity) HandleCommand

func (e *CoverEntity) HandleCommand(cmd_id string, params map[string]interface{}) int

Call the registred function for this entity_command

func (*CoverEntity) UpdateEntity

func (e *CoverEntity) UpdateEntity(newEntity CoverEntity) error

type CoverEntityAttributes

type CoverEntityAttributes EntityAttribute
const (
	StateCoverEntityAttribute        CoverEntityAttributes = "state"
	PositionCoverEntityAttribute     CoverEntityAttributes = "position"
	TiltPositionCoverEntityAttribute CoverEntityAttributes = "tilt_position"
)

type CoverEntityCommand

type CoverEntityCommand EntityCommand
const (
	OpenCoverEntityCommand     CoverEntityCommand = "open"
	CloseCoverEntityCommand    CoverEntityCommand = "close"
	StopCoverEntityyommand     CoverEntityCommand = "stop"
	PositionCoverEntityCommand CoverEntityCommand = "position"
	TiltCoverEntityCommand     CoverEntityCommand = "tilt"
	TiltUpCoverEntityCommand   CoverEntityCommand = "tilt_up"
	TiltDownCoverEntityCommand CoverEntityCommand = "tilt_down"
	TiltStopCoverEntityCommand CoverEntityCommand = "tilt_stop"
)

type CoverEntityFeatures

type CoverEntityFeatures EntityFeature
const (
	OpenCoverEntityFeatures         CoverEntityFeatures = "open"
	CloseCoverEntityFeatures        CoverEntityFeatures = "close"
	StopCoverEntityFeatures         CoverEntityFeatures = "stop"
	PositionCoverEntityFeatures     CoverEntityFeatures = "position"
	TiltCoverEntityFeatures         CoverEntityFeatures = "tilt"
	TiltStopCoverEntityFeatures     CoverEntityFeatures = "tilt_stop"
	TiltPositionCoverEntityFeatures CoverEntityFeatures = "tilt_position"
)

type CoverEntityState

type CoverEntityState EntityState
const (
	OpeningCoverEntityState CoverEntityState = "OPENING"
	OpenCoverEntityState    CoverEntityState = "OPEN"
	ClosingCoverEntityState CoverEntityState = "CLOSING"
	CloseCoverEntityState   CoverEntityState = "CLOSED"
)

type Entity

type Entity struct {
	Id string `json:"entity_id"`
	EntityType
	DeviceId    string                 `json:"device_id,omitempty"`
	Features    []interface{}          `json:"features"`
	Name        LanguageText           `json:"name"`
	Area        string                 `json:"area,omitempty"`
	DeviceClass string                 `json:"-"`
	Attributes  map[string]interface{} `json:"-"`

	SubscribeCallbackFunc   func() `json:"-"`
	UnsubscribeCallbackFunc func() `json:"-"`
	// contains filtered or unexported fields
}

Generic Remote Two Entity See https://github.com/unfoldedcircle/core-api/blob/main/doc/entities/README.md for details

func (*Entity) AddAttribute

func (e *Entity) AddAttribute(name string, value interface{})

Add an attribute if not already available

func (*Entity) GetAttribute

func (e *Entity) GetAttribute() map[string]interface{}

func (*Entity) GetEntityState

func (e *Entity) GetEntityState() *EntityStateData

Retun the Entity State fr this entity

func (*Entity) HasFeature

func (e *Entity) HasFeature(feature interface{}) bool

func (*Entity) SetAttribute added in v0.2.0

func (e *Entity) SetAttribute(attribute MediaPlayerEntityAttributes, value interface{})

Set one attribute for the Entity

func (*Entity) SetAttributes

func (e *Entity) SetAttributes(attributes map[string]interface{})

Set attributes for the Entity and then call the EntityChange Function

func (*Entity) SetHandleEntityChangeFunc

func (e *Entity) SetHandleEntityChangeFunc(f func(interface{}, *map[string]interface{}))

Register the function that is called when a Attribute change This normally is set by the integration when the entity is added To send entity_change events to Remote two

func (*Entity) SetSubscribeCallbackFunc added in v0.1.7

func (e *Entity) SetSubscribeCallbackFunc(f func())

Set the function that is called when RT subscribes to this entity

func (*Entity) SetUnsubscribeCallbackFunc added in v0.1.7

func (e *Entity) SetUnsubscribeCallbackFunc(f func())

Set the function that is called when RT unsubscribes to this entity

type EntityAttribute added in v0.3.4

type EntityAttribute string

type EntityCommand added in v0.3.4

type EntityCommand string

type EntityCommandData

type EntityCommandData struct {
	DeviceId string      `json:"device_id"`
	EntityId string      `json:"entity_id"`
	CmdId    string      `json:"cmd_id"`
	Params   interface{} `json:"params"`
}

type EntityCommandReq

type EntityCommandReq struct {
	CommonReq
	MsgData EntityCommandData `json:"msg_data,omitempty"`
}

type EntityCommandResponse

type EntityCommandResponse struct {
	CommonResp
}

type EntityFeature added in v0.3.4

type EntityFeature string

type EntityOption added in v0.3.4

type EntityOption string

type EntityState

type EntityState string
const (
	UnavailableEntityState EntityState = "UNAVAILABLE"
	UnkownEntityState      EntityState = "UNKNOWN"
)
const (
	AvailableButtonEntityState EntityState = "AVAILABLE"
)

type EntityStateData

type EntityStateData struct {
	DeviceId string `json:"device_id,omitempty"`
	EntityType
	EntityId   string                 `json:"entity_id"`
	Attributes map[string]interface{} `json:"attributes"`
}

type EntityType

type EntityType struct {
	Type string `json:"entity_type,omitempty"`
}

type LanguageText

type LanguageText struct {
	En string `json:"en"`
	De string `json:"de"`
}

type LightEntity

type LightEntity struct {
	Entity
	Commands map[LightEntityCommand]func(LightEntity, map[string]interface{}) int `json:"-"`
}

func NewLightEntity

func NewLightEntity(id string, name LanguageText, area string) *LightEntity

func (*LightEntity) AddCommand

func (e *LightEntity) AddCommand(command LightEntityCommand, function func(LightEntity, map[string]interface{}) int)

Register a function for the Entity command

func (*LightEntity) AddFeature

func (e *LightEntity) AddFeature(feature LightEntityFeatures)

Register a function for the Entity command Based on the Feature, the correct Attributes will be added

func (*LightEntity) HandleCommand

func (e *LightEntity) HandleCommand(cmd_id string, params map[string]interface{}) int

Call the registred function for this entity_command

func (*LightEntity) HasAttribute

func (e *LightEntity) HasAttribute(attribute LightEntityAttributes) bool

Check if an Attribute is available

func (*LightEntity) MapCommand

func (e *LightEntity) MapCommand(command LightEntityCommand, f func() error)

Map a Light EntityCommand to a function call without params

func (*LightEntity) MapCommandWithParams

func (e *LightEntity) MapCommandWithParams(command LightEntityCommand, f func(map[string]interface{}) error)

Map a Light EntityCommand to a function call with params

func (*LightEntity) UpdateAttribute

func (e *LightEntity) UpdateAttribute(attribute LightEntityAttributes, value interface{})

Update an Attribute if its available

func (*LightEntity) UpdateEntity

func (e *LightEntity) UpdateEntity(newEntity LightEntity) error

type LightEntityAttributes

type LightEntityAttributes EntityAttribute
const (
	StateLightEntityAttribute            LightEntityAttributes = "state"
	HueLightEntityAttribute              LightEntityAttributes = "hue"
	SaturationLightEntityAttribute       LightEntityAttributes = "saturation"
	BrightnessLightEntityAttribute       LightEntityAttributes = "brightness"
	ColorTemperatureLightEntityAttribute LightEntityAttributes = "color_temperature"
)

type LightEntityCommand

type LightEntityCommand EntityCommand
const (
	OnLightEntityCommand     LightEntityCommand = "on"
	OffLightEntityCommand    LightEntityCommand = "off"
	ToggleLightEntityCommand LightEntityCommand = "toggle"
)

type LightEntityFeatures

type LightEntityFeatures EntityFeature
const (
	OnOffLightEntityFeatures            LightEntityFeatures = "on_off"
	ToggleLightEntityFeatures           LightEntityFeatures = "toggle"
	DimLightEntityFeatures              LightEntityFeatures = "dim"
	ColorLightEntityFeatures            LightEntityFeatures = "color"
	ColorTemperatureLightEntityFeatures LightEntityFeatures = "color_temperature"
)

type LightEntityState

type LightEntityState EntityState
const (
	OnLightEntityState          LightEntityState = "ON"
	OffLightEntityState         LightEntityState = "OFF"
	UnavailableLightEntityState LightEntityState = "UNAVAILABLE"
	UnknownLightEntityState     LightEntityState = "UNKNOWN"
)

type MediaPlayerDeviceClass

type MediaPlayerDeviceClass string
const (
	ReceiverMediaPlayerDeviceClass      MediaPlayerDeviceClass = "receiver"
	SetTopBoxMediaPlayerDeviceClass     MediaPlayerDeviceClass = "set_top_box"
	SpeakerMediaPlayerDeviceClass       MediaPlayerDeviceClass = "speaker"
	StreamingBoxMMediaPlayerDeviceClass MediaPlayerDeviceClass = "streaming_box"
	TVMediaPlayerDeviceClass            MediaPlayerDeviceClass = "tv"
)

type MediaPlayerEntity

type MediaPlayerEntity struct {
	Entity
	DeviceClass MediaPlayerDeviceClass
	Commands    map[MediaPlayerEntityCommand]func(MediaPlayerEntity, map[string]interface{}) int `json:"-"`
	Options     map[MediaPlayerEntityOption]interface{}                                          `json:"options"`
}

func NewMediaPlayerEntity

func NewMediaPlayerEntity(id string, name LanguageText, area string, deviceClass MediaPlayerDeviceClass) *MediaPlayerEntity

func (*MediaPlayerEntity) AddCommand

func (e *MediaPlayerEntity) AddCommand(command MediaPlayerEntityCommand, function func(MediaPlayerEntity, map[string]interface{}) int)

Register a function for the Entity command

func (*MediaPlayerEntity) AddFeature

func (e *MediaPlayerEntity) AddFeature(feature MediaPlayerEntityFeatures)

Register a function for the Entity command Based on the Feature, the correct Attributes will be added

func (*MediaPlayerEntity) AddOption added in v0.3.3

func (e *MediaPlayerEntity) AddOption(option MediaPlayerEntityOption, value interface{})

Add an option to the MediaPlayer Entity

func (*MediaPlayerEntity) HandleCommand

func (e *MediaPlayerEntity) HandleCommand(cmd_id string, params map[string]interface{}) int

Call the registred function for this entity_command

func (*MediaPlayerEntity) MapCommand

func (e *MediaPlayerEntity) MapCommand(command MediaPlayerEntityCommand, f func() error)

Map a Light EntityCommand to a function call without params

func (*MediaPlayerEntity) MapCommandWithParams

func (e *MediaPlayerEntity) MapCommandWithParams(command MediaPlayerEntityCommand, f func(map[string]interface{}) error)

Map a Light EntityCommand to a function call with params

func (*MediaPlayerEntity) UpdateEntity

func (e *MediaPlayerEntity) UpdateEntity(newEntity MediaPlayerEntity) error

type MediaPlayerEntityAttributes

type MediaPlayerEntityAttributes EntityAttribute
const (
	StateMediaPlayerEntityAttribute         MediaPlayerEntityAttributes = "state"
	VolumeMediaPlayerEntityAttribute        MediaPlayerEntityAttributes = "volume"
	MutedMediaPlayeEntityAttribute          MediaPlayerEntityAttributes = "muted"
	MediaDurationMediaPlayerEntityAttribute MediaPlayerEntityAttributes = "media_duration"
	MediaPositionMediaPlayerEntityAttribute MediaPlayerEntityAttributes = "media_position"
	MediaTypeMediaPlayerEntityAttribute     MediaPlayerEntityAttributes = "media_type"
	MediaImageUrlMediaPlayerEntityAttribute MediaPlayerEntityAttributes = "media_image_url"
	MediaTitleMediaPlayerEntityAttribute    MediaPlayerEntityAttributes = "media_title"
	MediaArtistMediaPlayerEntityAttribute   MediaPlayerEntityAttributes = "media_artist"
	MediaAlbumMediaPlayerEntityAttribute    MediaPlayerEntityAttributes = "media_album"
	RepeatMediaPlayerEntityAttribute        MediaPlayerEntityAttributes = "repeat"
	ShuffleMediaPlayerEntityAttribute       MediaPlayerEntityAttributes = "shuffle"
	SourceMediaPlayerEntityAttribute        MediaPlayerEntityAttributes = "source"
	SourceListMediaPlayerEntityAttribute    MediaPlayerEntityAttributes = "source_list"
	SoundModeMediaPlayerEntityAttribute     MediaPlayerEntityAttributes = "sound_mode"
	SoundModeListMediaPlayerEntityAttribute MediaPlayerEntityAttributes = "sound_mode_list"
)

type MediaPlayerEntityCommand

type MediaPlayerEntityCommand EntityCommand
const (
	OnMediaPlayerEntityCommand               MediaPlayerEntityCommand = "on"
	OffMediaPlayerEntityCommand              MediaPlayerEntityCommand = "off"
	ToggleMediaPlayerEntityCommand           MediaPlayerEntityCommand = "toggle"
	PlayPauseMediaPlayerEntityCommand        MediaPlayerEntityCommand = "play_pause"
	StopMediaPlayerEntityCommand             MediaPlayerEntityCommand = "stop"
	PreviusMediaPlayerEntityCommand          MediaPlayerEntityCommand = "previous"
	NextMediaPlayerEntityCommand             MediaPlayerEntityCommand = "next"
	FastForwardMediaPlayerEntityCommand      MediaPlayerEntityCommand = "fast_forward"
	RewindMediaPlayerEntityCommand           MediaPlayerEntityCommand = "rewind"
	SeekMediaPlayerEntityCommand             MediaPlayerEntityCommand = "seek"
	VolumeMediaPlayerEntityCommand           MediaPlayerEntityCommand = "volume"
	VolumeUpMediaPlayerEntityCommand         MediaPlayerEntityCommand = "volume_up"
	VolumeDownMediaPlayerEntityCommand       MediaPlayerEntityCommand = "volume_down"
	MuteToggleMediaPlayerEntityCommand       MediaPlayerEntityCommand = "mute_toggle"
	MuteMediaPlayerEntityCommand             MediaPlayerEntityCommand = "mute"
	UnmuteMediaPlayerEntityCommand           MediaPlayerEntityCommand = "unmute"
	RepeatMediaPlayerEntityCommand           MediaPlayerEntityCommand = "repeat"
	ShuffleMediaPlayerEntityCommand          MediaPlayerEntityCommand = "shuffle"
	ChannelUpMediaPlayerEntityCommand        MediaPlayerEntityCommand = "channel_up"
	ChannelDownMediaPlayerEntityCommand      MediaPlayerEntityCommand = "channel_down"
	CursorUpMediaPlayerEntityCommand         MediaPlayerEntityCommand = "cursor_up"
	CursorDownMediaPlayerEntityCommand       MediaPlayerEntityCommand = "cursor_down"
	CursorLeftMediaPlayerEntityCommand       MediaPlayerEntityCommand = "cursor_left"
	CursorRightMediaPlayerEntityCommand      MediaPlayerEntityCommand = "cursor_right"
	CursorEnterMediaPlayerEntityCommand      MediaPlayerEntityCommand = "cursor_enter"
	Digit0MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_0"
	Digit1MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_1"
	Digit2MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_2"
	Digit3MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_3"
	Digit4MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_4"
	Digit5MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_5"
	Digit6MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_6"
	Digit7MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_7"
	Digit8MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_8"
	Digit9MediaPlayerEntityCommand           MediaPlayerEntityCommand = "digit_9"
	FunctionRedMediaPlayerEntityCommand      MediaPlayerEntityCommand = "function_red"
	FunctionGreenMediaPlayerEntityCommand    MediaPlayerEntityCommand = "function_green"
	FunctionYellowMediaPlayerEntityCommand   MediaPlayerEntityCommand = "function_yellow"
	FunctionBlueMediaPlayerEntityCommand     MediaPlayerEntityCommand = "function_blue"
	HomeMediaPlayerEntityCommand             MediaPlayerEntityCommand = "home"
	MenuMediaPlayerEntityCommand             MediaPlayerEntityCommand = "menu"
	ContextMenuMediaPlayerEntityCommand      MediaPlayerEntityCommand = "context_menu"
	GuideMediaPlayerEntityCommand            MediaPlayerEntityCommand = "guide"
	InfoMediaPlayerEntityCommand             MediaPlayerEntityCommand = "info"
	BackMediaPlayerEntityCommand             MediaPlayerEntityCommand = "back"
	SelectSourcMediaPlayerEntityCommand      MediaPlayerEntityCommand = "select_source"
	SelectSoundModeMediaPlayerEntityCommand  MediaPlayerEntityCommand = "select_sound_mode"
	RecordMediaPlayerEntityCommand           MediaPlayerEntityCommand = "record"
	MyRecordingsMenuMediaPlayerEntityCommand MediaPlayerEntityCommand = "my_recordings"
	LiveMediaPlayerEntityCommand             MediaPlayerEntityCommand = "live"
	EjectMediaPlayerEntityCommand            MediaPlayerEntityCommand = "eject"
	OpenCloseMediaPlayerEntityCommand        MediaPlayerEntityCommand = "open_close"
	AudioTrackMediaPlayerEntityCommand       MediaPlayerEntityCommand = "audio_track"
	SubtitleMediaPlayerEntityCommand         MediaPlayerEntityCommand = "subtitle"
	SettingsMediaPlayerEntityCommand         MediaPlayerEntityCommand = "settings"
	SearchMediaPlayerEntityCommand           MediaPlayerEntityCommand = "search"
)

type MediaPlayerEntityFeatures

type MediaPlayerEntityFeatures EntityFeature
const (
	OnOffMediaPlayerEntityFeatures           MediaPlayerEntityFeatures = "on_off"
	ToggleMediaPlayerEntityyFeatures         MediaPlayerEntityFeatures = "toggle"
	VolumeMediaPlayerEntityyFeatures         MediaPlayerEntityFeatures = "volume"
	VolumeUpDownMediaPlayerEntityFeatures    MediaPlayerEntityFeatures = "volume_up_down"
	MuteToggleMediaPlayerEntityFeatures      MediaPlayerEntityFeatures = "mute_toggle"
	MuteMediaPlayerEntityFeatures            MediaPlayerEntityFeatures = "mute"
	UnmuteMediaPlayerEntityFeatures          MediaPlayerEntityFeatures = "unmtue"
	PlayPauseMediaPlayerEntityFeatures       MediaPlayerEntityFeatures = "play_pause"
	StopMediaPlayerEntityFeatures            MediaPlayerEntityFeatures = "stop"
	NextMediaPlayerEntityFeatures            MediaPlayerEntityFeatures = "next"
	PreviusMediaPlayerEntityFeatures         MediaPlayerEntityFeatures = "previous"
	FastForwardMediaPlayerEntityFeatures     MediaPlayerEntityFeatures = "fast_forward"
	RewindMediaPlayerEntityFeatures          MediaPlayerEntityFeatures = "rewind"
	RepeatMediaPlayerEntityFeatures          MediaPlayerEntityFeatures = "repeat"
	ShuffleMediaPlayerEntityFeatures         MediaPlayerEntityFeatures = "shuffle"
	SeekMediaPlayerEntityFeatures            MediaPlayerEntityFeatures = "seek"
	MediaDurationMediaPlayerEntityFeatures   MediaPlayerEntityFeatures = "media_duration"
	MediaPositionMediaPlayerEntityFeatures   MediaPlayerEntityFeatures = "media_position"
	MediaTitleMediaPlayerEntityFeatures      MediaPlayerEntityFeatures = "media_title"
	MediaArtistMediaPlayerEntityFeatures     MediaPlayerEntityFeatures = "media_artist"
	MediaAlbumMediaPlayerEntityFeatures      MediaPlayerEntityFeatures = "media_album"
	MediaImageUrlMediaPlayerEntityFeatures   MediaPlayerEntityFeatures = "media_image_url"
	MediaTypeMediaPlayerEntityFeatures       MediaPlayerEntityFeatures = "media_type"
	DPadMediaPlayerEntityFeatures            MediaPlayerEntityFeatures = "dpad"
	NumPadMediaPlayerEntityFeatures          MediaPlayerEntityFeatures = "numpad"
	HomeMediaPlayerEntityFeatures            MediaPlayerEntityFeatures = "home"
	MenuMediaPlayerEntityFeatures            MediaPlayerEntityFeatures = "menu"
	ContextMenuPlayerEntityFeatures          MediaPlayerEntityFeatures = "context_menu"
	GuidePlayerEntityFeatures                MediaPlayerEntityFeatures = "guide"
	InfoPlayerEntityFeatures                 MediaPlayerEntityFeatures = "info"
	ColorButtonsMediaPlayerEntityFeatures    MediaPlayerEntityFeatures = "color_buttons"
	ChannelSwitcherMediaPlayerEntityFeatures MediaPlayerEntityFeatures = "channel_switcher"
	SelectSourceMediaPlayerEntityFeatures    MediaPlayerEntityFeatures = "select_source"
	SelectSoundModeMediaPlayerEntityFeatures MediaPlayerEntityFeatures = "select_sound_mode"
	EjectMediaPlayerEntityFeatures           MediaPlayerEntityFeatures = "eject"
	OpenCloseMediaPlayerEntityFeatures       MediaPlayerEntityFeatures = "open_close"
	AudioTrackMediaPlayerEntityFeatures      MediaPlayerEntityFeatures = "audio_track"
	SubtitleMediaPlayerEntityFeatures        MediaPlayerEntityFeatures = "subtitle"
	RecordMediaPlayerEntityFeatures          MediaPlayerEntityFeatures = "record"
	SettingsMediaPlayerEntityFeatures        MediaPlayerEntityFeatures = "settings"
)

type MediaPlayerEntityOption added in v0.3.3

type MediaPlayerEntityOption EntityOption
const (
	SimpleCommandsMediaPlayerEntityOption MediaPlayerEntityOption = "simple_commands"
	VolumeStepsMediaPlayerEntityOption    MediaPlayerEntityOption = "volume_steps"
)

type MediaPlayerEntityState

type MediaPlayerEntityState EntityState
const (
	OnMediaPlayerEntityState        MediaPlayerEntityState = "ON"
	OffMediaPlayerEntityState       MediaPlayerEntityState = "OFF"
	PlayingPlayerEntityState        MediaPlayerEntityState = "PLAYING"
	PausedMediaPlayerEntityState    MediaPlayerEntityState = "PAUSED"
	StandbyMediaPlayerEntityState   MediaPlayerEntityState = "STANDBY"
	BufferingMediaPlayerEntityState MediaPlayerEntityState = "BUFFERING"
)

type RemoteEntity added in v0.3.4

type RemoteEntity struct {
	Entity
	Commands map[RemoteEntityCommand]func(RemoteEntity, map[string]interface{}) int `json:"-"`
	Options  map[RemoteEntityOption]interface{}                                     `json:"options"`
}

func NewRemoteEntity added in v0.3.4

func NewRemoteEntity(id string, name LanguageText, area string) *RemoteEntity

func (*RemoteEntity) AddCommand added in v0.3.4

func (e *RemoteEntity) AddCommand(command RemoteEntityCommand, function func(RemoteEntity, map[string]interface{}) int)

Register a function for the Entity command

func (RemoteEntity) AddFeature added in v0.3.4

func (e RemoteEntity) AddFeature(feature RemoteEntityFeatures)

Register a function for the Entity command Based on the Feature, the correct Attributes will be added

func (*RemoteEntity) AddOption added in v0.3.4

func (e *RemoteEntity) AddOption(option RemoteEntityOption, value interface{})

Add an option to the Remote Entity

func (*RemoteEntity) HandleCommand added in v0.3.4

func (e *RemoteEntity) HandleCommand(cmd_id string, params map[string]interface{}) int

Call the registred function for this entity_command

func (*RemoteEntity) HasAttribute added in v0.3.4

func (e *RemoteEntity) HasAttribute(attribute RemoteEntityAttributes) bool

Check if an Attribute is available

func (*RemoteEntity) UpdateAttribute added in v0.3.4

func (e *RemoteEntity) UpdateAttribute(attribute RemoteEntityAttributes, value interface{})

Update an Attribute if its available

func (*RemoteEntity) UpdateEntity added in v0.3.4

func (e *RemoteEntity) UpdateEntity(newEntity RemoteEntity) error

type RemoteEntityAttributes added in v0.3.4

type RemoteEntityAttributes EntityAttribute
const (
	StateRemoteEntityAttribute RemoteEntityAttributes = "state"
)

type RemoteEntityCommand added in v0.3.4

type RemoteEntityCommand EntityCommand
const (
	OnRemoteEntityCommand              RemoteEntityCommand = "on"
	OffRemoteEntityCommand             RemoteEntityCommand = "off"
	SendCmdRemoteEntityCommand         RemoteEntityCommand = "send_cmd"
	SendCmdSequenceRemoteEntityCommand RemoteEntityCommand = "send_cmd_sequence"
)

type RemoteEntityFeatures added in v0.3.4

type RemoteEntityFeatures EntityFeature
const (
	SendCmdRemoteEntityFeatures RemoteEntityFeatures = "send_cmd"
	OnOffRemoteEntityFeatures   RemoteEntityFeatures = "on_off"
	ToggleRemoteEntityFeatures  RemoteEntityFeatures = "toggle"
)

type RemoteEntityOption added in v0.3.4

type RemoteEntityOption EntityOption
const (
	SimpleCommandsRemoteEntityOption RemoteEntityOption = "simple_commands"
	ButtonMappingRemoteEntityOption  RemoteEntityOption = "button_mapping"
	UserInterfaceRemoteEntityOption  RemoteEntityOption = "user_interface"
)

type RemoteEntityState added in v0.3.4

type RemoteEntityState EntityState
const (
	OnRemoteEntityState  RemoteEntityState = "ON"
	OffRemoteEntityState RemoteEntityState = "OFF"
)

type SensorDeviceClass

type SensorDeviceClass string
const (
	CustomSensorDeviceClass     SensorDeviceClass = "custom"
	BatterySensorDeviceClass    SensorDeviceClass = "battery"
	CurrentSensorDeviceClass    SensorDeviceClass = "current"
	EnegrySensorDeviceClass     SensorDeviceClass = "energy"
	HumiditySensorDeviceClass   SensorDeviceClass = "humidity"
	PowerSensorDeviceClass      SensorDeviceClass = "power"
	TemperaturSensorDeviceClass SensorDeviceClass = "temperatur"
	VoltageSensorDeviceClass    SensorDeviceClass = "voltage"
)

type SensorEntity

type SensorEntity struct {
	Entity
	DeviceClass SensorDeviceClass
}

func NewSensorEntity

func NewSensorEntity(id string, name LanguageText, area string, deviceClass SensorDeviceClass) *SensorEntity

func (*SensorEntity) UpdateEntity

func (e *SensorEntity) UpdateEntity(newEntity SensorEntity) error

type SensorEntityAttributes

type SensorEntityAttributes EntityAttribute
const (
	StateSensorEntityyAttribute  SensorEntityAttributes = "state"
	ValueSensortEntityyAttribute SensorEntityAttributes = "value"
	UnitSSensorntityyAttribute   SensorEntityAttributes = "unit"
)

type SensorEntityCommand

type SensorEntityCommand EntityCommand

type SensorEntityFeatures

type SensorEntityFeatures EntityFeature

type SensorEntityState

type SensorEntityState EntityState
const (
	OnSensorEntityState SensorEntityState = "ON"
)

type SwitchEntityAttributes

type SwitchEntityAttributes EntityAttribute
const (
	StateSwitchEntityyAttribute SwitchEntityAttributes = "state"
)

type SwitchEntityCommand

type SwitchEntityCommand EntityCommand
const (
	OnSwitchEntityCommand     SwitchEntityCommand = "on"
	OffSwitchEntityCommand    SwitchEntityCommand = "off"
	ToggleSwitchEntityCommand SwitchEntityCommand = "toggle"
)

type SwitchEntityFeatures

type SwitchEntityFeatures EntityFeature
const (
	OnOffSwitchEntityyFeatures  SwitchEntityFeatures = "on_off"
	ToggleSwitchEntityyFeatures SwitchEntityFeatures = "toggle"
)

type SwitchEntityState

type SwitchEntityState EntityState
const (
	OnSwitchtEntityState  SwitchEntityState = "ON"
	OffSwitchtEntityState SwitchEntityState = "OFF"
)

type SwitchsEntity

type SwitchsEntity struct {
	Entity
	Commands map[SwitchEntityCommand]func(SwitchsEntity, map[string]interface{}) int `json:"-"`
}

func NewSwitchEntity

func NewSwitchEntity(id string, name LanguageText, area string) *SwitchsEntity

func (*SwitchsEntity) AddCommand

func (e *SwitchsEntity) AddCommand(command SwitchEntityCommand, function func(SwitchsEntity, map[string]interface{}) int)

Register a function for the Entity command

func (*SwitchsEntity) AddFeature

func (e *SwitchsEntity) AddFeature(feature SwitchEntityFeatures)

Register a function for the Entity command Based on the Feature, the correct Attributes will be added

func (*SwitchsEntity) HandleCommand

func (e *SwitchsEntity) HandleCommand(cmd_id string, params map[string]interface{}) int

Call the registred function for this entity_command

func (*SwitchsEntity) MapCommand

func (e *SwitchsEntity) MapCommand(command SwitchEntityCommand, f func() error)

func (*SwitchsEntity) MapCommandWithParams

func (e *SwitchsEntity) MapCommandWithParams(command SwitchEntityCommand, f func(map[string]interface{}) error)

func (*SwitchsEntity) UpdateEntity

func (e *SwitchsEntity) UpdateEntity(newEntity SwitchsEntity) error

Jump to

Keyboard shortcuts

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