From 503d43c2aae6f5346e5149038ae29fde4eb01a15 Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Sun, 17 Nov 2024 17:35:37 +0200 Subject: [PATCH] Fix MacAddressMismatchError check for RPC devices (#715) --- aioshelly/rpc_device/device.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aioshelly/rpc_device/device.py b/aioshelly/rpc_device/device.py index 08964e34..e0131b19 100644 --- a/aioshelly/rpc_device/device.py +++ b/aioshelly/rpc_device/device.py @@ -294,6 +294,11 @@ async def _init_calls(self) -> None: self.options.password, ) + mac = self.shelly["mac"] + device_mac = self.options.device_mac + if device_mac and device_mac != mac: + raise MacAddressMismatchError(f"Input MAC: {device_mac}, Shelly MAC: {mac}") + calls: list[tuple[str, dict[str, Any] | None]] = [("Shelly.GetConfig", None)] if fetch_status := self._status is None: calls.append(("Shelly.GetStatus", None))