simple fixes
This commit is contained in:
@@ -12,17 +12,16 @@ simple_app:
|
||||
# dependencies:
|
||||
# - hello_world
|
||||
|
||||
|
||||
base_app:
|
||||
module: simple
|
||||
class: BaseApp
|
||||
|
||||
AppA:
|
||||
module: app_a
|
||||
class: AppA
|
||||
dependencies:
|
||||
- AppB # This is only set to demonstrate forcing it to load after AppB
|
||||
# AppA:
|
||||
# module: app_a
|
||||
# class: AppA
|
||||
# dependencies:
|
||||
# - AppB # This is only set to demonstrate forcing it to load after AppB
|
||||
|
||||
AppB:
|
||||
module: app_b
|
||||
class: AppB
|
||||
# AppB:
|
||||
# module: app_b
|
||||
# class: AppB
|
||||
|
||||
@@ -10,14 +10,15 @@ from appdaemon.adapi import ADAPI
|
||||
# fake/
|
||||
# SimpleApp
|
||||
|
||||
|
||||
class HelloWorld(ADAPI):
|
||||
def initialize(self):
|
||||
def initialize(self) -> None:
|
||||
self.log(f'{self.__class__.__name__} Initialized')
|
||||
self.log('+' * 50)
|
||||
# fake
|
||||
self.register_service("my_domain/my_exciting_service", self.my_exciting_cb)
|
||||
self.register_service('my_domain/my_exciting_service', self.my_exciting_cb)
|
||||
|
||||
def my_exciting_cb(self, *args: str, my_arg: int = 0, **kwargs: Any) -> Any:
|
||||
namespace, domain, service = args
|
||||
self.log(f"Service {domain}/{service} in the {namespace} namepsace called with {kwargs}")
|
||||
self.log(f'Service {domain}/{service} in the {namespace} namepsace called with {kwargs}')
|
||||
return 999 + my_arg
|
||||
|
||||
@@ -8,7 +8,7 @@ class SimpleApp(Hass):
|
||||
match self.ping():
|
||||
case float() as ping:
|
||||
ping = utils.format_timedelta(ping)
|
||||
self.log(f"{self.__class__.__name__} Initialized: {ping}")
|
||||
self.log(f'{self.__class__.__name__} Initialized: {ping}')
|
||||
case _:
|
||||
pass
|
||||
|
||||
@@ -17,5 +17,5 @@ class BaseApp(ADBase):
|
||||
def initialize(self) -> None:
|
||||
self.adapi = self.get_ad_api()
|
||||
self.log = self.adapi.log
|
||||
self.hassapi = self.get_plugin_api("HASS")
|
||||
assert isinstance(self.hassapi, Hass), "HASS API not available"
|
||||
self.hassapi = self.get_plugin_api('HASS')
|
||||
assert isinstance(self.hassapi, Hass), 'HASS API not available'
|
||||
|
||||
Reference in New Issue
Block a user