mirror of
https://github.com/home-assistant/core.git
synced 2026-07-08 23:34:22 +01:00
Remove MS Teams integration (#173643)
This commit is contained in:
Generated
-1
@@ -1155,7 +1155,6 @@ CLAUDE.md @home-assistant/core
|
||||
/tests/components/motionmount/ @laiho-vogels
|
||||
/homeassistant/components/mqtt/ @emontnemery @jbouwh @bdraco
|
||||
/tests/components/mqtt/ @emontnemery @jbouwh @bdraco
|
||||
/homeassistant/components/msteams/ @peroyvind
|
||||
/homeassistant/components/mta/ @OnFreund
|
||||
/tests/components/mta/ @OnFreund
|
||||
/homeassistant/components/mullvad/ @meichthys
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
"microsoft_face_identify",
|
||||
"microsoft_face",
|
||||
"microsoft",
|
||||
"msteams",
|
||||
"onedrive",
|
||||
"onedrive_for_business",
|
||||
"xbox"
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
{
|
||||
"domain": "msteams",
|
||||
"name": "Microsoft Teams",
|
||||
"codeowners": ["@peroyvind"],
|
||||
"codeowners": [],
|
||||
"documentation": "https://www.home-assistant.io/integrations/msteams",
|
||||
"iot_class": "cloud_push",
|
||||
"loggers": ["pymsteams"],
|
||||
"quality_scale": "legacy",
|
||||
"requirements": ["pymsteams==0.1.12"]
|
||||
"quality_scale": "legacy"
|
||||
}
|
||||
|
||||
@@ -1,75 +1,32 @@
|
||||
"""Microsoft Teams platform for notify component."""
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import pymsteams
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA,
|
||||
ATTR_TITLE,
|
||||
ATTR_TITLE_DEFAULT,
|
||||
PLATFORM_SCHEMA as NOTIFY_PLATFORM_SCHEMA,
|
||||
BaseNotificationService,
|
||||
)
|
||||
from homeassistant.components.notify import PLATFORM_SCHEMA as NOTIFY_PLATFORM_SCHEMA
|
||||
from homeassistant.const import CONF_URL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers import config_validation as cv, issue_registry as ir
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
ATTR_FILE_URL = "image_url"
|
||||
DOMAIN = "msteams"
|
||||
|
||||
PLATFORM_SCHEMA = NOTIFY_PLATFORM_SCHEMA.extend({vol.Required(CONF_URL): cv.url})
|
||||
|
||||
|
||||
def get_service(
|
||||
async def async_get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> MSTeamsNotificationService | None:
|
||||
) -> None:
|
||||
"""Get the Microsoft Teams notification service."""
|
||||
webhook_url = config.get(CONF_URL)
|
||||
|
||||
try:
|
||||
return MSTeamsNotificationService(webhook_url)
|
||||
|
||||
except RuntimeError:
|
||||
_LOGGER.exception("Error in creating a new Microsoft Teams message")
|
||||
return None
|
||||
|
||||
|
||||
class MSTeamsNotificationService(BaseNotificationService):
|
||||
"""Implement the notification service for Microsoft Teams."""
|
||||
|
||||
def __init__(self, webhook_url):
|
||||
"""Initialize the service."""
|
||||
self._webhook_url = webhook_url
|
||||
|
||||
def send_message(self, message: str = "", **kwargs: Any) -> None:
|
||||
"""Send a message to the webhook."""
|
||||
|
||||
teams_message = pymsteams.connectorcard(self._webhook_url)
|
||||
|
||||
title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT)
|
||||
data = kwargs.get(ATTR_DATA)
|
||||
|
||||
teams_message.title(title)
|
||||
|
||||
teams_message.text(message)
|
||||
|
||||
if data is not None and (file_url := data.get(ATTR_FILE_URL)) is not None:
|
||||
if not file_url.startswith("http"):
|
||||
_LOGGER.error("URL should start with http or https")
|
||||
return
|
||||
|
||||
message_section = pymsteams.cardsection()
|
||||
message_section.addImage(file_url)
|
||||
teams_message.addSection(message_section)
|
||||
try:
|
||||
teams_message.send()
|
||||
# pylint: disable-next=home-assistant-action-swallowed-exception
|
||||
except RuntimeError as err:
|
||||
_LOGGER.error("Could not send notification. Error: %s", err)
|
||||
ir.async_create_issue(
|
||||
hass,
|
||||
DOMAIN,
|
||||
DOMAIN,
|
||||
is_fixable=False,
|
||||
severity=ir.IssueSeverity.ERROR,
|
||||
translation_key="integration_removed",
|
||||
translation_placeholders={
|
||||
CONF_URL: "https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/"
|
||||
},
|
||||
)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"issues": {
|
||||
"integration_removed": {
|
||||
"description": "The Microsoft Teams integration has been removed from Home Assistant.\n\nThe [Office 365 Connectors]({url}) used by this integration to send messages to Microsoft Teams have been discontinued by Microsoft and are no longer supported.\n\nTo resolve this issue, remove the Microsoft Teams integration configuration from your `configuration.yaml` file and restart Home Assistant.\n\nOnce the configuration has been removed and Home Assistant has restarted, this issue will no longer be shown.",
|
||||
"title": "Microsoft Teams integration has been removed"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4324,12 +4324,6 @@
|
||||
"iot_class": "cloud_push",
|
||||
"name": "Microsoft Text-to-Speech (TTS)"
|
||||
},
|
||||
"msteams": {
|
||||
"integration_type": "hub",
|
||||
"config_flow": false,
|
||||
"iot_class": "cloud_push",
|
||||
"name": "Microsoft Teams"
|
||||
},
|
||||
"onedrive": {
|
||||
"integration_type": "service",
|
||||
"config_flow": true,
|
||||
@@ -4563,6 +4557,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"msteams": {
|
||||
"name": "Microsoft Teams",
|
||||
"integration_type": "hub",
|
||||
"config_flow": false,
|
||||
"iot_class": "cloud_push"
|
||||
},
|
||||
"mta": {
|
||||
"name": "MTA New York City Transit",
|
||||
"integration_type": "service",
|
||||
|
||||
Generated
-3
@@ -2366,9 +2366,6 @@ pymodbus==3.11.2
|
||||
# homeassistant.components.monoprice
|
||||
pymonoprice==0.5
|
||||
|
||||
# homeassistant.components.msteams
|
||||
pymsteams==0.1.12
|
||||
|
||||
# homeassistant.components.mysensors
|
||||
pymysensors==0.26.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user