Replace webexteamssdk with webexpythonsdk (#127928)

This commit is contained in:
DJ 2024-10-15 17:54:59 +02:00 committed by GitHub
parent 36a1eaedcf
commit aac5ac6057
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 13 deletions

View File

@ -1 +1 @@
"""Component to integrate the Cisco Webex Teams cloud."""
"""Component to integrate the Cisco Webex cloud."""

View File

@ -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"]
}

View File

@ -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 @@ class CiscoWebexTeamsNotificationService(BaseNotificationService):
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
)

View File

@ -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