From aac5ac605705d8bb10a0576d8baa37e2d91c09ee Mon Sep 17 00:00:00 2001 From: DJ Date: Tue, 15 Oct 2024 17:54:59 +0200 Subject: [PATCH] Replace webexteamssdk with webexpythonsdk (#127928) --- .../components/cisco_webex_teams/__init__.py | 2 +- .../components/cisco_webex_teams/manifest.json | 5 ++--- .../components/cisco_webex_teams/notify.py | 18 +++++++++--------- requirements_all.txt | 3 +++ 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/cisco_webex_teams/__init__.py b/homeassistant/components/cisco_webex_teams/__init__.py index 0a8714806a18f3..5932f2ed680756 100644 --- a/homeassistant/components/cisco_webex_teams/__init__.py +++ b/homeassistant/components/cisco_webex_teams/__init__.py @@ -1 +1 @@ -"""Component to integrate the Cisco Webex Teams cloud.""" +"""Component to integrate the Cisco Webex cloud.""" diff --git a/homeassistant/components/cisco_webex_teams/manifest.json b/homeassistant/components/cisco_webex_teams/manifest.json index 822919213c2791..3da31a0b453a06 100644 --- a/homeassistant/components/cisco_webex_teams/manifest.json +++ b/homeassistant/components/cisco_webex_teams/manifest.json @@ -2,9 +2,8 @@ "domain": "cisco_webex_teams", "name": "Cisco Webex Teams", "codeowners": ["@fbradyirl"], - "disabled": "Integration library not compatible with Python 3.12", "documentation": "https://www.home-assistant.io/integrations/cisco_webex_teams", "iot_class": "cloud_push", - "loggers": ["webexteamssdk"], - "requirements": ["webexteamssdk==1.1.1;python_version<'3.12'"] + "loggers": ["webexpythonsdk"], + "requirements": ["webexpythonsdk==2.0.1"] } diff --git a/homeassistant/components/cisco_webex_teams/notify.py b/homeassistant/components/cisco_webex_teams/notify.py index b93ebb273dd9df..74d033c62d4edb 100644 --- a/homeassistant/components/cisco_webex_teams/notify.py +++ b/homeassistant/components/cisco_webex_teams/notify.py @@ -1,11 +1,11 @@ -"""Cisco Webex Teams notify component.""" +"""Cisco Webex notify component.""" from __future__ import annotations import logging import voluptuous as vol -from webexteamssdk import ApiError, WebexTeamsAPI, exceptions +from webexpythonsdk import ApiError, WebexAPI, exceptions from homeassistant.components.notify import ( ATTR_TITLE, @@ -30,9 +30,9 @@ def get_service( hass: HomeAssistant, config: ConfigType, discovery_info: DiscoveryInfoType | None = None, -) -> CiscoWebexTeamsNotificationService | None: - """Get the CiscoWebexTeams notification service.""" - client = WebexTeamsAPI(access_token=config[CONF_TOKEN]) +) -> CiscoWebexNotificationService | None: + """Get the Cisco Webex notification service.""" + client = WebexAPI(access_token=config[CONF_TOKEN]) try: # Validate the token & room_id client.rooms.get(config[CONF_ROOM_ID]) @@ -40,11 +40,11 @@ def get_service( _LOGGER.error(error) return None - return CiscoWebexTeamsNotificationService(client, config[CONF_ROOM_ID]) + return CiscoWebexNotificationService(client, config[CONF_ROOM_ID]) -class CiscoWebexTeamsNotificationService(BaseNotificationService): - """The Cisco Webex Teams Notification Service.""" +class CiscoWebexNotificationService(BaseNotificationService): + """The Cisco Webex Notification Service.""" def __init__(self, client, room): """Initialize the service.""" @@ -62,5 +62,5 @@ def send_message(self, message="", **kwargs): self.client.messages.create(roomId=self.room, html=f"{title}{message}") except ApiError as api_error: _LOGGER.error( - "Could not send CiscoWebexTeams notification. Error: %s", api_error + "Could not send Cisco Webex notification. Error: %s", api_error ) diff --git a/requirements_all.txt b/requirements_all.txt index 609a3f8f46a47b..897d7d7bc70c54 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2958,6 +2958,9 @@ waterfurnace==1.1.0 # homeassistant.components.weatherflow_cloud weatherflow4py==1.0.6 +# homeassistant.components.cisco_webex_teams +webexpythonsdk==2.0.1 + # homeassistant.components.webmin webmin-xmlrpc==0.0.2