Added dynamic platform loader
This commit is contained in:
@ -1,2 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
from .loopingtimer import LoopingTimer
|
||||
from .platform import BirbnetesIoTPlatformStatusDriver, BirbnetesIoTPlatformRecordDriver, \
|
||||
BirbnetesIoTPlatformPlaybackDriver
|
||||
|
@ -34,3 +34,5 @@ REPORT_URL = os.environ.get("REPORT_URL", None)
|
||||
REPORT_INTERVAL = float(os.environ.get("REPORT_INTERVAL", 15))
|
||||
|
||||
DISABLE_AI = os.environ.get("DISABLE_AI").lower() in ['yes', '1', 'true']
|
||||
|
||||
PLATFORM = os.environ.get("PLATFORM", "raspberry")
|
||||
|
18
src/utils/platform.py
Normal file
18
src/utils/platform.py
Normal file
@ -0,0 +1,18 @@
|
||||
import config
|
||||
|
||||
if config.PLATFORM == 'raspberry':
|
||||
from birbnetes_iot_platform_raspberry import BirbnetesIoTPlatformStatusDriver, BirbnetesIoTPlatformRecordDriver, \
|
||||
BirbnetesIoTPlatformPlaybackDriver
|
||||
|
||||
elif config.PLATFORM == 'emulator':
|
||||
from birbnetes_iot_platform_emulator import BirbnetesIoTPlatformStatusDriver, BirbnetesIoTPlatformRecordDriver, \
|
||||
BirbnetesIoTPlatformPlaybackDriver
|
||||
|
||||
else:
|
||||
raise ModuleNotFoundError(f"Could not load platform driver for {config.PLATFORM}")
|
||||
|
||||
__all__ = [
|
||||
'BirbnetesIoTPlatformStatusDriver',
|
||||
'BirbnetesIoTPlatformRecordDriver',
|
||||
'BirbnetesIoTPlatformPlaybackDriver'
|
||||
]
|
Reference in New Issue
Block a user