Skip to content

Commit

Permalink
lazy loading for esp3 libs
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed May 17, 2024
1 parent 4a54e41 commit e52b662
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Version 1.4.4
* Thread sync clean up
* Lazy loading for ESP3 libs to prevent dependency issues

## Version 1.4.3 Compatibility to HA 2024.5
* 🐞 Incompatibility with HA 2024.5 fixed. (Cleaned up event loop synchronization)
Expand Down
3 changes: 2 additions & 1 deletion custom_components/eltako/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

from .const import *
from . import config_helpers
from esp2_gateway_adapter.esp3_serial_com import ESP3SerialCommunicator


async def async_get_base_ids_of_registered_gateway(device_registry: DeviceRegistry) -> list[str]:
Expand Down Expand Up @@ -129,6 +128,8 @@ def _init_bus(self):
if GatewayDeviceType.is_esp2_gateway(self.dev_type):
self._bus = RS485SerialInterfaceV2(self.serial_path, baud_rate=self.baud_rate, callback=self._callback_receive_message_from_serial_bus)
else:
# lazy import to avoid preloading library
from esp2_gateway_adapter.esp3_serial_com import ESP3SerialCommunicator
self._bus = ESP3SerialCommunicator(filename=self.serial_path, callback=self._callback_receive_message_from_serial_bus, esp2_translation_enabled=True)

self._bus.set_status_changed_handler(self._fire_connection_state_changed_event)
Expand Down

0 comments on commit e52b662

Please sign in to comment.