From 60e978dcbab87b179bfdc1fe05f009a3b5e7b2ba Mon Sep 17 00:00:00 2001 From: Yevhenii Vaskivskyi Date: Wed, 3 Jan 2024 07:03:31 +0100 Subject: [PATCH] 0.27.2 (#759) * Add device info connections for clients (#756) * Bump version to `0.27.2` * Explicitly assign empty string for pc rule name when not provided (#758) --- custom_components/asusrouter/bridge.py | 2 +- custom_components/asusrouter/manifest.json | 2 +- custom_components/asusrouter/switch.py | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/custom_components/asusrouter/bridge.py b/custom_components/asusrouter/bridge.py index 5076f05..8e07c89 100644 --- a/custom_components/asusrouter/bridge.py +++ b/custom_components/asusrouter/bridge.py @@ -594,7 +594,7 @@ def _pc_device2rule( return ParentalControlRule( mac=mac.upper(), - name=device.get("name", None), + name=device.get("name", ""), type=rule_type, ) diff --git a/custom_components/asusrouter/manifest.json b/custom_components/asusrouter/manifest.json index 3a8cf95..53503a6 100644 --- a/custom_components/asusrouter/manifest.json +++ b/custom_components/asusrouter/manifest.json @@ -14,5 +14,5 @@ "manufacturer": "ASUSTeK Computer Inc." } ], - "version": "0.27.1" + "version": "0.27.2" } diff --git a/custom_components/asusrouter/switch.py b/custom_components/asusrouter/switch.py index aa65004..1fce66f 100644 --- a/custom_components/asusrouter/switch.py +++ b/custom_components/asusrouter/switch.py @@ -9,7 +9,7 @@ from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback -from homeassistant.helpers.device_registry import format_mac +from homeassistant.helpers import device_registry as dr from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback @@ -150,7 +150,7 @@ def __init__( self._router = router self._rule = rule - self._mac = format_mac(rule.mac) + self._mac = dr.format_mac(rule.mac) self._attr_unique_id = to_unique_id(f"{router.mac}_{self._mac}_block_internet") self._attr_name = f"{rule.name} Block Internet" @@ -162,6 +162,7 @@ def _compile_device_info(self) -> DeviceInfo: """Compile device info.""" return DeviceInfo( + connections={(dr.CONNECTION_NETWORK_MAC, self._mac)}, identifiers={ (DOMAIN, self._mac), },