diff --git a/homeassistant/components/unifi/manifest.json b/homeassistant/components/unifi/manifest.json index b472554c537..71e546879b0 100644 --- a/homeassistant/components/unifi/manifest.json +++ b/homeassistant/components/unifi/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/unifi", "requirements": [ - "aiounifi==29" + "aiounifi==30" ], "codeowners": [ "@Kane610" @@ -22,7 +22,7 @@ { "manufacturer": "Ubiquiti Networks", "modelDescription": "UniFi Dream Machine SE" - } + } ], "iot_class": "local_push" -} +} \ No newline at end of file diff --git a/homeassistant/components/unifi/services.py b/homeassistant/components/unifi/services.py index ecf7c33c7ba..c0498395a10 100644 --- a/homeassistant/components/unifi/services.py +++ b/homeassistant/components/unifi/services.py @@ -74,7 +74,7 @@ async def async_reconnect_client(hass, data) -> None: ): continue - await controller.api.clients.async_reconnect(mac) + await controller.api.clients.reconnect(mac) async def async_remove_clients(hass, data) -> None: diff --git a/homeassistant/components/unifi/switch.py b/homeassistant/components/unifi/switch.py index 9b4c942bd30..189c2fabe40 100644 --- a/homeassistant/components/unifi/switch.py +++ b/homeassistant/components/unifi/switch.py @@ -136,9 +136,9 @@ def add_poe_entities(controller, async_add_entities, clients, known_poe_clients) # If poe_enable is False we can't know if a POE client is available for control. if mac not in known_poe_clients and ( mac in controller.wireless_clients - or client.sw_mac not in devices - or not devices[client.sw_mac].ports[client.sw_port].port_poe - or not devices[client.sw_mac].ports[client.sw_port].poe_enable + or client.switch_mac not in devices + or not devices[client.switch_mac].ports[client.switch_port].port_poe + or not devices[client.switch_mac].ports[client.switch_port].poe_enable or controller.mac == client.mac ): continue @@ -153,8 +153,8 @@ def add_poe_entities(controller, async_add_entities, clients, known_poe_clients) if ( client2.is_wired and client.mac != client2.mac - and client.sw_mac == client2.sw_mac - and client.sw_port == client2.sw_port + and client.switch_mac == client2.switch_mac + and client.switch_port == client2.switch_port ): multi_clients_on_port = True break @@ -199,7 +199,7 @@ class UniFiPOEClientSwitch(UniFiClient, SwitchEntity, RestoreEntity): super().__init__(client, controller) self.poe_mode = None - if client.sw_port and self.port.poe_mode != "off": + if client.switch_port and self.port.poe_mode != "off": self.poe_mode = self.port.poe_mode async def async_added_to_hass(self): @@ -214,10 +214,10 @@ class UniFiPOEClientSwitch(UniFiClient, SwitchEntity, RestoreEntity): self.poe_mode = state.attributes.get("poe_mode") - if not self.client.sw_mac: + if not self.client.switch_mac: self.client.raw["sw_mac"] = state.attributes.get("switch") - if not self.client.sw_port: + if not self.client.switch_port: self.client.raw["sw_port"] = state.attributes.get("port") @property @@ -235,26 +235,26 @@ class UniFiPOEClientSwitch(UniFiClient, SwitchEntity, RestoreEntity): return ( self.poe_mode is not None and self.controller.available - and self.client.sw_port - and self.client.sw_mac - and self.client.sw_mac in self.controller.api.devices + and self.client.switch_port + and self.client.switch_mac + and self.client.switch_mac in self.controller.api.devices ) async def async_turn_on(self, **kwargs): """Enable POE for client.""" - await self.device.async_set_port_poe_mode(self.client.sw_port, self.poe_mode) + await self.device.set_port_poe_mode(self.client.switch_port, self.poe_mode) async def async_turn_off(self, **kwargs): """Disable POE for client.""" - await self.device.async_set_port_poe_mode(self.client.sw_port, "off") + await self.device.set_port_poe_mode(self.client.switch_port, "off") @property def extra_state_attributes(self): """Return the device state attributes.""" attributes = { "power": self.port.poe_power, - "switch": self.client.sw_mac, - "port": self.client.sw_port, + "switch": self.client.switch_mac, + "port": self.client.switch_port, "poe_mode": self.poe_mode, } return attributes @@ -262,12 +262,12 @@ class UniFiPOEClientSwitch(UniFiClient, SwitchEntity, RestoreEntity): @property def device(self): """Shortcut to the switch that client is connected to.""" - return self.controller.api.devices[self.client.sw_mac] + return self.controller.api.devices[self.client.switch_mac] @property def port(self): """Shortcut to the switch port that client is connected to.""" - return self.device.ports[self.client.sw_port] + return self.device.ports[self.client.switch_port] async def options_updated(self) -> None: """Config entry options are updated, remove entity if option is disabled.""" @@ -307,11 +307,11 @@ class UniFiBlockClientSwitch(UniFiClient, SwitchEntity): async def async_turn_on(self, **kwargs): """Turn on connectivity for client.""" - await self.controller.api.clients.async_unblock(self.client.mac) + await self.controller.api.clients.unblock(self.client.mac) async def async_turn_off(self, **kwargs): """Turn off connectivity for client.""" - await self.controller.api.clients.async_block(self.client.mac) + await self.controller.api.clients.block(self.client.mac) @property def icon(self): @@ -419,7 +419,7 @@ class UniFiDPIRestrictionSwitch(UniFiBase, SwitchEntity): """Restrict access of apps related to DPI group.""" return await asyncio.gather( *[ - self.controller.api.dpi_apps.async_enable(app_id) + self.controller.api.dpi_apps.enable(app_id) for app_id in self._item.dpiapp_ids ] ) @@ -428,7 +428,7 @@ class UniFiDPIRestrictionSwitch(UniFiBase, SwitchEntity): """Remove restriction of apps related to DPI group.""" return await asyncio.gather( *[ - self.controller.api.dpi_apps.async_disable(app_id) + self.controller.api.dpi_apps.disable(app_id) for app_id in self._item.dpiapp_ids ] ) diff --git a/requirements_all.txt b/requirements_all.txt index 64fd43d25f9..e231fce37dc 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -269,7 +269,7 @@ aiosyncthing==0.5.1 aiotractive==0.5.2 # homeassistant.components.unifi -aiounifi==29 +aiounifi==30 # homeassistant.components.vlc_telnet aiovlc==0.1.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 8fe696a8aef..6f9c2322e21 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -204,7 +204,7 @@ aiosyncthing==0.5.1 aiotractive==0.5.2 # homeassistant.components.unifi -aiounifi==29 +aiounifi==30 # homeassistant.components.vlc_telnet aiovlc==0.1.0