diff --git a/homeassistant/components/gitter/__init__.py b/homeassistant/components/gitter/__init__.py deleted file mode 100644 index 25656f70f567..000000000000 --- a/homeassistant/components/gitter/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The gitter component.""" diff --git a/homeassistant/components/gitter/manifest.json b/homeassistant/components/gitter/manifest.json index c578f7c2242f..c93b879f6219 100644 --- a/homeassistant/components/gitter/manifest.json +++ b/homeassistant/components/gitter/manifest.json @@ -1,10 +1,6 @@ { "domain": "gitter", "name": "Gitter", - "codeowners": [], - "documentation": "https://www.home-assistant.io/integrations/gitter", - "iot_class": "cloud_polling", - "loggers": ["gitterpy"], - "quality_scale": "legacy", - "requirements": ["gitterpy==0.1.7"] + "integration_type": "virtual", + "supported_by": "matrix" } diff --git a/homeassistant/components/gitter/sensor.py b/homeassistant/components/gitter/sensor.py deleted file mode 100644 index e6bb52c5519a..000000000000 --- a/homeassistant/components/gitter/sensor.py +++ /dev/null @@ -1,117 +0,0 @@ -"""Support for displaying details about a Gitter.im chat room.""" - -import logging -from typing import Any, override - -from gitterpy.client import GitterClient -from gitterpy.errors import GitterRoomError, GitterTokenError -import voluptuous as vol - -from homeassistant.components.sensor import ( - PLATFORM_SCHEMA as SENSOR_PLATFORM_SCHEMA, - SensorEntity, -) -from homeassistant.const import CONF_API_KEY, CONF_NAME, CONF_ROOM -from homeassistant.core import HomeAssistant -from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType - -_LOGGER = logging.getLogger(__name__) - -ATTR_MENTION = "mention" -ATTR_ROOM = "room" -ATTR_USERNAME = "username" - -DEFAULT_NAME = "Gitter messages" -DEFAULT_ROOM = "home-assistant/home-assistant" - - -PLATFORM_SCHEMA = SENSOR_PLATFORM_SCHEMA.extend( - { - vol.Required(CONF_API_KEY): cv.string, - vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - vol.Optional(CONF_ROOM, default=DEFAULT_ROOM): cv.string, - } -) - - -def setup_platform( - hass: HomeAssistant, - config: ConfigType, - add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Set up the Gitter sensor.""" - - name = config.get(CONF_NAME) - api_key = config.get(CONF_API_KEY) - room = config.get(CONF_ROOM) - - gitter = GitterClient(api_key) - try: - username = gitter.auth.get_my_id["name"] - except GitterTokenError: - _LOGGER.error("Token is not valid") - return - - add_entities([GitterSensor(gitter, room, name, username)], True) - - -class GitterSensor(SensorEntity): - """Representation of a Gitter sensor.""" - - _attr_icon = "mdi:message-cog" - - def __init__(self, data, room, name, username): - """Initialize the sensor.""" - self._name = name - self._data = data - self._room = room - self._username = username - self._state = None - self._mention = 0 - self._unit_of_measurement = "Msg" - - @property - @override - def name(self): - """Return the name of the sensor.""" - return self._name - - @property - @override - def native_value(self): - """Return the state of the sensor.""" - return self._state - - @property - @override - def native_unit_of_measurement(self): - """Return the unit the value is expressed in.""" - return self._unit_of_measurement - - @property - @override - def extra_state_attributes(self) -> dict[str, Any]: - """Return the state attributes.""" - return { - ATTR_USERNAME: self._username, - ATTR_ROOM: self._room, - ATTR_MENTION: self._mention, - } - - def update(self) -> None: - """Get the latest data and updates the state.""" - - try: - data = self._data.user.unread_items(self._room) - except GitterRoomError as error: - _LOGGER.error(error) - return - - if "error" not in data: - self._mention = len(data["mention"]) - self._state = len(data["chat"]) - else: - _LOGGER.error("Not joined: %s", self._room) diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index e0884d60762f..4ee7c315ed76 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -2477,9 +2477,8 @@ }, "gitter": { "name": "Gitter", - "integration_type": "hub", - "config_flow": false, - "iot_class": "cloud_polling" + "integration_type": "virtual", + "supported_by": "matrix" }, "glances": { "name": "Glances", diff --git a/requirements_all.txt b/requirements_all.txt index f6fd7b78bf36..682240bbc4cf 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1105,9 +1105,6 @@ getmac==0.9.5 # homeassistant.components.gios gios==7.1.0 -# homeassistant.components.gitter -gitterpy==0.1.7 - # homeassistant.components.glances glances-api==0.10.0 diff --git a/script/hassfest/quality_scale.py b/script/hassfest/quality_scale.py index 525008f2f831..db650a140fca 100644 --- a/script/hassfest/quality_scale.py +++ b/script/hassfest/quality_scale.py @@ -391,7 +391,6 @@ INTEGRATIONS_WITHOUT_QUALITY_SCALE_FILE = [ "geonetnz_volcano", "github", "gitlab_ci", - "gitter", "glances", "go2rtc", "goalzero", @@ -1334,7 +1333,6 @@ INTEGRATIONS_WITHOUT_SCALE = [ "geonetnz_volcano", "github", "gitlab_ci", - "gitter", "glances", "go2rtc", "goalzero",