diff --git a/apps/app1/database.py b/apps/app1/database.py index 9288e0e..c58bb21 100644 --- a/apps/app1/database.py +++ b/apps/app1/database.py @@ -4,5 +4,3 @@ from appdaemon.adapi import ADAPI class Database: def __init__(self, ad: ADAPI) -> None: self.ad = ad - # self.ad.logger.info(' NEW LOG LINE Database '.center(50, '=')) - # self.ad.call_service() diff --git a/apps/app1/notification.py b/apps/app1/notification.py index cafb9e5..8437ff2 100644 --- a/apps/app1/notification.py +++ b/apps/app1/notification.py @@ -4,7 +4,9 @@ from appdaemon.adapi import ADAPI class Notification: def __init__(self, ad: ADAPI) -> None: self.ad = ad - # self.ad.logger.info(' NEW LOG LINE '.center(50, '=')) + self.log = self.ad.logger.info + self.log('Notification initialize') + # self.ad.logger.info(' NOTIFICATION '.center(50, '-')) def send(self, message: str = "message not specified") -> None: - self.ad.log(message, level="DEBUG") + self.ad.log(f'NOTIFICATION: {message}', level="DEBUG") diff --git a/apps/app1/subdir/__init__.py b/apps/app1/subdir/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/app1/subdir/foo.py b/apps/app1/subdir/foo.py index 761206a..d63b2f3 100644 --- a/apps/app1/subdir/foo.py +++ b/apps/app1/subdir/foo.py @@ -1,6 +1,9 @@ +from pathlib import Path + from appdaemon.adapi import ADAPI + class Foo(ADAPI): def initialize(self): - self.log(f'Initialized from {__file__}') - \ No newline at end of file + self.log(f'Initialized app from {Path(__file__).relative_to(self.AD.app_dir.parent)}') + # self.log(' FOO '.center(50, '-')) diff --git a/apps/app2/database.py b/apps/app2/database.py index 7f57f5f..254bc26 100644 --- a/apps/app2/database.py +++ b/apps/app2/database.py @@ -4,6 +4,7 @@ from app1.subdir.foo import Foo class OtherDatabaseApp(Foo): def initialize(self): + super().initialize() self.log(f'Initialized from {__file__}') - self.log(' CHANGE '.center(50, '=')) + # self.log(' CHANGE '.center(50, '-')) \ No newline at end of file diff --git a/apps/databases.yaml b/apps/databases.yaml index efb2b5f..bb1f0a0 100644 --- a/apps/databases.yaml +++ b/apps/databases.yaml @@ -4,6 +4,12 @@ App1: other_kwargs: value dependencies: Sound +App1Foo: + module: app1.subdir.foo + class: Foo + dependencies: + - companion_app + App2: module: app2.database class: OtherDatabaseApp @@ -11,9 +17,3 @@ App2: - App1 - App1Foo - globals - -App1Foo: - module: app1.subdir.foo - class: Foo - globals: - - hello diff --git a/apps/test/test.yaml b/apps/test/test.yaml index b97632c..e76fae6 100644 --- a/apps/test/test.yaml +++ b/apps/test/test.yaml @@ -1,5 +1,5 @@ -test: - module: test - class: Test +test_notifier: + module: test_notify + class: TestNotifier log_level: DEBUG dependencies: companion_app \ No newline at end of file diff --git a/apps/test/test.py b/apps/test/test_notify.py similarity index 50% rename from apps/test/test.py rename to apps/test/test_notify.py index fa3941d..9f98367 100644 --- a/apps/test/test.py +++ b/apps/test/test_notify.py @@ -2,8 +2,10 @@ from app1.notification import Notification from appdaemon.adbase import ADBase -class Test(ADBase): +class TestNotifier(ADBase): def initialize(self): self.adapi = self.get_ad_api() + self.log = self.adapi.log + self.log(f'Initialized test notifier class: {self.__class__.__name__}') self.notify = Notification(self.adapi) - self.notify.send("Test notification from Test2 app.") + self.notify.send("Some notifications")