Documentation ¶
Index ¶
- Constants
- func GetEventState(actor PluginActor) (eventState bus.EventEntityState)
- func NewEntity(a PluginActor) m.EntityShort
- func ToEntityActionShort(from map[string]ActorAction) (to map[string]m.EntityActionShort)
- func ToEntityStateShort(from map[string]ActorState) (to map[string]m.EntityStateShort)
- type ActorAction
- type ActorConstructor
- type ActorInfo
- type ActorState
- type BaseActor
- func (e *BaseActor) Attributes() m.Attributes
- func (e *BaseActor) DeserializeAttr(data m.AttributeValue)
- func (e *BaseActor) DeserializeSettings(settings m.AttributeValue)
- func (b *BaseActor) GetEventState(actor PluginActor) bus.EventEntityState
- func (e *BaseActor) Info() (info ActorInfo)
- func (e *BaseActor) Metrics() []*m.Metric
- func (e *BaseActor) Now(oldState bus.EventEntityState) time.Time
- func (e *BaseActor) SetMetric(id common.EntityId, name string, value map[string]float32)
- func (e *BaseActor) SetState(EntityStateParams) error
- func (e *BaseActor) Settings() m.Attributes
- type CrudActor
- type EntityBind
- func (e *EntityBind) CallAction(action string, arg map[string]interface{})
- func (e *EntityBind) GetAttributes() m.AttributeValue
- func (e *EntityBind) GetSettings() m.AttributeValue
- func (e *EntityBind) SetAttributes(params m.AttributeValue)
- func (e *EntityBind) SetMetric(name string, value map[string]float32)
- func (e *EntityBind) SetState(stateName string)
- type EntityManager
- type EntityManagerBind
- func (e *EntityManagerBind) CallAction(id common.EntityId, action string, arg map[string]interface{})
- func (e *EntityManagerBind) CallScene(id common.EntityId, arg map[string]interface{})
- func (e *EntityManagerBind) GetEntity(id common.EntityId) *EntityBind
- func (e *EntityManagerBind) SetAttribute(id common.EntityId, params m.AttributeValue)
- func (e *EntityManagerBind) SetMetric(id common.EntityId, name string, value map[string]float32)
- func (e *EntityManagerBind) SetState(id common.EntityId, stateName string)
- type EntityStateParams
- type Message
- type MessageStateChanged
- type PluginActor
- type ScriptBind
Constants ¶
View Source
const ( // StateAwait ... StateAwait = "await" // StateOk ... StateOk = "ok" // StateError ... StateError = "error" // StateInProcess ... StateInProcess = "in process" )
Variables ¶
This section is empty.
Functions ¶
func GetEventState ¶
func GetEventState(actor PluginActor) (eventState bus.EventEntityState)
GetEventState ...
func ToEntityActionShort ¶
func ToEntityActionShort(from map[string]ActorAction) (to map[string]m.EntityActionShort)
ToEntityActionShort ...
func ToEntityStateShort ¶
func ToEntityStateShort(from map[string]ActorState) (to map[string]m.EntityStateShort)
ToEntityStateShort ...
Types ¶
type ActorAction ¶
type ActorAction struct { Name string `json:"name"` Description string `json:"description"` ImageUrl *string `json:"image_url"` Icon *string `json:"icon"` ScriptEngine *scripts.Engine `json:"-"` }
ActorAction ...
type ActorInfo ¶
type ActorInfo struct { Id common.EntityId `json:"id"` ParentId *common.EntityId `json:"parent_id"` PluginName string `json:"plugin_name"` Name string `json:"name"` Description string `json:"description"` Hidde bool `json:"hidde"` UnitOfMeasurement string `json:"unit_of_measurement"` LastChanged *time.Time `json:"last_changed"` LastUpdated *time.Time `json:"last_updated"` DependsOn []string `json:"depends_on"` State *ActorState `json:"state"` ImageUrl *string `json:"image_url"` Icon *string `json:"icon"` Area *m.Area `json:"area"` AutoLoad bool `json:"auto_load"` Value interface{} `json:"value"` States map[string]ActorState `json:"states"` Actions map[string]ActorAction `json:"actions"` }
ActorInfo ...
type ActorState ¶
type ActorState struct { Name string `json:"name"` Description string `json:"description"` ImageUrl *string `json:"image_url"` Icon *string `json:"icon"` }
ActorState ...
type BaseActor ¶
type BaseActor struct { PluginActor Id common.EntityId ParentId *common.EntityId Name string Description string EntityType string Manager EntityManager State *ActorState Area *m.Area Metric []*m.Metric Hidden bool AttrMu *sync.RWMutex Attrs m.Attributes Actions map[string]ActorAction States map[string]ActorState ScriptEngine *scripts.Engine Icon *string ImageUrl *string UnitOfMeasurement string Scripts []*m.Script Value *atomic.String AutoLoad bool LastChanged *time.Time LastUpdated *time.Time SettingsMu *sync.RWMutex Setts m.Attributes // contains filtered or unexported fields }
BaseActor ...
func NewBaseActor ¶
func NewBaseActor(entity *m.Entity, scriptService scripts.ScriptService, adaptors *adaptors.Adaptors) BaseActor
NewBaseActor ...
func (*BaseActor) DeserializeAttr ¶
func (e *BaseActor) DeserializeAttr(data m.AttributeValue)
DeserializeAttr ...
func (*BaseActor) DeserializeSettings ¶
func (e *BaseActor) DeserializeSettings(settings m.AttributeValue)
DeserializeSettings ...
func (*BaseActor) GetEventState ¶
func (b *BaseActor) GetEventState(actor PluginActor) bus.EventEntityState
GetEventState ...
type EntityBind ¶
type EntityBind struct { m.EntityShort // contains filtered or unexported fields }
EntityBind ...
func NewEntityBind ¶
func NewEntityBind(id common.EntityId, manager EntityManager) *EntityBind
NewEntityBind ...
func (*EntityBind) CallAction ¶
func (e *EntityBind) CallAction(action string, arg map[string]interface{})
CallAction ...
func (*EntityBind) GetAttributes ¶
func (e *EntityBind) GetAttributes() m.AttributeValue
GetAttributes ...
func (*EntityBind) GetSettings ¶ added in v0.6.0
func (e *EntityBind) GetSettings() m.AttributeValue
GetSettings ...
func (*EntityBind) SetAttributes ¶
func (e *EntityBind) SetAttributes(params m.AttributeValue)
SetAttributes ...
type EntityManager ¶
type EntityManager interface { // SetPluginManager ... SetPluginManager(pluginManager common.PluginManager) // LoadEntities ... LoadEntities() // Shutdown ... Shutdown() // SetMetric ... SetMetric(common.EntityId, string, map[string]float32) // SetState ... SetState(common.EntityId, EntityStateParams) error // GetEntityById ... GetEntityById(common.EntityId) (m.EntityShort, error) // GetActorById ... GetActorById(common.EntityId) (PluginActor, error) // List ... List() ([]m.EntityShort, error) // Spawn ... Spawn(ActorConstructor) PluginActor // Remove ... Remove(common.EntityId) // CallAction ... CallAction(common.EntityId, string, map[string]interface{}) // CallScene ... CallScene(common.EntityId, map[string]interface{}) // Add ... Add(*m.Entity) error // Update ... Update(*m.Entity) error }
EntityManager ...
func NewEntityManager ¶
func NewEntityManager(lc fx.Lifecycle, eventBus bus.Bus, adaptors *adaptors.Adaptors, scripts scripts.ScriptService) EntityManager
NewEntityManager ...
type EntityManagerBind ¶
type EntityManagerBind struct {
// contains filtered or unexported fields
}
EntityManagerBind ...
func NewEntityManagerBind ¶
func NewEntityManagerBind(manager EntityManager) *EntityManagerBind
NewEntityManagerBind ...
func (*EntityManagerBind) CallAction ¶
func (e *EntityManagerBind) CallAction(id common.EntityId, action string, arg map[string]interface{})
CallAction ...
func (*EntityManagerBind) CallScene ¶ added in v0.8.3
func (e *EntityManagerBind) CallScene(id common.EntityId, arg map[string]interface{})
CallScene ...
func (*EntityManagerBind) GetEntity ¶
func (e *EntityManagerBind) GetEntity(id common.EntityId) *EntityBind
GetEntity ...
func (*EntityManagerBind) SetAttribute ¶
func (e *EntityManagerBind) SetAttribute(id common.EntityId, params m.AttributeValue)
SetAttribute ...
type EntityStateParams ¶
type EntityStateParams struct { NewState *string `json:"new_state"` AttributeValues m.AttributeValue `json:"attribute_values"` SettingsValue m.AttributeValue `json:"settings_value"` StorageSave bool `json:"storage_save"` }
EntityStateParams -> entityManager
type MessageStateChanged ¶
type MessageStateChanged struct { StorageSave bool OldState bus.EventEntityState NewState bus.EventEntityState }
MessageStateChanged -> entityManager
type PluginActor ¶
type PluginActor interface { // Spawn ... Spawn() PluginActor // Attributes ... Attributes() m.Attributes // Settings ... Settings() m.Attributes // Metrics ... Metrics() []*m.Metric // SetState ... SetState(EntityStateParams) error // Info ... Info() ActorInfo }
PluginActor ...
type ScriptBind ¶
type ScriptBind struct {
// contains filtered or unexported fields
}
ScriptBind ...
func (*ScriptBind) GetSettings ¶ added in v0.9.4
func (s *ScriptBind) GetSettings() map[string]interface{}
GetSettings ...
func (*ScriptBind) SetAttribute ¶ added in v0.9.4
func (s *ScriptBind) SetAttribute(params m.AttributeValue)
SetAttribute ...
Click to show internal directories.
Click to hide internal directories.