Versions in this module Expand all Collapse all v0 v0.21.1 Nov 6, 2024 Changes in this version + type Authorization interface + AuthPlain func(login, pass string) (*m.User, error) + AuthREST func(ctx context.Context, accessToken string, requestURI *url.URL, method string) (*m.User, bool, error) + type HttpAccessFilter interface + Auth func(next http.Handler) http.Handler type Service + Authorization func() Authorization + HttpAccessFilter func() HttpAccessFilter v0.21.0 Oct 28, 2024 Changes in this version + const StateAwait + const StateError + const StateInProcess + const StateOk + func ToEntityActionShort(from map[string]ActorAction) (to map[string]models.EntityActionShort) + func ToEntityStateShort(from map[string]ActorState) (to map[string]models.EntityStateShort) + type ActorAction struct + Description string + Icon *string + ImageUrl *string + Name string + ScriptEngine scripts.EngineWatcher + type ActorConstructor func(*models.Entity) (PluginActor, error) + type ActorInfo struct + Actions map[string]ActorAction + Area *models.Area + AutoLoad bool + DependsOn []string + Description string + Hidde bool + Icon *string + Id common.EntityId + ImageUrl *string + LastChanged *time.Time + LastUpdated *time.Time + Name string + ParentId *common.EntityId + PluginName string + RestoreState bool + State *ActorState + States map[string]ActorState + UnitOfMeasurement string + Value interface{} + type ActorState struct + Description string + Icon *string + ImageUrl *string + Name string + func (a *ActorState) Copy() (state *ActorState) + type CallActionV2 struct + ActionName string + AreaId *int64 + EntityId *common.EntityId + Tags []string + type EntityStateParams struct + AttributeValues m.AttributeValue + NewState *string + SettingsValue m.AttributeValue + StorageSave bool + type Installable interface + Install func() error + Uninstall func() error + type Pluggable interface + AddOrUpdateActor func(*models.Entity) error + Depends func() []string + EntityIsLoaded func(id common.EntityId) bool + GetActor func(id common.EntityId) (pla PluginActor, err error) + Load func(context.Context, Service) error + Name func() string + Options func() models.PluginOptions + Readme func(*string, *string) ([]byte, error) + RemoveActor func(common.EntityId) error + Unload func(context.Context) error + Version func() string + type Plugin struct + Actors *sync.Map + F embed.FS + IsStarted *atomic.Bool + Service Service + func NewPlugin() *Plugin + func (p *Plugin) AddActor(pla PluginActor, entity *models.Entity) (err error) + func (p *Plugin) AddOrUpdateActor(entity *models.Entity) (err error) + func (p *Plugin) Check(msg events.EventCallEntityAction) (result []interface{}, ok bool) + func (p *Plugin) Depends() []string + func (p *Plugin) EntityIsLoaded(id pkgCommon.EntityId) bool + func (p *Plugin) GetActor(id pkgCommon.EntityId) (pla PluginActor, err error) + func (p *Plugin) Load(ctx context.Context, service Service, actorConstructor ActorConstructor) error + func (p *Plugin) LoadSettings(pl Pluggable) (settings models.Attributes, err error) + func (p *Plugin) Name() string + func (p *Plugin) Options() models.PluginOptions + func (p *Plugin) Readme(note, lang *string) (result []byte, err error) + func (p *Plugin) RemoveActor(entityId pkgCommon.EntityId) (err error) + func (p *Plugin) Unload(ctx context.Context) error + func (p *Plugin) Version() string + type PluginActor interface + AddMetric func(name string, value map[string]interface{}) + Area func() *models.Area + Attributes func() models.Attributes + CallScript func(fn string, arg ...interface{}) + Destroy func() + GetCurrentState func() *events.EventEntityState + GetEventState func() events.EventEntityState + GetOldState func() *events.EventEntityState + Info func() ActorInfo + MatchTags func(tags []string) bool + Metrics func() []*models.Metric + SetCurrentState func(events.EventEntityState) + SetState func(EntityStateParams) error + Settings func() models.Attributes + Spawn func() + StopWatchers func() + type PluginFileInfo struct + FileMode fs.FileMode + IsDir bool + MimeType string + ModTime time.Time + Name string + Size int64 + type PluginFileInfos []*PluginFileInfo + func (l PluginFileInfos) Len() int + func (l PluginFileInfos) Less(i, j int) bool + func (l PluginFileInfos) Swap(i, j int) + type PluginInfo struct + Enabled bool + Name string + System bool + Version string + type PluginManifest struct + Actor bool + Arch string + Assets []string + Description string + Libs []string + Name string + OS string + Plugin string + Repository string + Settings map[string]interface{} + Triggers bool + Version string + type Service interface + Adaptors func() *adaptors.Adaptors + AppConfig func() *models.AppConfig + Crawler func() web.Crawler + EventBus func() bus.Bus + MqttServ func() mqtt.MqttServ + Plugins func() map[string]Pluggable + Scheduler func() scheduler.Scheduler + ScriptService func() scripts.ScriptService + Supervisor func() Supervisor + type Supervisor interface + AddEntity func(*models.Entity) error + CallAction func(common.EntityId, string, map[string]interface{}) + CallActionV2 func(CallActionV2, map[string]interface{}) + CallScene func(common.EntityId, map[string]interface{}) + CallScript func(id common.EntityId, fn string, arg ...interface{}) + DisablePlugin func(context.Context, string) error + EnablePlugin func(context.Context, string) error + EntityIsLoaded func(id common.EntityId) bool + GetActorById func(common.EntityId) (PluginActor, error) + GetEntityById func(common.EntityId) (models.EntityShort, error) + GetPlugin func(name string) (interface{}, error) + GetPluginReadme func(context.Context, string, *string, *string) ([]byte, error) + GetService func() Service + PluginIsLoaded func(string) bool + PushSystemEvent func(strCommand string, params map[string]interface{}) + RemovePlugin func(ctx context.Context, pluginName string) error + Restart func(context.Context) error + SetMetric func(common.EntityId, string, map[string]interface{}) + SetState func(common.EntityId, EntityStateParams) error + Shutdown func(context.Context) error + Start func(context.Context) error + UnloadEntity func(common.EntityId) + UpdateEntity func(*models.Entity) error + UploadPlugin func(ctx context.Context, reader *bufio.Reader) (newFile *models.Plugin, err error)