some renames and other changes
This commit is contained in:
@@ -4,5 +4,3 @@ from appdaemon.adapi import ADAPI
|
|||||||
class Database:
|
class Database:
|
||||||
def __init__(self, ad: ADAPI) -> None:
|
def __init__(self, ad: ADAPI) -> None:
|
||||||
self.ad = ad
|
self.ad = ad
|
||||||
# self.ad.logger.info(' NEW LOG LINE Database '.center(50, '='))
|
|
||||||
# self.ad.call_service()
|
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ from appdaemon.adapi import ADAPI
|
|||||||
class Notification:
|
class Notification:
|
||||||
def __init__(self, ad: ADAPI) -> None:
|
def __init__(self, ad: ADAPI) -> None:
|
||||||
self.ad = ad
|
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:
|
def send(self, message: str = "message not specified") -> None:
|
||||||
self.ad.log(message, level="DEBUG")
|
self.ad.log(f'NOTIFICATION: {message}', level="DEBUG")
|
||||||
|
|||||||
0
apps/app1/subdir/__init__.py
Normal file
0
apps/app1/subdir/__init__.py
Normal file
@@ -1,6 +1,9 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from appdaemon.adapi import ADAPI
|
from appdaemon.adapi import ADAPI
|
||||||
|
|
||||||
|
|
||||||
class Foo(ADAPI):
|
class Foo(ADAPI):
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
self.log(f'Initialized from {__file__}')
|
self.log(f'Initialized app from {Path(__file__).relative_to(self.AD.app_dir.parent)}')
|
||||||
|
# self.log(' FOO '.center(50, '-'))
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from app1.subdir.foo import Foo
|
|||||||
|
|
||||||
class OtherDatabaseApp(Foo):
|
class OtherDatabaseApp(Foo):
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
|
super().initialize()
|
||||||
self.log(f'Initialized from {__file__}')
|
self.log(f'Initialized from {__file__}')
|
||||||
self.log(' CHANGE '.center(50, '='))
|
# self.log(' CHANGE '.center(50, '-'))
|
||||||
|
|
||||||
@@ -4,6 +4,12 @@ App1:
|
|||||||
other_kwargs: value
|
other_kwargs: value
|
||||||
dependencies: Sound
|
dependencies: Sound
|
||||||
|
|
||||||
|
App1Foo:
|
||||||
|
module: app1.subdir.foo
|
||||||
|
class: Foo
|
||||||
|
dependencies:
|
||||||
|
- companion_app
|
||||||
|
|
||||||
App2:
|
App2:
|
||||||
module: app2.database
|
module: app2.database
|
||||||
class: OtherDatabaseApp
|
class: OtherDatabaseApp
|
||||||
@@ -11,9 +17,3 @@ App2:
|
|||||||
- App1
|
- App1
|
||||||
- App1Foo
|
- App1Foo
|
||||||
- globals
|
- globals
|
||||||
|
|
||||||
App1Foo:
|
|
||||||
module: app1.subdir.foo
|
|
||||||
class: Foo
|
|
||||||
globals:
|
|
||||||
- hello
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
test:
|
test_notifier:
|
||||||
module: test
|
module: test_notify
|
||||||
class: Test
|
class: TestNotifier
|
||||||
log_level: DEBUG
|
log_level: DEBUG
|
||||||
dependencies: companion_app
|
dependencies: companion_app
|
||||||
@@ -2,8 +2,10 @@ from app1.notification import Notification
|
|||||||
from appdaemon.adbase import ADBase
|
from appdaemon.adbase import ADBase
|
||||||
|
|
||||||
|
|
||||||
class Test(ADBase):
|
class TestNotifier(ADBase):
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
self.adapi = self.get_ad_api()
|
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 = Notification(self.adapi)
|
||||||
self.notify.send("Test notification from Test2 app.")
|
self.notify.send("Some notifications")
|
||||||
Reference in New Issue
Block a user