diff --git a/CHANGELOG.md b/CHANGELOG.md index b9c34a7..e764c5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.2.2 + +- Hotfix for `Handled %` before first message is being received (division by zero) + ## 1.2.1 - Fixed incorrect lookup value for Rate (Sent / Received) per device diff --git a/custom_components/edgeos/clients/web_socket.py b/custom_components/edgeos/clients/web_socket.py index 3b35024..ecfe270 100644 --- a/custom_components/edgeos/clients/web_socket.py +++ b/custom_components/edgeos/clients/web_socket.py @@ -105,7 +105,10 @@ def is_initialized(self): @property def messages_handled_percentage(self): - percentage = (self.messages_received - self.messages_ignored) / self.messages_received + received = self.messages_received + ignored = self.messages_ignored + + percentage = 0 if received == 0 else (received - ignored) / received result = f"{percentage:.3%}" return result diff --git a/custom_components/edgeos/manifest.json b/custom_components/edgeos/manifest.json index 9ccb8bc..20d282d 100644 --- a/custom_components/edgeos/manifest.json +++ b/custom_components/edgeos/manifest.json @@ -7,6 +7,6 @@ "codeowners": ["@elad-bar"], "requirements": ["aiohttp"], "config_flow": true, - "version": "1.2.1", + "version": "1.2.2", "iot_class": "local_polling" }