diff --git a/static_source/admin/src/views/Dashboard/card_items/iframe/index.ts b/static_source/admin/src/views/Dashboard/card_items/iframe/index.ts
new file mode 100644
index 000000000..bdcd1fdb1
--- /dev/null
+++ b/static_source/admin/src/views/Dashboard/card_items/iframe/index.ts
@@ -0,0 +1,5 @@
+import IFrame from './src/index.vue';
+import IFrameEditor from './src/editor.vue';
+export * from './src/types';
+
+export {IFrame, IFrameEditor}
diff --git a/static_source/admin/src/views/Dashboard/card_items/iframe/src/editor.vue b/static_source/admin/src/views/Dashboard/card_items/iframe/src/editor.vue
new file mode 100644
index 000000000..ae17563fc
--- /dev/null
+++ b/static_source/admin/src/views/Dashboard/card_items/iframe/src/editor.vue
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+ {{ $t('dashboard.editor.iframeOptions') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('main.or') }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/static_source/admin/src/views/Dashboard/card_items/iframe/src/index.vue b/static_source/admin/src/views/Dashboard/card_items/iframe/src/index.vue
new file mode 100644
index 000000000..660fd85c6
--- /dev/null
+++ b/static_source/admin/src/views/Dashboard/card_items/iframe/src/index.vue
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
diff --git a/static_source/admin/src/views/Dashboard/card_items/iframe/src/types.ts b/static_source/admin/src/views/Dashboard/card_items/iframe/src/types.ts
new file mode 100644
index 000000000..c7fb0b49a
--- /dev/null
+++ b/static_source/admin/src/views/Dashboard/card_items/iframe/src/types.ts
@@ -0,0 +1,4 @@
+export interface ItemPayloadIFrame {
+ uri?: string;
+ attrField?: string;
+}
diff --git a/static_source/admin/src/views/Dashboard/card_items/index.ts b/static_source/admin/src/views/Dashboard/card_items/index.ts
index 88989ff4f..45e76603b 100644
--- a/static_source/admin/src/views/Dashboard/card_items/index.ts
+++ b/static_source/admin/src/views/Dashboard/card_items/index.ts
@@ -17,6 +17,7 @@ import {Icon, IconEditor, ItemPayloadIcon} from './icon';
import {Grid, GridEditor, ItemPayloadGrid} from './grid';
import {Three, ThreeEditor, ItemPayloadThree} from './three';
import {Modal, ModalEditor, ItemPayloadModal} from './modal';
+import {IFrame, IFrameEditor, ItemPayloadIFrame} from './iframe';
import {ItemPayloadJsonViewer, JsonViewer, JsonViewerEditor} from './json_viewer';
import {useI18n} from "@/hooks/web/useI18n";
@@ -61,6 +62,8 @@ export const CardItemName = (name: string): any => {
return JsonViewer;
case 'modal':
return Modal;
+ case 'iframe':
+ return IFrame;
default:
// console.error(`unknown card name "${name}"`);
return Dummy;
@@ -108,6 +111,8 @@ export const CardEditorName = (name: string): any => {
return JsonViewerEditor;
case 'modal':
return ModalEditor;
+ case 'iframe':
+ return IFrameEditor;
default:
// console.error(`unknown card name "${name}"`);
return DummyEditor;
@@ -143,6 +148,7 @@ export const CardItemList: ItemsType[] = [
{label: t('dashboard.editor.LOGS'), value: 'logs'},
{label: t('dashboard.editor.ENTITY_STORAGE'), value: 'entityStorage'},
{label: t('dashboard.editor.JSON_VIEWER'), value: 'jsonViewer'},
+ {label: t('dashboard.editor.IFRAME'), value: 'iframe'},
],
},
{
@@ -206,4 +212,5 @@ export interface ItemPayload {
three?: ItemPayloadThree;
jsonViewer?: ItemPayloadJsonViewer;
modal?: ItemPayloadModal;
+ iframe?: ItemPayloadIFrame;
}
diff --git a/static_source/admin/src/views/Dashboard/core/src/filters.ts b/static_source/admin/src/views/Dashboard/core/src/filters.ts
index 101303dee..04da55cfb 100644
--- a/static_source/admin/src/views/Dashboard/core/src/filters.ts
+++ b/static_source/admin/src/views/Dashboard/core/src/filters.ts
@@ -1,7 +1,6 @@
import {parseTime} from '@/utils';
-import api from "@/api/api";
-import {Cache} from "./cache";
-import {scriptService} from "@/views/Dashboard/core";
+import {RenderVar, Resolve, scriptService} from "@/views/Dashboard/core";
+import {EventStateChange} from "@/api/types";
export const ApplyFilter = async (value: any, filter: string): any => {
if (value == undefined || filter == undefined) {
@@ -37,6 +36,8 @@ export const ApplyFilter = async (value: any, filter: string): any => {
return camelCaseStringToTitleCase(value, ...args);
case 'toTitleCase':
return toTitleCase(value, ...args);
+ case 'render':
+ return render(value, ...args);
case 'script':
return await scriptService.evalScript(value, ...args);
default:
@@ -45,6 +46,14 @@ export const ApplyFilter = async (value: any, filter: string): any => {
}
}
+const render = (obj: any, ...args: string[]): string => {
+ let token = '';
+ if (args[0]) {
+ token = args[0];
+ }
+ return Resolve(token, JSON.parse(obj));
+}
+
//DEPRECATED
function secToTime(value: string, ...args: string[]): string {
const num = parseInt(value);
diff --git a/static_source/admin/src/views/Logs/index.vue b/static_source/admin/src/views/Logs/index.vue
index f142db94b..7ac465556 100644
--- a/static_source/admin/src/views/Logs/index.vue
+++ b/static_source/admin/src/views/Logs/index.vue
@@ -14,6 +14,7 @@ import {parseTime} from "@/utils";
import stream from "@/api/stream";
import {ContentWrap} from "@/components/ContentWrap";
import {useCache} from "@/hooks/web/useCache";
+import {ElCol, ElRow} from "element-plus";
const {register, elFormRef, methods} = useForm()
const {t} = useI18n()
@@ -333,15 +334,19 @@ getList()
-
+
+
+
+
+
([
componentProps: {
options: [
{
- label: 'web_push',
- value: 'web_push'
+ label: 'webpush',
+ value: 'webpush'
},
{
- label: 'html5_notify',
+ label: 'html5 notify',
value: 'html5_notify'
},
{
@@ -135,6 +135,10 @@ const schema = reactive([
label: 'slack',
value: 'slack'
},
+ {
+ label: 'pachka',
+ value: 'pachka'
+ },
]
}
diff --git a/system/automation/action.go b/system/automation/action.go
index 4d937424b..6eb9da5c2 100644
--- a/system/automation/action.go
+++ b/system/automation/action.go
@@ -22,10 +22,10 @@ import (
"fmt"
"sync"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
)
diff --git a/system/automation/automation.go b/system/automation/automation.go
index ec10bf35d..55072c6ef 100644
--- a/system/automation/automation.go
+++ b/system/automation/automation.go
@@ -30,11 +30,11 @@ import (
"go.uber.org/fx"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/logger"
"github.com/e154/smart-home/common/telemetry"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
)
diff --git a/system/automation/task.go b/system/automation/task.go
index abcf13249..0f9d3bc36 100644
--- a/system/automation/task.go
+++ b/system/automation/task.go
@@ -25,10 +25,10 @@ import (
"go.uber.org/atomic"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/telemetry"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
)
diff --git a/system/automation/task_manager.go b/system/automation/task_manager.go
index a52b5aad7..9080ef789 100644
--- a/system/automation/task_manager.go
+++ b/system/automation/task_manager.go
@@ -22,12 +22,12 @@ import (
"context"
"sync"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/telemetry"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/triggers"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
"go.uber.org/atomic"
diff --git a/system/automation/trigger.go b/system/automation/trigger.go
index 7f8dc2317..e16b17568 100644
--- a/system/automation/trigger.go
+++ b/system/automation/trigger.go
@@ -23,12 +23,12 @@ import (
"fmt"
"go.uber.org/atomic"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/telemetry"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/triggers"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
)
diff --git a/system/automation/trigger_manager.go b/system/automation/trigger_manager.go
index e9b405b1d..7bec2311f 100644
--- a/system/automation/trigger_manager.go
+++ b/system/automation/trigger_manager.go
@@ -23,12 +23,12 @@ import (
"fmt"
"sync"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/apperr"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/triggers"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
"github.com/pkg/errors"
diff --git a/system/backup/backup.go b/system/backup/backup.go
index f63f40bf9..b72aa6769 100644
--- a/system/backup/backup.go
+++ b/system/backup/backup.go
@@ -38,6 +38,7 @@ import (
"gorm.io/driver/postgres"
"gorm.io/gorm"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/app"
"github.com/e154/smart-home/common/apperr"
@@ -45,7 +46,6 @@ import (
"github.com/e154/smart-home/common/logger"
m "github.com/e154/smart-home/models"
notifyCommon "github.com/e154/smart-home/plugins/notify/common"
- "github.com/e154/smart-home/system/bus"
)
var (
@@ -147,7 +147,7 @@ func (b *Backup) New(scheduler bool) (err error) {
_ = os.RemoveAll(tmpDir)
- log.Info("complete")
+ log.Infof("Snapshot %s successfully created", backupName)
b.eventBus.Publish("system/services/backup", events.EventCreatedBackup{
Name: backupName,
diff --git a/system/bus/bus.go b/system/bus/bus.go
deleted file mode 100644
index 3175f8166..000000000
--- a/system/bus/bus.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// This file is part of the Smart Home
-// Program complex distribution https://github.com/e154/smart-home
-// Copyright (C) 2016-2023, Filippov Alex
-//
-// This library is free software: you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library. If not, see
-// .
-
-package bus
-
-import (
- "context"
- "fmt"
- "reflect"
- "sort"
- "sync"
-
- "github.com/pkg/errors"
-
- "github.com/e154/smart-home/common/apperr"
-)
-
-type bus struct {
- sync.RWMutex
- topics map[string]*Topic
-}
-
-// NewBus ...
-func NewBus() Bus {
- return &bus{
- topics: make(map[string]*Topic),
- }
-}
-
-// Publish ...
-func (b *bus) Publish(topic string, args ...interface{}) {
- b.RLock()
- defer b.RUnlock()
-
- for t, sub := range b.topics {
- if !TopicMatch([]byte(topic), []byte(t)) {
- continue
- }
- go sub.Publish(args...)
- }
-}
-
-// Subscribe ...
-func (b *bus) Subscribe(topic string, fn interface{}, options ...interface{}) (err error) {
- b.Lock()
- defer b.Unlock()
-
- if sub, ok := b.topics[topic]; ok {
- return sub.Subscribe(fn, options...)
- } else {
- subs := NewTopic(topic)
- b.topics[topic] = subs
- return subs.Subscribe(fn, options...)
- }
-}
-
-// Unsubscribe ...
-func (b *bus) Unsubscribe(topic string, fn interface{}) (err error) {
- b.Lock()
- defer b.Unlock()
-
- var empty bool
- if sub, ok := b.topics[topic]; ok {
- empty, err = sub.Unsubscribe(fn)
- if err != nil {
- return err
- }
- if empty {
- delete(b.topics, topic)
- }
- return nil
- }
-
- return errors.Wrap(apperr.ErrInternal, fmt.Sprintf("topic %s doesn't exist", topic))
-}
-
-// CloseTopic ...
-func (b *bus) CloseTopic(topic string) {
- b.Lock()
- defer b.Unlock()
-
- if sub, ok := b.topics[topic]; ok {
- sub.Close()
- delete(b.topics, topic)
- }
-}
-
-// Purge ...
-func (b *bus) Purge() {
- b.Lock()
- defer b.Unlock()
-
- for topic, sub := range b.topics {
- sub.Close()
- delete(b.topics, topic)
- }
-}
-
-func (b *bus) Stat(ctx context.Context, limit, offset int64, _, _ string) (result Stats, total int64, err error) {
-
- b.RLock()
- var stats = make(Stats, 0, len(b.topics))
- for _, subs := range b.topics {
- stats = append(stats, subs.Stat())
- }
- b.RUnlock()
-
- sort.Sort(stats)
-
- total = int64(len(b.topics))
-
- if offset > total {
- offset = total
- }
-
- end := offset + limit
- if end > total {
- end = total
- }
-
- result = stats[offset:end]
-
- return
-}
-
-func buildHandlerArgs(args []interface{}) []reflect.Value {
- reflectedArgs := make([]reflect.Value, 0)
-
- for _, arg := range args {
- reflectedArgs = append(reflectedArgs, reflect.ValueOf(arg))
- }
-
- return reflectedArgs
-}
diff --git a/system/bus/bus_test.go b/system/bus/bus_test.go
deleted file mode 100644
index 2b5c14339..000000000
--- a/system/bus/bus_test.go
+++ /dev/null
@@ -1,427 +0,0 @@
-// This file is part of the Smart Home
-// Program complex distribution https://github.com/e154/smart-home
-// Copyright (C) 2023, Filippov Alex
-//
-// This library is free software: you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library. If not, see
-// .
-
-package bus
-
-import (
- "context"
- "fmt"
- "reflect"
- "sync"
- "testing"
- "time"
-
- "github.com/stretchr/testify/require"
- "go.uber.org/atomic"
-)
-
-func TestBus(t *testing.T) {
-
- const topic = "test/topic"
-
- b := NewBus()
-
- var counter = 0
- var wg = sync.WaitGroup{}
-
- // Test Subscribe
- fn := func(topic string, arg1 string, arg2 string) {
- counter++
- wg.Done()
- }
- wg.Add(1)
- err := b.Subscribe(topic, fn)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
-
- // Test Publish
- b.Publish(topic, "hello", "world")
-
- wg.Wait()
-
- require.Equal(t, counter, 1)
-
- // ------------------------------------------------------------
-
- // Test Stat
- stats, total, err := b.Stat(context.Background(), 999, 0, "", "")
- if err != nil {
- t.Errorf("Stat returned an error: %v", err)
- }
- if total != 1 {
- t.Errorf("Stat returned a non-zero total: %d", total)
- }
- if len(stats) != 1 {
- t.Errorf("Stat returned a non-empty stats slice: %v", stats)
- }
-
- require.Equal(t, stats[0].Topic, topic)
- require.Equal(t, stats[0].Subscribers, 1)
-
- // ------------------------------------------------------------
-
- // Test Unsubscribe
- err = b.Unsubscribe(topic, fn)
- if err != nil {
- t.Errorf("Unsubscribe returned an error: %v", err)
- }
-
- // Test Publish
- b.Publish(topic, "hello", "world")
-
- time.Sleep(time.Second)
-
- require.Equal(t, counter, 1)
-
- // ------------------------------------------------------------
-
- // Test Stat
- stats, total, err = b.Stat(context.Background(), 999, 0, "", "")
- if err != nil {
- t.Errorf("Stat returned an error: %v", err)
- }
- if total != 0 {
- t.Errorf("Stat returned a non-zero total: %d", total)
- }
- if len(stats) != 0 {
- t.Errorf("Stat returned a non-empty stats slice: %v", stats)
- }
-
- // ------------------------------------------------------------
-
- // Test Subscribe
- fn = func(topic string, arg1 string, arg2 string) {
- counter++
- }
- err = b.Subscribe(topic, fn)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
-
- // Test Close
- b.CloseTopic(topic)
-
- // Test Publish
- b.Publish(topic, "hello", "world")
-
- time.Sleep(time.Second)
-
- require.Equal(t, 1, counter)
-
- // Test Stat
- stats, total, err = b.Stat(context.Background(), 999, 0, "", "")
- if err != nil {
- t.Errorf("Stat returned an error: %v", err)
- }
- if total != 0 {
- t.Errorf("Stat returned a non-zero total: %d", total)
- }
- if len(stats) != 0 {
- t.Errorf("Stat returned a non-empty stats slice: %v", stats)
- }
-
- // ------------------------------------------------------------
-
- fn = func(topic string, arg1 string, arg2 string) {
- counter++
- }
- err = b.Subscribe(topic, fn)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
-
- // Test Close
- b.Purge()
-
- // Test Publish
- b.Publish(topic, "hello", "world")
-
- time.Sleep(time.Second)
-
- require.Equal(t, counter, 1)
-
- // Test Stat
- stats, total, err = b.Stat(context.Background(), 999, 0, "", "")
- if err != nil {
- t.Errorf("Stat returned an error: %v", err)
- }
- if total != 0 {
- t.Errorf("Stat returned a non-zero total: %d", total)
- }
- if len(stats) != 0 {
- t.Errorf("Stat returned a non-empty stats slice: %v", stats)
- }
-
- // ------------------------------------------------------------
-
- // Test buildHandlerArgs
- args := buildHandlerArgs([]interface{}{topic, "hello", "world"})
- if len(args) != 3 {
- t.Errorf("buildHandlerArgs returned the wrong number of arguments: %v", args)
- }
- if args[0].String() != topic {
- t.Errorf("buildHandlerArgs returned the wrong topic: %v", args[0])
- }
- if args[1].String() != "hello" {
- t.Errorf("buildHandlerArgs returned the wrong arg1: %v", args[1])
- }
- if args[2].String() != "world" {
- t.Errorf("buildHandlerArgs returned the wrong arg2: %v", args[2])
- }
-
- // Test reflection of buildHandlerArgs
- if reflect.TypeOf(buildHandlerArgs).Kind() != reflect.Func {
- t.Errorf("buildHandlerArgs is not a function")
- }
-}
-
-func TestBus2(t *testing.T) {
-
- const topic = "test/topic"
-
- b := NewBus()
-
- var counter atomic.Int32
- var wg = sync.WaitGroup{}
-
- // Test Subscribe
- fn := func(topic string, arg1 string, arg2 string) {
- fmt.Println("fn1")
- counter.Inc()
- wg.Done()
- }
-
- fn2 := func(topic string, arg1 string, arg2 string) {
- fmt.Println("fn2")
- counter.Inc()
- wg.Done()
- }
-
- fn3 := func(topic string, arg1 string, arg2 string) {
- fmt.Println("fn3")
- counter.Inc()
- wg.Done()
- }
-
- wg.Add(3)
-
- err := b.Subscribe(topic, fn)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
- err = b.Subscribe(topic, fn2)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
- err = b.Subscribe(topic, fn3)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
-
- // Test Stat
- stats, total, err := b.Stat(context.Background(), 999, 0, "", "")
- if err != nil {
- t.Errorf("Stat returned an error: %v", err)
- }
- if total != 1 {
- t.Errorf("Stat returned a non-zero total: %d", total)
- }
- if len(stats) != 1 {
- t.Errorf("Stat returned a non-empty stats slice: %v", stats)
- }
-
- // Test Publish
- b.Publish(topic, "hello", "world")
-
- wg.Wait()
-
- require.Equal(t, int32(3), counter.Load())
-}
-
-func TestBus3(t *testing.T) {
-
- bus := NewBus()
-
- var counter atomic.Int32
- var wg = sync.WaitGroup{}
-
- const n = 1000
-
- wg.Add(n)
- fn := func(_ string, msg interface{}) {
- //fmt.Println("msg", msg)
- counter.Inc()
- wg.Done()
- }
-
- for i := 0; i < n; i++ {
- _ = bus.Subscribe(fmt.Sprintf("foo/bar/%d", i), fn)
- }
-
-L:
- stat, total, err := bus.Stat(context.Background(), 1000, 0, "", "")
- require.NoError(t, err)
-
- if total < 1000 {
- goto L
- }
-
- require.NoError(t, err)
- require.Equal(t, len(stat), n)
- require.Equal(t, total, int64(n))
- require.Equal(t, counter.Load(), int32(0))
-
- counter.Store(0)
-
- for i := 0; i < n; i++ {
- bus.Publish(fmt.Sprintf("foo/bar/%d", i), i)
- }
-
-L2:
- if counter.Load() < 1000 {
- time.Sleep(time.Second)
- goto L2
- }
-
- for i := 0; i < n; i++ {
- _ = bus.Unsubscribe(fmt.Sprintf("foo/bar/%d", i), fn)
- }
-
-L3:
- stat, total, err = bus.Stat(context.Background(), 1000, 0, "", "")
- require.NoError(t, err)
-
- if total != 0 {
- goto L3
- }
-
- require.NoError(t, err)
- require.Equal(t, len(stat), 0)
- require.Equal(t, total, int64(0))
- require.Equal(t, counter.Load(), int32(n))
-
- counter.Store(0)
-
- for i := 0; i < n; i++ {
- bus.Publish(fmt.Sprintf("foo/bar/%d", i), i)
- }
-
- time.Sleep(time.Second * 5)
-
- require.True(t, counter.Load() == 0)
-}
-
-func TestBus4(t *testing.T) {
-
- bus := NewBus()
-
- var counter1 atomic.Int32
- var counter2 atomic.Int32
- var wg1 = sync.WaitGroup{}
- var wg2 = sync.WaitGroup{}
-
- const n = 1
-
- wg1.Add(n)
- fn1 := func(_ string, msg interface{}) {
- //fmt.Println("msg", msg)
- counter1.Inc()
- wg1.Done()
- }
- wg2.Add(n)
- fn2 := func(_ string, msg interface{}) {
- //fmt.Println("msg", msg)
- counter2.Inc()
- wg2.Done()
- }
-
- for i := 0; i < n; i++ {
- _ = bus.Subscribe(fmt.Sprintf("foo/bar/%d", i), fn1)
- _ = bus.Subscribe(fmt.Sprintf("foo/bar/%d", i), fn2)
- }
-
- time.Sleep(time.Second)
-
- stat, total, err := bus.Stat(context.Background(), 999, 0, "", "")
- require.NoError(t, err)
- require.Equal(t, len(stat), n)
- require.Equal(t, total, int64(n))
- require.Equal(t, counter1.Load(), int32(0))
- require.Equal(t, counter2.Load(), int32(0))
-
- for i := 0; i < n; i++ {
- bus.Publish(fmt.Sprintf("foo/bar/%d", i), i)
- }
-
- wg1.Wait()
- wg2.Wait()
-
- require.Equal(t, counter1.Load(), int32(n))
- require.Equal(t, counter2.Load(), int32(n))
-
- for i := 0; i < n; i++ {
- _ = bus.Unsubscribe(fmt.Sprintf("foo/bar/%d", i), fn1)
- }
- time.Sleep(time.Second)
-
- stat, total, err = bus.Stat(context.Background(), 999, 0, "", "")
- require.NoError(t, err)
- require.Equal(t, len(stat), n)
- require.Equal(t, total, int64(n))
-
- wg2.Add(n)
- for i := 0; i < n; i++ {
- bus.Publish(fmt.Sprintf("foo/bar/%d", i), i)
- }
-
- wg2.Wait()
-
- require.Equal(t, counter1.Load(), int32(n))
- require.Equal(t, counter2.Load(), int32(n*2))
-
- stat, total, err = bus.Stat(context.Background(), 999, 0, "", "")
- require.NoError(t, err)
- require.Equal(t, len(stat), n)
- require.Equal(t, total, int64(n))
-}
-
-func BenchmarkBus(b *testing.B) {
-
- const topic = "test/topic"
-
- bus := NewBus()
-
- var counter atomic.Int32
-
- // Test Subscribe
- fn := func(topic string, arg1 string, arg2 string) {
- counter.Inc()
- }
- err := bus.Subscribe(topic, fn)
- require.NoError(b, err)
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- bus.Publish(topic, "hello", "world")
- }
-
- time.Sleep(time.Second)
-
- require.Equal(b, int32(b.N), counter.Load())
-}
diff --git a/system/bus/common.go b/system/bus/common.go
deleted file mode 100644
index 075e8e9b6..000000000
--- a/system/bus/common.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// This file is part of the Smart Home
-// Program complex distribution https://github.com/e154/smart-home
-// Copyright (C) 2016-2023, Filippov Alex
-//
-// This library is free software: you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library. If not, see
-// .
-
-package bus
-
-// TopicMatch 返回topic和topic filter是否
-//
-// TopicMatch returns whether the topic and topic filter is matched.
-func TopicMatch(topic []byte, topicFilter []byte) bool {
- var spos int
- var tpos int
- var sublen int
- var topiclen int
- var multilevelWildcard bool //是否是多层的通配符
- sublen = len(topicFilter)
- topiclen = len(topic)
- if sublen == 0 || topiclen == 0 {
- return false
- }
- if (topicFilter[0] == '$' && topic[0] != '$') || (topic[0] == '$' && topicFilter[0] != '$') {
- return false
- }
- for {
- //e.g. ([]byte("foo/bar"),[]byte("foo/+/#")
- if spos < sublen && tpos <= topiclen {
- if tpos != topiclen && topicFilter[spos] == topic[tpos] { // sublen是订阅 topiclen是发布,首字母匹配
- if tpos == topiclen-1 { //遍历到topic的最后一个字节
- /* Check for e.g. foo matching foo/# */
- if spos == sublen-3 && topicFilter[spos+1] == '/' && topicFilter[spos+2] == '#' {
- return true
- }
- }
- spos++
- tpos++
- if spos == sublen && tpos == topiclen { //长度相等,内容相同,匹配
- return true
- } else if tpos == topiclen && spos == sublen-1 && topicFilter[spos] == '+' {
- //订阅topic比发布topic多一个字节,并且多出来的内容是+ ,比如: sub: foo/+ ,topic: foo/
- if spos > 0 && topicFilter[spos-1] != '/' {
- return false
- }
- return true
- }
- } else {
- if topicFilter[spos] == '+' { //sub 和 topic 内容不匹配了
- spos++
- for { //找到topic的下一个主题分割符
- if tpos < topiclen && topic[tpos] != '/' {
- tpos++
- } else {
- break
- }
- }
- if tpos == topiclen && spos == sublen { //都遍历完了,返回true
- return true
- }
- } else if topicFilter[spos] == '#' {
- return true
- } else {
- /* Check for e.g. foo/bar matching foo/+/# */
- if spos > 0 && spos+2 == sublen && tpos == topiclen && topicFilter[spos-1] == '+' && topicFilter[spos] == '/' && topicFilter[spos+1] == '#' {
- return true
- }
- return false
- }
- }
- } else {
- break
- }
- }
- if !multilevelWildcard && (tpos < topiclen || spos < sublen) {
- return false
- }
- return false
-}
diff --git a/system/bus/common_test.go b/system/bus/common_test.go
deleted file mode 100644
index 04acb18fb..000000000
--- a/system/bus/common_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// This file is part of the Smart Home
-// Program complex distribution https://github.com/e154/smart-home
-// Copyright (C) 2023, Filippov Alex
-//
-// This library is free software: you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library. If not, see
-// .
-
-package bus
-
-import (
- "testing"
-)
-
-func TestTopicMatch(t *testing.T) {
-
- const topic = "myhome/groundfloor/livingroom/temperature"
- const topic2 = "myhome/groundfloor/kitchen/temperature"
-
- // Test cases with exact matches
- assertMatch(t, []byte(topic), []byte("myhome/groundfloor/livingroom/temperature"))
-
- // Test cases with wildcard matches
-
- assertMatch(t, []byte(topic), []byte("myhome/groundfloor/#"))
- assertMatch(t, []byte(topic2), []byte("myhome/groundfloor/#"))
- assertMatch(t, []byte(topic), []byte("myhome/groundfloor/+/#"))
- assertMatch(t, []byte(topic2), []byte("myhome/groundfloor/+/#"))
-
- // Test cases with no matches
- assertNoMatch(t, []byte(topic), []byte("myhome/groundfloor/livingroom/temperature/"))
- assertNoMatch(t, []byte(topic), []byte("myhome/groundfloor/livingroom/"))
- assertNoMatch(t, []byte(topic), []byte("myhome/groundfloor/+/temperature/"))
- assertNoMatch(t, []byte("myhome/groundfloor/livingroom"), []byte("myhome/groundfloor/+/temperature"))
-}
-
-func assertMatch(t *testing.T, topic []byte, topicFilter []byte) {
- if !TopicMatch(topic, topicFilter) {
- t.Errorf("Expected topic %s to match filter %s", topic, topicFilter)
- }
-}
-
-func assertNoMatch(t *testing.T, topic []byte, topicFilter []byte) {
- if TopicMatch(topic, topicFilter) {
- t.Errorf("Expected topic %s to not match filter %s", topic, topicFilter)
- }
-}
diff --git a/system/bus/statistic.go b/system/bus/statistic.go
deleted file mode 100644
index ef36b284b..000000000
--- a/system/bus/statistic.go
+++ /dev/null
@@ -1,114 +0,0 @@
-// This file is part of the Smart Home
-// Program complex distribution https://github.com/e154/smart-home
-// Copyright (C) 2024, Filippov Alex
-//
-// This library is free software: you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library. If not, see
-// .
-
-package bus
-
-import (
- "go.uber.org/atomic"
- "strings"
- "time"
-)
-
-type Statistic struct {
- min *atomic.Duration
- max *atomic.Duration
- avg *atomic.Duration
- rps *RPSCounter
-}
-
-func NewStatistic() *Statistic {
- return &Statistic{
- min: atomic.NewDuration(0),
- max: atomic.NewDuration(0),
- avg: atomic.NewDuration(0),
- rps: startRPSCounter(),
- }
-}
-
-func (s *Statistic) setTime(t time.Duration) {
- if s.min.Load() == 0 {
- s.min.Store(t)
- }
- if s.min.Load() > t {
- s.min.Store(t)
- }
- if s.max.Load() == 0 {
- s.max.Store(t)
- }
- if t > s.max.Load() {
- s.max.Store(t)
- }
- s.avg.Store((s.max.Load() + s.min.Load()) / 2)
-}
-
-// StatItem ...
-type StatItem struct {
- Topic string
- Subscribers int
- Min time.Duration
- Max time.Duration
- Avg time.Duration
- Rps float64
-}
-
-// Stats ...
-type Stats []*StatItem
-
-func (s Stats) Len() int { return len(s) }
-func (s Stats) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func (s Stats) Less(i, j int) bool { return strings.Compare(s[i].Topic, s[j].Topic) == -1 }
-
-type RPSCounter struct {
- count *atomic.Int64
- value *atomic.Float64
- isRunning *atomic.Bool
-}
-
-func startRPSCounter() *RPSCounter {
- counter := &RPSCounter{
- count: atomic.NewInt64(0),
- value: atomic.NewFloat64(0),
- isRunning: atomic.NewBool(true),
- }
-
- go func() {
- ticker := time.NewTicker(time.Second * 5)
- defer ticker.Stop()
- for counter.isRunning.Load() {
- select {
- case <-ticker.C:
- counter.value.Store(float64(counter.count.Load()) / 5)
- counter.count.Store(0)
- }
- }
- }()
-
- return counter
-}
-
-func (c *RPSCounter) Inc() {
- c.count.Inc()
-}
-
-func (c *RPSCounter) Value() float64 {
- return c.value.Load()
-}
-
-func (c *RPSCounter) Stop() {
- c.isRunning.Store(false)
-}
diff --git a/system/bus/topic.go b/system/bus/topic.go
deleted file mode 100644
index 0b3ef34f5..000000000
--- a/system/bus/topic.go
+++ /dev/null
@@ -1,155 +0,0 @@
-// This file is part of the Smart Home
-// Program complex distribution https://github.com/e154/smart-home
-// Copyright (C) 2024, Filippov Alex
-//
-// This library is free software: you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library. If not, see
-// .
-
-package bus
-
-import (
- "fmt"
- "reflect"
- "sync"
- "time"
-
- "github.com/pkg/errors"
-
- "github.com/e154/smart-home/common/apperr"
-)
-
-const queueSize = 1024
-
-type Topic struct {
- name string
- *Statistic
- sync.RWMutex
- handlers []*handler
- lastMsg []reflect.Value
-}
-
-func NewTopic(name string) *Topic {
- return &Topic{
- name: name,
- handlers: make([]*handler, 0),
- Statistic: NewStatistic(),
- }
-}
-
-func (t *Topic) Publish(args ...interface{}) {
- t.RLock()
- defer t.RUnlock()
-
- if len(t.handlers) == 0 {
- return
- }
-
- rArgs := buildHandlerArgs(append([]interface{}{t.name}, args...))
-
- t.lastMsg = rArgs
- for _, h := range t.handlers {
- t.rps.Inc()
- h.queue <- rArgs
- }
-}
-
-func (t *Topic) Subscribe(fn interface{}, options ...interface{}) error {
- if reflect.TypeOf(fn).Kind() != reflect.Func {
- return errors.Wrap(apperr.ErrInternal, fmt.Sprintf("%s is not a reflect.Func", reflect.TypeOf(fn)))
- }
-
- h := &handler{
- callback: reflect.ValueOf(fn),
- queue: make(chan []reflect.Value, queueSize),
- }
-
- t.Lock()
- t.handlers = append(t.handlers, h)
- t.Unlock()
-
- go func(h *handler) {
- var startTime time.Time
- for args := range h.queue {
- go func(args []reflect.Value) {
- startTime = time.Now()
- h.callback.Call(args)
- t.setTime(time.Since(startTime))
- }(args)
- }
- }(h)
-
- if len(options) > 0 {
- if retain, ok := options[0].(bool); ok && !retain {
- return nil
- }
- }
-
- t.RLock()
- // sand last message value
- if t.lastMsg != nil {
- go h.callback.Call(t.lastMsg)
- }
- t.RUnlock()
-
- return nil
-}
-
-func (t *Topic) Unsubscribe(fn interface{}) (empty bool, err error) {
- t.Lock()
- defer t.Unlock()
-
- rv := reflect.ValueOf(fn)
-
- var indexesToDelete []int
-
- for i, h := range t.handlers {
- if h.callback == rv || h.callback.Pointer() == rv.Pointer() {
- indexesToDelete = append(indexesToDelete, i)
- }
- }
-
- for i := len(indexesToDelete) - 1; i >= 0; i-- {
- index := indexesToDelete[i]
- close(t.handlers[index].queue)
- t.handlers = append(t.handlers[:index], t.handlers[index+1:]...)
- }
-
- empty = len(t.handlers) == 0
-
- return
-}
-
-func (t *Topic) Close() {
- t.Lock()
- defer t.Unlock()
-
- for _, h := range t.handlers {
- close(h.queue)
- }
- t.handlers = make([]*handler, 0)
- t.rps.Stop()
-}
-
-func (t *Topic) Stat() *StatItem {
- t.RLock()
- defer t.RUnlock()
- return &StatItem{
- Topic: t.name,
- Subscribers: len(t.handlers),
- Min: t.min.Load(),
- Max: t.max.Load(),
- Avg: t.avg.Load(),
- Rps: t.rps.Value(),
- }
-}
diff --git a/system/bus/topic_test.go b/system/bus/topic_test.go
deleted file mode 100644
index 465c4d676..000000000
--- a/system/bus/topic_test.go
+++ /dev/null
@@ -1,271 +0,0 @@
-// This file is part of the Smart Home
-// Program complex distribution https://github.com/e154/smart-home
-// Copyright (C) 2023, Filippov Alex
-//
-// This library is free software: you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library. If not, see
-// .
-
-package bus
-
-import (
- "fmt"
- "go.uber.org/atomic"
- "reflect"
- "sync"
- "testing"
- "time"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestTopic(t *testing.T) {
-
- const topic = "test/topic"
-
- b := NewTopic(topic)
-
- var counter = 0
- var wg = sync.WaitGroup{}
-
- // Test Subscribe
- fn := func(topic string, arg1 string, arg2 string) {
- counter++
- wg.Done()
- }
- wg.Add(1)
- err := b.Subscribe(fn)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
-
- // Test Publish
- b.Publish("hello", "world")
-
- wg.Wait()
-
- require.Equal(t, counter, 1)
-
- // ------------------------------------------------------------
- // Test Stat
- stat := b.Stat()
- require.Equal(t, stat.Topic, topic)
- require.Equal(t, stat.Subscribers, 1)
-
- // ------------------------------------------------------------
-
- // Test Unsubscribe
- empty, err := b.Unsubscribe(fn)
- if err != nil {
- t.Errorf("Unsubscribe returned an error: %v", err)
- }
- require.Equal(t, true, empty)
-
- // Test Publish
- b.Publish("hello", "world")
-
- time.Sleep(time.Second)
-
- require.Equal(t, 1, counter)
-
- // ------------------------------------------------------------
-
- stat = b.Stat()
- require.Equal(t, stat.Topic, topic)
- require.Equal(t, stat.Subscribers, 0)
- // ------------------------------------------------------------
-
- // Test Subscribe
- fn = func(topic string, arg1 string, arg2 string) {
- counter++
- }
- err = b.Subscribe(fn, false)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
-
- stat = b.Stat()
- require.Equal(t, stat.Subscribers, 1)
-
- // Test Close
- b.Close()
-
- stat = b.Stat()
- require.Equal(t, stat.Subscribers, 0)
-
- // Test Publish
- b.Publish("foo", "bar")
-
- time.Sleep(time.Second)
-
- require.Equal(t, 1, counter)
-
- // ------------------------------------------------------------
- // Test Stat
- stat = b.Stat()
- require.Equal(t, stat.Subscribers, 0)
- // ------------------------------------------------------------
-
- fn = func(topic string, arg1 string, arg2 string) {
- counter++
- }
- err = b.Subscribe(fn, false)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
-
- // Test Close
- b.Close()
-
- // Test Publish
- b.Publish("hello", "world")
-
- time.Sleep(time.Second)
-
- require.Equal(t, 1, counter)
-
- /// Test Stat
- stat = b.Stat()
- require.Equal(t, stat.Subscribers, 0)
-
- // ------------------------------------------------------------
-
- // Test buildHandlerArgs
- args := buildHandlerArgs([]interface{}{topic, "hello", "world"})
- if len(args) != 3 {
- t.Errorf("buildHandlerArgs returned the wrong number of arguments: %v", args)
- }
- if args[0].String() != topic {
- t.Errorf("buildHandlerArgs returned the wrong topic: %v", args[0])
- }
- if args[1].String() != "hello" {
- t.Errorf("buildHandlerArgs returned the wrong arg1: %v", args[1])
- }
- if args[2].String() != "world" {
- t.Errorf("buildHandlerArgs returned the wrong arg2: %v", args[2])
- }
-
- // Test reflection of buildHandlerArgs
- if reflect.TypeOf(buildHandlerArgs).Kind() != reflect.Func {
- t.Errorf("buildHandlerArgs is not a function")
- }
-}
-
-func TestTopic2(t *testing.T) {
-
- const topic = "test/topic"
-
- b := NewTopic(topic)
-
- var counter atomic.Int32
- var wg = sync.WaitGroup{}
-
- // Test Subscribe
- fn := func(topic string, arg1 string, arg2 string) {
- fmt.Println("fn1")
- counter.Inc()
- wg.Done()
- }
-
- fn2 := func(topic string, arg1 string, arg2 string) {
- fmt.Println("fn2")
- counter.Inc()
- wg.Done()
- }
-
- fn3 := func(topic string, arg1 string, arg2 string) {
- fmt.Println("fn3")
- counter.Inc()
- wg.Done()
- }
-
- wg.Add(3)
-
- err := b.Subscribe(fn)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
- err = b.Subscribe(fn2)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
- err = b.Subscribe(fn3)
- if err != nil {
- t.Errorf("Subscribe returned an error: %v", err)
- }
-
- // Test Stat
- stat := b.Stat()
- require.Equal(t, 3, stat.Subscribers)
-
- // Test Publish
- b.Publish("hello", "world")
-
- wg.Wait()
-
- require.Equal(t, int32(3), counter.Load())
-}
-
-func TestTopic3(t *testing.T) {
-
- const topic = "test/topic"
-
- b := NewTopic(topic)
-
- // Test Subscribe
- fn := func(topic string, arg1 string, arg2 string) {}
-
- empty, err := b.Unsubscribe(fn)
- require.Equal(t, nil, err)
- require.Equal(t, true, empty)
-
- err = b.Subscribe(fn)
- require.Equal(t, nil, err)
-
- // Test Stat
- stat := b.Stat()
- require.Equal(t, 1, stat.Subscribers)
-
- empty, err = b.Unsubscribe(fn)
- require.Equal(t, nil, err)
- require.Equal(t, true, empty)
-
- empty, err = b.Unsubscribe(fn)
- require.Equal(t, nil, err)
- require.Equal(t, true, empty)
-}
-
-func BenchmarkTopic(b *testing.B) {
-
- const topic = "test/topic"
-
- bus := NewTopic(topic)
-
- var counter atomic.Int32
-
- // Test Subscribe
- fn := func(topic string, arg1 string, arg2 string) {
- counter.Inc()
- }
- err := bus.Subscribe(fn)
- require.NoError(b, err)
-
- b.ResetTimer()
- for i := 0; i < b.N; i++ {
- bus.Publish("hello", "world")
- }
-
- time.Sleep(time.Second)
-
- require.Equal(b, int32(b.N), counter.Load())
-}
diff --git a/system/bus/types.go b/system/bus/types.go
deleted file mode 100644
index c5fe24685..000000000
--- a/system/bus/types.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// This file is part of the Smart Home
-// Program complex distribution https://github.com/e154/smart-home
-// Copyright (C) 2016-2023, Filippov Alex
-//
-// This library is free software: you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 3 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Library General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library. If not, see
-// .
-
-package bus
-
-import (
- "context"
- "reflect"
-)
-
-// Bus implements publish/subscribe messaging paradigm
-type Bus interface {
- // Publish publishes arguments to the given topic subscribers
- // Publish block only when the buffer of one of the subscribers is full.
- Publish(topic string, args ...interface{})
- // CloseTopic unsubscribe all subscribers from given topic
- CloseTopic(topic string)
- // Subscribe subscribes to the given topic
- Subscribe(topic string, fn interface{}, options ...interface{}) error
- // Unsubscribe handler from the given topic
- Unsubscribe(topic string, fn interface{}) error
- // Stat ...
- Stat(ctx context.Context, limit, offset int64, orderBy, sort string) (stats Stats, total int64, err error)
- // Purge ...
- Purge()
-}
-
-type handler struct {
- callback reflect.Value
- queue chan []reflect.Value
-}
diff --git a/system/gate/client/gate_client.go b/system/gate/client/gate_client.go
index 06fc39e55..c53a24944 100644
--- a/system/gate/client/gate_client.go
+++ b/system/gate/client/gate_client.go
@@ -27,11 +27,11 @@ import (
"go.uber.org/atomic"
"go.uber.org/fx"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/api"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/logger"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/gate/client/wsp"
"github.com/e154/smart-home/system/jwt_manager"
"github.com/e154/smart-home/system/stream"
diff --git a/system/gate/server/gate_server.go b/system/gate/server/gate_server.go
index e4a22c648..53620fc98 100644
--- a/system/gate/server/gate_server.go
+++ b/system/gate/server/gate_server.go
@@ -24,10 +24,10 @@ import (
"go.uber.org/fx"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/logger"
"github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/gate/server/wsp"
)
diff --git a/system/initial/initial.go b/system/initial/initial.go
index 8499d9b46..36d03da95 100644
--- a/system/initial/initial.go
+++ b/system/initial/initial.go
@@ -26,6 +26,7 @@ import (
"go.uber.org/fx"
"gorm.io/gorm"
+ "github.com/e154/bus"
. "github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/api"
"github.com/e154/smart-home/common/apperr"
@@ -36,7 +37,6 @@ import (
_ "github.com/e154/smart-home/plugins"
"github.com/e154/smart-home/system/access_list"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/gate/client"
. "github.com/e154/smart-home/system/initial/assertions"
"github.com/e154/smart-home/system/initial/demo"
diff --git a/system/initial/local_migrations/m_pachka.go b/system/initial/local_migrations/m_pachka.go
index 7d839637e..2de17d919 100644
--- a/system/initial/local_migrations/m_pachka.go
+++ b/system/initial/local_migrations/m_pachka.go
@@ -40,7 +40,7 @@ func (n *MigrationPachka) Up(ctx context.Context, adaptors *adaptors.Adaptors) e
if adaptors != nil {
n.adaptors = adaptors
}
- n.addPlugin(ctx, "pachka", true, false, false, speedtest.Version)
+ n.addPlugin(ctx, "pachka", true, false, true, speedtest.Version)
return nil
}
diff --git a/system/jwt_manager/jwt_manager.go b/system/jwt_manager/jwt_manager.go
index ac0bfb6b7..d223e8ed6 100644
--- a/system/jwt_manager/jwt_manager.go
+++ b/system/jwt_manager/jwt_manager.go
@@ -28,11 +28,11 @@ import (
"github.com/pkg/errors"
"go.uber.org/fx"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/logger"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
)
var (
diff --git a/system/media/media.go b/system/media/media.go
index 535b40ac5..ba61ec23b 100644
--- a/system/media/media.go
+++ b/system/media/media.go
@@ -22,8 +22,8 @@ import (
"context"
"fmt"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common/logger"
- "github.com/e154/smart-home/system/bus"
"go.uber.org/fx"
)
diff --git a/system/mqtt/mqtt.go b/system/mqtt/mqtt.go
index 727395437..249e1193d 100644
--- a/system/mqtt/mqtt.go
+++ b/system/mqtt/mqtt.go
@@ -36,10 +36,10 @@ import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/logger"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/logging"
"github.com/e154/smart-home/system/mqtt/admin"
"github.com/e154/smart-home/system/mqtt_authenticator"
diff --git a/system/scheduler/scheduler.go b/system/scheduler/scheduler.go
index e29f9ae0e..a1f61d714 100644
--- a/system/scheduler/scheduler.go
+++ b/system/scheduler/scheduler.go
@@ -25,11 +25,11 @@ import (
"github.com/robfig/cron/v3"
"go.uber.org/fx"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/logger"
- "github.com/e154/smart-home/system/bus"
)
type EntryID int
diff --git a/system/scripts/engine_watcher.go b/system/scripts/engine_watcher.go
index e5c17bafd..985ca183f 100644
--- a/system/scripts/engine_watcher.go
+++ b/system/scripts/engine_watcher.go
@@ -22,10 +22,10 @@ import (
"fmt"
"sync"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
)
type EngineWatcher struct {
diff --git a/system/scripts/engines_watcher.go b/system/scripts/engines_watcher.go
index c42849c37..56aae491d 100644
--- a/system/scripts/engines_watcher.go
+++ b/system/scripts/engines_watcher.go
@@ -24,9 +24,9 @@ import (
"github.com/pkg/errors"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
)
type EnginesWatcher struct {
diff --git a/system/scripts/scripts.go b/system/scripts/scripts.go
index f6a95bdba..3aa346d79 100644
--- a/system/scripts/scripts.go
+++ b/system/scripts/scripts.go
@@ -23,10 +23,10 @@ import (
"github.com/e154/smart-home/common/encryptor"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/logger"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts/bind"
"github.com/e154/smart-home/system/storage"
"go.uber.org/fx"
diff --git a/system/storage/storage.go b/system/storage/storage.go
index d6b6ac098..4b4080999 100644
--- a/system/storage/storage.go
+++ b/system/storage/storage.go
@@ -27,11 +27,11 @@ import (
"go.uber.org/atomic"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/logger"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
)
var (
diff --git a/system/stream/handlers/event_handler.go b/system/stream/handlers/event_handler.go
index f19ca11e6..0b641378a 100644
--- a/system/stream/handlers/event_handler.go
+++ b/system/stream/handlers/event_handler.go
@@ -23,11 +23,11 @@ import (
"encoding/json"
"go.uber.org/fx"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/webpush"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/stream"
)
diff --git a/system/stream/stream.go b/system/stream/stream.go
index 49d13ec75..506e5924f 100644
--- a/system/stream/stream.go
+++ b/system/stream/stream.go
@@ -26,10 +26,10 @@ import (
"github.com/gorilla/websocket"
"go.uber.org/fx"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/logger"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
)
var (
diff --git a/system/supervisor/plugin_manager.go b/system/supervisor/plugin_manager.go
index 4dd512bc4..f1373d0e5 100644
--- a/system/supervisor/plugin_manager.go
+++ b/system/supervisor/plugin_manager.go
@@ -26,11 +26,11 @@ import (
"github.com/pkg/errors"
"go.uber.org/atomic"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/apperr"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
)
type pluginManager struct {
diff --git a/system/supervisor/service.go b/system/supervisor/service.go
index 26695598a..515b5690b 100644
--- a/system/supervisor/service.go
+++ b/system/supervisor/service.go
@@ -19,10 +19,10 @@
package supervisor
import (
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/web"
"github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scheduler"
"github.com/e154/smart-home/system/scripts"
diff --git a/system/supervisor/supervisor.go b/system/supervisor/supervisor.go
index 0f9d26df6..ba3253b63 100644
--- a/system/supervisor/supervisor.go
+++ b/system/supervisor/supervisor.go
@@ -29,6 +29,7 @@ import (
"go.uber.org/atomic"
"go.uber.org/fx"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/apperr"
@@ -36,7 +37,6 @@ import (
"github.com/e154/smart-home/common/logger"
"github.com/e154/smart-home/common/web"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/cache"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scheduler"
diff --git a/system/supervisor/types.go b/system/supervisor/types.go
index 9eff7f4e2..dcec4146c 100644
--- a/system/supervisor/types.go
+++ b/system/supervisor/types.go
@@ -23,11 +23,11 @@ import (
"github.com/e154/smart-home/common/events"
"time"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/web"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scheduler"
"github.com/e154/smart-home/system/scripts"
diff --git a/system/terminal/terminal.go b/system/terminal/terminal.go
index 4d3ffe223..53fb03284 100644
--- a/system/terminal/terminal.go
+++ b/system/terminal/terminal.go
@@ -24,11 +24,11 @@ import (
"go.uber.org/fx"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/common/logger"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/jwt_manager"
)
diff --git a/system/terminal/type.go b/system/terminal/type.go
index 17e52c07c..14de4fba3 100644
--- a/system/terminal/type.go
+++ b/system/terminal/type.go
@@ -20,9 +20,9 @@ package terminal
import (
"context"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/jwt_manager"
"github.com/spf13/cobra"
)
diff --git a/system/zigbee2mqtt/zigbee2mqtt.go b/system/zigbee2mqtt/zigbee2mqtt.go
index 3a8452831..db9aa9f2f 100644
--- a/system/zigbee2mqtt/zigbee2mqtt.go
+++ b/system/zigbee2mqtt/zigbee2mqtt.go
@@ -22,8 +22,8 @@ import (
"context"
"sync"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common/events"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/common/apperr"
diff --git a/tests/api/container/container.go b/tests/api/container/container.go
index 331a7b8c4..38bda0816 100644
--- a/tests/api/container/container.go
+++ b/tests/api/container/container.go
@@ -19,6 +19,7 @@
package container
import (
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/api/controllers"
"github.com/e154/smart-home/common/web"
@@ -26,7 +27,6 @@ import (
"github.com/e154/smart-home/system/access_list"
"github.com/e154/smart-home/system/automation"
"github.com/e154/smart-home/system/backup"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/gate/client"
"github.com/e154/smart-home/system/initial"
"github.com/e154/smart-home/system/jwt_manager"
diff --git a/tests/models/container/container.go b/tests/models/container/container.go
index c37480ad3..90790ce84 100644
--- a/tests/models/container/container.go
+++ b/tests/models/container/container.go
@@ -19,13 +19,13 @@
package container
import (
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/web"
"github.com/e154/smart-home/endpoint"
"github.com/e154/smart-home/system/access_list"
"github.com/e154/smart-home/system/automation"
"github.com/e154/smart-home/system/backup"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/gate/client"
"github.com/e154/smart-home/system/initial"
"github.com/e154/smart-home/system/logging"
diff --git a/tests/plugins/alexa/alexa_test.go b/tests/plugins/alexa/alexa_test.go
index 53c105e6f..de9beb7c3 100644
--- a/tests/plugins/alexa/alexa_test.go
+++ b/tests/plugins/alexa/alexa_test.go
@@ -26,11 +26,11 @@ import (
. "github.com/smartystreets/goconvey/convey"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/alexa"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/cgminer/cgminer_test.go b/tests/plugins/cgminer/cgminer_test.go
index 2ab5d344c..1ddf041f0 100644
--- a/tests/plugins/cgminer/cgminer_test.go
+++ b/tests/plugins/cgminer/cgminer_test.go
@@ -23,13 +23,13 @@ import (
"testing"
"time"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/debug"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/cgminer"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/common.go b/tests/plugins/common.go
index 737372dae..da7245072 100644
--- a/tests/plugins/common.go
+++ b/tests/plugins/common.go
@@ -30,6 +30,7 @@ import (
"github.com/phayes/freeport"
"github.com/smartystreets/goconvey/convey"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
@@ -46,7 +47,6 @@ import (
"github.com/e154/smart-home/plugins/telegram"
"github.com/e154/smart-home/plugins/weather"
"github.com/e154/smart-home/plugins/zigbee2mqtt"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
)
diff --git a/tests/plugins/common/common_test.go b/tests/plugins/common/common_test.go
index fa8bb5e86..6e7e2fffc 100644
--- a/tests/plugins/common/common_test.go
+++ b/tests/plugins/common/common_test.go
@@ -25,11 +25,11 @@ import (
"testing"
"time"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
super "github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/container/container.go b/tests/plugins/container/container.go
index 1633050ea..90451a554 100644
--- a/tests/plugins/container/container.go
+++ b/tests/plugins/container/container.go
@@ -19,13 +19,13 @@
package container
import (
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/web"
"github.com/e154/smart-home/endpoint"
"github.com/e154/smart-home/system/access_list"
"github.com/e154/smart-home/system/automation"
"github.com/e154/smart-home/system/backup"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/gate/client"
"github.com/e154/smart-home/system/initial"
"github.com/e154/smart-home/system/jwt_manager"
diff --git a/tests/plugins/email/email_test.go b/tests/plugins/email/email_test.go
index 028977ca7..250fcd2af 100644
--- a/tests/plugins/email/email_test.go
+++ b/tests/plugins/email/email_test.go
@@ -25,13 +25,13 @@ import (
. "github.com/smartystreets/goconvey/convey"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/email"
"github.com/e154/smart-home/plugins/notify"
notifyCommon "github.com/e154/smart-home/plugins/notify/common"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/messagebird/messagebird_test.go b/tests/plugins/messagebird/messagebird_test.go
index 9cbad6ecf..eea391de8 100644
--- a/tests/plugins/messagebird/messagebird_test.go
+++ b/tests/plugins/messagebird/messagebird_test.go
@@ -26,12 +26,12 @@ import (
notifyCommon "github.com/e154/smart-home/plugins/notify/common"
. "github.com/smartystreets/goconvey/convey"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/messagebird"
"github.com/e154/smart-home/plugins/notify"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/migrations"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
diff --git a/tests/plugins/modbus_rtu/modbus_rtu_test.go b/tests/plugins/modbus_rtu/modbus_rtu_test.go
index 2ba9d87dc..02a2f6860 100644
--- a/tests/plugins/modbus_rtu/modbus_rtu_test.go
+++ b/tests/plugins/modbus_rtu/modbus_rtu_test.go
@@ -25,13 +25,13 @@ import (
"testing"
"time"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/modbus_rtu"
"github.com/e154/smart-home/plugins/node"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/migrations"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scripts"
diff --git a/tests/plugins/modbus_tcp/modbus_tcp_test.go b/tests/plugins/modbus_tcp/modbus_tcp_test.go
index 8be63533d..384601325 100644
--- a/tests/plugins/modbus_tcp/modbus_tcp_test.go
+++ b/tests/plugins/modbus_tcp/modbus_tcp_test.go
@@ -27,12 +27,12 @@ import (
"github.com/e154/smart-home/common/events"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/modbus_tcp"
"github.com/e154/smart-home/plugins/node"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/migrations"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scripts"
diff --git a/tests/plugins/moon/moon_test.go b/tests/plugins/moon/moon_test.go
index ec93e67a0..131720e8f 100644
--- a/tests/plugins/moon/moon_test.go
+++ b/tests/plugins/moon/moon_test.go
@@ -25,9 +25,9 @@ import (
"github.com/e154/smart-home/common/events"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
moonPlugin "github.com/e154/smart-home/plugins/moon"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/node/node_test.go b/tests/plugins/node/node_test.go
index 1e30845d3..7d2db44c9 100644
--- a/tests/plugins/node/node_test.go
+++ b/tests/plugins/node/node_test.go
@@ -25,10 +25,10 @@ import (
"testing"
"time"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/events"
"github.com/e154/smart-home/plugins/node"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
diff --git a/tests/plugins/scene/scene_test.go b/tests/plugins/scene/scene_test.go
index c8ffbf9c7..7f89f8999 100644
--- a/tests/plugins/scene/scene_test.go
+++ b/tests/plugins/scene/scene_test.go
@@ -27,10 +27,10 @@ import (
. "github.com/smartystreets/goconvey/convey"
"go.uber.org/atomic"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/sensor/sensor_test.go b/tests/plugins/sensor/sensor_test.go
index b03435d97..365dde6e3 100644
--- a/tests/plugins/sensor/sensor_test.go
+++ b/tests/plugins/sensor/sensor_test.go
@@ -26,10 +26,10 @@ import (
"github.com/e154/smart-home/common/events"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/sun/sun_test.go b/tests/plugins/sun/sun_test.go
index c9575ccb6..e0565c118 100644
--- a/tests/plugins/sun/sun_test.go
+++ b/tests/plugins/sun/sun_test.go
@@ -25,9 +25,9 @@ import (
"github.com/e154/smart-home/common/events"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
sunPlugin "github.com/e154/smart-home/plugins/sun"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/telegram/telegram_test.go b/tests/plugins/telegram/telegram_test.go
index 1106aa4b1..480892df6 100644
--- a/tests/plugins/telegram/telegram_test.go
+++ b/tests/plugins/telegram/telegram_test.go
@@ -25,6 +25,7 @@ import (
. "github.com/smartystreets/goconvey/convey"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
@@ -32,7 +33,6 @@ import (
"github.com/e154/smart-home/plugins/notify"
notifyCommon "github.com/e154/smart-home/plugins/notify/common"
"github.com/e154/smart-home/plugins/telegram"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/trigger_alexa/trigger_alexa_test.go b/tests/plugins/trigger_alexa/trigger_alexa_test.go
index 6efc17139..83278242d 100644
--- a/tests/plugins/trigger_alexa/trigger_alexa_test.go
+++ b/tests/plugins/trigger_alexa/trigger_alexa_test.go
@@ -23,12 +23,12 @@ import (
"testing"
"time"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/alexa"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/trigger_empty/trigger_empty_test.go b/tests/plugins/trigger_empty/trigger_empty_test.go
index ca89b1ca0..864e75cd2 100644
--- a/tests/plugins/trigger_empty/trigger_empty_test.go
+++ b/tests/plugins/trigger_empty/trigger_empty_test.go
@@ -23,12 +23,12 @@ import (
"testing"
"time"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/triggers"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scheduler"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
diff --git a/tests/plugins/trigger_state/trigger_state1_test.go b/tests/plugins/trigger_state/trigger_state1_test.go
index 5b0a893bc..61b131dbc 100644
--- a/tests/plugins/trigger_state/trigger_state1_test.go
+++ b/tests/plugins/trigger_state/trigger_state1_test.go
@@ -28,12 +28,12 @@ import (
. "github.com/smartystreets/goconvey/convey"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
diff --git a/tests/plugins/trigger_state/trigger_state2_test.go b/tests/plugins/trigger_state/trigger_state2_test.go
index 5b89ca4a9..5b4534cbb 100644
--- a/tests/plugins/trigger_state/trigger_state2_test.go
+++ b/tests/plugins/trigger_state/trigger_state2_test.go
@@ -27,13 +27,13 @@ import (
. "github.com/smartystreets/goconvey/convey"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/triggers"
auto "github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
diff --git a/tests/plugins/trigger_system/trigger_system_test.go b/tests/plugins/trigger_system/trigger_system_test.go
index f999eac9a..c0517e7d1 100644
--- a/tests/plugins/trigger_system/trigger_system_test.go
+++ b/tests/plugins/trigger_system/trigger_system_test.go
@@ -26,12 +26,12 @@ import (
"go.uber.org/atomic"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/triggers"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
diff --git a/tests/plugins/trigger_time/plugins_test.go b/tests/plugins/trigger_time/plugins_test.go
index 69181c1e7..47d02967d 100644
--- a/tests/plugins/trigger_time/plugins_test.go
+++ b/tests/plugins/trigger_time/plugins_test.go
@@ -26,7 +26,7 @@ import (
"testing"
"time"
- "github.com/e154/smart-home/system/bus"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/system/scripts"
diff --git a/tests/plugins/trigger_time/trigger_time2_test.go b/tests/plugins/trigger_time/trigger_time2_test.go
index f7443fdf3..5e3d308b6 100644
--- a/tests/plugins/trigger_time/trigger_time2_test.go
+++ b/tests/plugins/trigger_time/trigger_time2_test.go
@@ -26,13 +26,13 @@ import (
. "github.com/smartystreets/goconvey/convey"
"go.uber.org/atomic"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
"github.com/e154/smart-home/common/events"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/triggers"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scheduler"
"github.com/e154/smart-home/system/scripts"
diff --git a/tests/plugins/trigger_time/trigger_time_test.go b/tests/plugins/trigger_time/trigger_time_test.go
index fec922135..fa90a6239 100644
--- a/tests/plugins/trigger_time/trigger_time_test.go
+++ b/tests/plugins/trigger_time/trigger_time_test.go
@@ -25,12 +25,12 @@ import (
. "github.com/smartystreets/goconvey/convey"
"go.uber.org/atomic"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/triggers"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scheduler"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
diff --git a/tests/plugins/twilio/twilio_test.go b/tests/plugins/twilio/twilio_test.go
index b65393547..d4d1967aa 100644
--- a/tests/plugins/twilio/twilio_test.go
+++ b/tests/plugins/twilio/twilio_test.go
@@ -26,12 +26,12 @@ import (
notifyCommon "github.com/e154/smart-home/plugins/notify/common"
. "github.com/smartystreets/goconvey/convey"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/plugins/notify"
"github.com/e154/smart-home/plugins/twilio"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
. "github.com/e154/smart-home/tests/plugins"
diff --git a/tests/plugins/weather_met/weather_met_test.go b/tests/plugins/weather_met/weather_met_test.go
index 4efa1279f..e70171407 100644
--- a/tests/plugins/weather_met/weather_met_test.go
+++ b/tests/plugins/weather_met/weather_met_test.go
@@ -26,12 +26,12 @@ import (
. "github.com/smartystreets/goconvey/convey"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/web"
m "github.com/e154/smart-home/models"
weatherPlugin "github.com/e154/smart-home/plugins/weather"
"github.com/e154/smart-home/plugins/weather_met"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/scheduler"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
diff --git a/tests/plugins/zigbee2mqtt/zigbee2mqtt_test.go b/tests/plugins/zigbee2mqtt/zigbee2mqtt_test.go
index ff35b01f8..293f4bd52 100644
--- a/tests/plugins/zigbee2mqtt/zigbee2mqtt_test.go
+++ b/tests/plugins/zigbee2mqtt/zigbee2mqtt_test.go
@@ -24,11 +24,11 @@ import (
"testing"
"time"
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common"
m "github.com/e154/smart-home/models"
"github.com/e154/smart-home/system/automation"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/mqtt"
"github.com/e154/smart-home/system/scripts"
"github.com/e154/smart-home/system/supervisor"
diff --git a/tests/scripts/container/container.go b/tests/scripts/container/container.go
index 1633050ea..90451a554 100644
--- a/tests/scripts/container/container.go
+++ b/tests/scripts/container/container.go
@@ -19,13 +19,13 @@
package container
import (
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/web"
"github.com/e154/smart-home/endpoint"
"github.com/e154/smart-home/system/access_list"
"github.com/e154/smart-home/system/automation"
"github.com/e154/smart-home/system/backup"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/gate/client"
"github.com/e154/smart-home/system/initial"
"github.com/e154/smart-home/system/jwt_manager"
diff --git a/tests/scripts/engine_watcher_test.go b/tests/scripts/engine_watcher_test.go
index ac1f8baac..622017a3f 100644
--- a/tests/scripts/engine_watcher_test.go
+++ b/tests/scripts/engine_watcher_test.go
@@ -20,8 +20,8 @@ package scripts
import (
"fmt"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common/events"
- "github.com/e154/smart-home/system/bus"
"testing"
"time"
diff --git a/tests/scripts/engines_watcher_test.go b/tests/scripts/engines_watcher_test.go
index 91b7460dd..16b773378 100644
--- a/tests/scripts/engines_watcher_test.go
+++ b/tests/scripts/engines_watcher_test.go
@@ -20,8 +20,8 @@ package scripts
import (
"fmt"
+ "github.com/e154/bus"
"github.com/e154/smart-home/common/events"
- "github.com/e154/smart-home/system/bus"
"testing"
"time"
diff --git a/tests/system/container/container.go b/tests/system/container/container.go
index 423a31723..9658cd773 100644
--- a/tests/system/container/container.go
+++ b/tests/system/container/container.go
@@ -19,13 +19,13 @@
package container
import (
+ "github.com/e154/bus"
"github.com/e154/smart-home/adaptors"
"github.com/e154/smart-home/common/web"
"github.com/e154/smart-home/endpoint"
"github.com/e154/smart-home/system/access_list"
"github.com/e154/smart-home/system/automation"
"github.com/e154/smart-home/system/backup"
- "github.com/e154/smart-home/system/bus"
"github.com/e154/smart-home/system/gate/client"
"github.com/e154/smart-home/system/initial"
localMigrations "github.com/e154/smart-home/system/initial/local_migrations"
diff --git a/tests/system/message_queue_test.go b/tests/system/message_queue_test.go
index c7df6fd19..4332470fd 100644
--- a/tests/system/message_queue_test.go
+++ b/tests/system/message_queue_test.go
@@ -24,7 +24,7 @@ import (
"testing"
"time"
- "github.com/e154/smart-home/system/bus"
+ "github.com/e154/bus"
. "github.com/smartystreets/goconvey/convey"
"go.uber.org/atomic"
)