diff --git a/changes.md b/changes.md index 12859aa8..c103d615 100644 --- a/changes.md +++ b/changes.md @@ -1,5 +1,8 @@ # Changes and Feature List +## Version 1.5 MGW LAN Support +* Added support for [MGW Gateway](https://www.piotek.de/PioTek-MGW-POE) (ESP3 over LAN) + ## Version 1.4.4 * Thread sync clean up * Lazy loading for ESP3 libs to prevent dependency issues diff --git a/custom_components/eltako/const.py b/custom_components/eltako/const.py index c3157eb6..4b99febb 100644 --- a/custom_components/eltako/const.py +++ b/custom_components/eltako/const.py @@ -44,6 +44,7 @@ CONF_BASE_ID: Final = "base_id" CONF_DEVICE_TYPE: Final = "device_type" CONF_SERIAL_PATH: Final = "serial_path" +CONF_GATEWAY_ADDRESS: Final = "address" CONF_CUSTOM_SERIAL_PATH: Final = "custom_serial_path" CONF_MAX_TARGET_TEMPERATURE: Final = "max_target_temperature" CONF_MIN_TARGET_TEMPERATURE: Final = "min_target_temperature" @@ -77,6 +78,12 @@ class GatewayDeviceType(str, Enum): GatewayEltakoFGW14USB = 'fgw14usb' GatewayEltakoFAMUSB = 'fam-usb' # ESP2 transceiver: https://www.eltako.com/en/product/professional-standard-en/three-phase-energy-meters-and-one-phase-energy-meters/fam-usb/ EnOceanUSB300 = 'enocean-usb300' # not yet supported + EltakoFAM14 = 'fam14' + EltakoFGW14USB = 'fgw14usb' + EltakoFAMUSB = 'fam-usb' + USB300 = 'enocean-usb300' + ESP3 = 'esp3-gateway' + LAN = 'mgw-lan' @classmethod def find(cls, value): @@ -87,19 +94,30 @@ def find(cls, value): @classmethod def is_transceiver(cls, dev_type) -> bool: - return dev_type in [GatewayDeviceType.GatewayEltakoFAMUSB, GatewayDeviceType.EnOceanUSB300] + return dev_type in [GatewayDeviceType.GatewayEltakoFAMUSB, GatewayDeviceType.EnOceanUSB300, GatewayDeviceType.USB300, GatewayDeviceType.ESP3] @classmethod def is_bus_gateway(cls, dev_type) -> bool: - return dev_type in [GatewayDeviceType.GatewayEltakoFAM14, GatewayDeviceType.GatewayEltakoFGW14USB] + return dev_type in [GatewayDeviceType.GatewayEltakoFAM14, GatewayDeviceType.GatewayEltakoFGW14USB, + GatewayDeviceType.EltakoFAM14, GatewayDeviceType.EltakoFAMUSB, GatewayDeviceType.EltakoFGW14USB] @classmethod def is_esp2_gateway(cls, dev_type) -> bool: - return dev_type in [GatewayDeviceType.GatewayEltakoFAM14, GatewayDeviceType.GatewayEltakoFGW14USB, GatewayDeviceType.GatewayEltakoFAMUSB] + return dev_type in [GatewayDeviceType.GatewayEltakoFAM14, GatewayDeviceType.GatewayEltakoFGW14USB, GatewayDeviceType.GatewayEltakoFAMUSB, + GatewayDeviceType.EltakoFAM14, GatewayDeviceType.EltakoFAMUSB, GatewayDeviceType.EltakoFGW14USB] + + @classmethod + def is_lan_gateway(cls, dev_type) -> bool: + return dev_type in [GatewayDeviceType.LAN] BAUD_RATE_DEVICE_TYPE_MAPPING: dict = { GatewayDeviceType.GatewayEltakoFAM14: 57600, GatewayDeviceType.GatewayEltakoFGW14USB: 57600, GatewayDeviceType.GatewayEltakoFAMUSB: 9600, GatewayDeviceType.EnOceanUSB300: 57600, + GatewayDeviceType.EltakoFAM14: 57600, + GatewayDeviceType.EltakoFGW14USB: 57600, + GatewayDeviceType.EltakoFAMUSB: 9600, + GatewayDeviceType.USB300: 57600, + GatewayDeviceType.ESP3: 57600, } \ No newline at end of file diff --git a/custom_components/eltako/gateway.py b/custom_components/eltako/gateway.py index e9d5a936..09454f6c 100644 --- a/custom_components/eltako/gateway.py +++ b/custom_components/eltako/gateway.py @@ -127,6 +127,9 @@ 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) + elif GatewayDeviceType.is_lan_gateway(self.dev_type): + from esp2_gateway_adapter.esp3_tcp_com import TCP2SerialCommunicator + self._bus = TCP2SerialCommunicator(host=self.serial_path, port=5100, callback=self._callback_receive_message_from_serial_bus, esp2_translation_enabled=True) else: # lazy import to avoid preloading library from esp2_gateway_adapter.esp3_serial_com import ESP3SerialCommunicator diff --git a/custom_components/eltako/manifest.json b/custom_components/eltako/manifest.json index 90b9cd0b..fc1dc2c5 100644 --- a/custom_components/eltako/manifest.json +++ b/custom_components/eltako/manifest.json @@ -9,6 +9,6 @@ "iot_class": "local_push", "issue_tracker": "https://github.com/grimmpp/home-assistant-eltako/issues", "loggers": ["eltako"], - "requirements": ["eltako14bus==0.0.52", "enocean==0.60.1", "StrEnum", "esp2-gateway-adapter==0.1"], + "requirements": ["eltako14bus==0.0.53", "enocean==0.60.1", "StrEnum", "esp2-gateway-adapter==0.2.2"], "version": "1.4.4" } diff --git a/custom_components/eltako/schema.py b/custom_components/eltako/schema.py index 9de19698..b8b3715d 100644 --- a/custom_components/eltako/schema.py +++ b/custom_components/eltako/schema.py @@ -263,6 +263,7 @@ class GatewaySchema(EltakoPlatformSchema): vol.Required(CONF_BASE_ID): cv.matches_regex(CONF_ID_REGEX), vol.Optional(CONF_NAME, default=""): cv.string, vol.Optional(CONF_SERIAL_PATH): cv.string, + vol.Optional(CONF_GATEWAY_ADDRESS): cv.string, vol.Optional(CONF_DEVICES): vol.All(vol.Schema({ **BinarySensorSchema.platform_node(), **LightSchema.platform_node(), diff --git a/requirements.txt b/requirements.txt index 4c304392..71843561 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ aiocoap pyserial-asyncio -eltako14bus==0.0.52 +eltako14bus==0.0.53 enocean==0.60.1 homeassistant termcolor StrEnum -esp2-gateway-adapter==0.1 \ No newline at end of file +esp2-gateway-adapter==0.2.2 \ No newline at end of file