Skip to content

Commit

Permalink
Replace webexteamssdk with webexpythonsdk (home-assistant#127928)
Browse files Browse the repository at this point in the history
  • Loading branch information
DJF3 authored Oct 15, 2024
1 parent 36a1eae commit aac5ac6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/cisco_webex_teams/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Component to integrate the Cisco Webex Teams cloud."""
"""Component to integrate the Cisco Webex cloud."""
5 changes: 2 additions & 3 deletions homeassistant/components/cisco_webex_teams/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
18 changes: 9 additions & 9 deletions homeassistant/components/cisco_webex_teams/notify.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -30,21 +30,21 @@ 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])
except exceptions.ApiError as error:
_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."""
Expand All @@ -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
)
3 changes: 3 additions & 0 deletions requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit aac5ac6

Please sign in to comment.