From 2688f55d1ac3e5a7e53f5d6a60435a930b7cb3df Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Mon, 28 Sep 2026 16:00:10 +0200 Subject: [PATCH] Remove Travis-CI integration (#183474) --- homeassistant/components/travisci/__init__.py | 1 - .../components/travisci/manifest.json | 10 - homeassistant/components/travisci/sensor.py | 190 ------------------ homeassistant/generated/integrations.json | 6 - requirements_all.txt | 3 - script/hassfest/quality_scale.py | 2 - script/hassfest/requirements.py | 8 - script/licenses.py | 3 +- 8 files changed, 1 insertion(+), 222 deletions(-) delete mode 100644 homeassistant/components/travisci/__init__.py delete mode 100644 homeassistant/components/travisci/manifest.json delete mode 100644 homeassistant/components/travisci/sensor.py diff --git a/homeassistant/components/travisci/__init__.py b/homeassistant/components/travisci/__init__.py deleted file mode 100644 index 9337f87592fc..000000000000 --- a/homeassistant/components/travisci/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The travisci component.""" diff --git a/homeassistant/components/travisci/manifest.json b/homeassistant/components/travisci/manifest.json deleted file mode 100644 index be30cf8e1f9d..000000000000 --- a/homeassistant/components/travisci/manifest.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "domain": "travisci", - "name": "Travis-CI", - "codeowners": [], - "documentation": "https://www.home-assistant.io/integrations/travisci", - "iot_class": "cloud_polling", - "loggers": ["travispy"], - "quality_scale": "legacy", - "requirements": ["TravisPy==0.3.5"] -} diff --git a/homeassistant/components/travisci/sensor.py b/homeassistant/components/travisci/sensor.py deleted file mode 100644 index 206bd56d82e4..000000000000 --- a/homeassistant/components/travisci/sensor.py +++ /dev/null @@ -1,190 +0,0 @@ -"""Component providing HA sensor support for Travis CI framework.""" - -from datetime import timedelta -import logging -from typing import Any, override - -import probatio -from travispy import TravisPy -from travispy.errors import TravisError - -from homeassistant.components import persistent_notification -from homeassistant.components.sensor import ( - PLATFORM_SCHEMA as SENSOR_PLATFORM_SCHEMA, - SensorEntity, - SensorEntityDescription, -) -from homeassistant.const import ( - CONF_API_KEY, - CONF_MONITORED_CONDITIONS, - CONF_SCAN_INTERVAL, - UnitOfTime, -) -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__) - -CONF_BRANCH = "branch" -CONF_REPOSITORY = "repository" - -DEFAULT_BRANCH_NAME = "master" - -SCAN_INTERVAL = timedelta(seconds=30) - -SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( - SensorEntityDescription( - key="last_build_id", - name="Last Build ID", - icon="mdi:card-account-details", - ), - SensorEntityDescription( - key="last_build_duration", - name="Last Build Duration", - native_unit_of_measurement=UnitOfTime.SECONDS, - icon="mdi:timelapse", - ), - SensorEntityDescription( - key="last_build_finished_at", - name="Last Build Finished At", - icon="mdi:timetable", - ), - SensorEntityDescription( - key="last_build_started_at", - name="Last Build Started At", - icon="mdi:timetable", - ), - SensorEntityDescription( - key="last_build_state", - name="Last Build State", - icon="mdi:github", - ), - SensorEntityDescription( - key="state", - name="State", - icon="mdi:github", - ), -) - -SENSOR_KEYS: list[str] = [desc.key for desc in SENSOR_TYPES] - -NOTIFICATION_ID = "travisci" -NOTIFICATION_TITLE = "Travis CI Sensor Setup" - -PLATFORM_SCHEMA = SENSOR_PLATFORM_SCHEMA.extend( - { - probatio.Required(CONF_API_KEY): cv.string, - probatio.Required(CONF_MONITORED_CONDITIONS, default=SENSOR_KEYS): probatio.All( - cv.ensure_list, [probatio.In(SENSOR_KEYS)] - ), - probatio.Required(CONF_BRANCH, default=DEFAULT_BRANCH_NAME): cv.string, - probatio.Optional(CONF_REPOSITORY, default=[]): probatio.All( - cv.ensure_list, [cv.string] - ), - probatio.Optional(CONF_SCAN_INTERVAL, default=SCAN_INTERVAL): cv.time_period, - } -) - - -def setup_platform( - hass: HomeAssistant, - config: ConfigType, - add_entities: AddEntitiesCallback, - discovery_info: DiscoveryInfoType | None = None, -) -> None: - """Set up the Travis CI sensor.""" - - token = config[CONF_API_KEY] - repositories = config[CONF_REPOSITORY] - branch = config[CONF_BRANCH] - - try: - travis = TravisPy.github_auth(token) - user = travis.user() - - except TravisError as ex: - _LOGGER.error("Unable to connect to Travis CI service: %s", str(ex)) - persistent_notification.create( - hass, - f"Error: {ex}
You will need to restart hass after fixing.", - title=NOTIFICATION_TITLE, - notification_id=NOTIFICATION_ID, - ) - return - - # non specific repository selected, then show all associated - if not repositories: - all_repos = travis.repos(member=user.login) - repositories = [repo.slug for repo in all_repos] - - entities = [] - monitored_conditions = config[CONF_MONITORED_CONDITIONS] - for repo in repositories: - if "/" not in repo: - repo = f"{user.login}/{repo}" - - entities.extend( - [ - TravisCISensor(travis, repo, user, branch, description) - for description in SENSOR_TYPES - if description.key in monitored_conditions - ] - ) - - add_entities(entities, True) - - -class TravisCISensor(SensorEntity): - """Representation of a Travis CI sensor.""" - - _attr_attribution = "Information provided by https://travis-ci.org/" - - def __init__( - self, data, repo_name, user, branch, description: SensorEntityDescription - ) -> None: - """Initialize the sensor.""" - self.entity_description = description - self._build = None - self._data = data - self._repo_name = repo_name - self._user = user - self._branch = branch - - self._attr_name = f"{repo_name} {description.name}" - - @property - @override - def extra_state_attributes(self) -> dict[str, Any]: - """Return the state attributes.""" - attrs: dict[str, Any] = {} - - if self._build and self._attr_native_value is not None: - if self._user and self.entity_description.key == "state": - attrs["Owner Name"] = self._user.name - attrs["Owner Email"] = self._user.email - else: - attrs["Committer Name"] = self._build.commit.committer_name - attrs["Committer Email"] = self._build.commit.committer_email - attrs["Commit Branch"] = self._build.commit.branch - attrs["Committed Date"] = self._build.commit.committed_at - attrs["Commit SHA"] = self._build.commit.sha - - return attrs - - def update(self) -> None: - """Get the latest data and updates the states.""" - _LOGGER.debug("Updating sensor %s", self.name) - - repo = self._data.repo(self._repo_name) - self._build = self._data.build(repo.last_build_id) - - if self._build: - if (sensor_type := self.entity_description.key) == "state": - branch_stats = self._data.branch(self._branch, self._repo_name) - self._attr_native_value = branch_stats.state - - else: - param = sensor_type.replace("last_build_", "") - self._attr_native_value = getattr(self._build, param) diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index 574757ff4d50..84ae86325cc5 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -7722,12 +7722,6 @@ "config_flow": false, "iot_class": "cloud_polling" }, - "travisci": { - "name": "Travis-CI", - "integration_type": "hub", - "config_flow": false, - "iot_class": "cloud_polling" - }, "triggercmd": { "name": "TRIGGERcmd", "integration_type": "hub", diff --git a/requirements_all.txt b/requirements_all.txt index 38988ffe6e26..1886429aac43 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -120,9 +120,6 @@ SQLAlchemy==2.0.54 # homeassistant.components.tami4 Tami4EdgeAPI==3.0 -# homeassistant.components.travisci -TravisPy==0.3.5 - # homeassistant.components.twitter TwitterAPI==2.7.12 diff --git a/script/hassfest/quality_scale.py b/script/hassfest/quality_scale.py index 4e1054838c16..2530b2451f66 100644 --- a/script/hassfest/quality_scale.py +++ b/script/hassfest/quality_scale.py @@ -915,7 +915,6 @@ INTEGRATIONS_WITHOUT_QUALITY_SCALE_FILE = [ "trafikverket_train", "trafikverket_weatherstation", "transport_nsw", - "travisci", "trend", "triggercmd", "tuya", @@ -1868,7 +1867,6 @@ INTEGRATIONS_WITHOUT_SCALE = [ "trafikverket_train", "trafikverket_weatherstation", "transport_nsw", - "travisci", "trend", "triggercmd", "tuya", diff --git a/script/hassfest/requirements.py b/script/hassfest/requirements.py index cdc14fb6fea3..0a85f5736380 100644 --- a/script/hassfest/requirements.py +++ b/script/hassfest/requirements.py @@ -238,14 +238,6 @@ FORBIDDEN_PACKAGE_EXCEPTIONS: dict[str, dict[str, set[str]]] = { "tailwind": {"gotailwind": {"backoff"}}, "tibber": {"gql": {"backoff"}}, "toon": {"toonapi": {"backoff"}}, - "travisci": { - # https://github.com/menegazzo/travispy seems to be unmaintained - # and unused https://www.home-assistant.io/integrations/travisci - # travispy > pytest-rerunfailures > pytest - "pytest-rerunfailures": {"pytest"}, - # travispy > pytest - "travispy": {"pytest"}, - }, "velbus": {"velbus-aio": {"backoff"}}, "volkszaehler": {"volkszaehler": {"async-timeout"}}, "weatherflow_cloud": {"weatherflow4py": {"dataclasses-json"}}, diff --git a/script/licenses.py b/script/licenses.py index 6603b643e01c..dbf5926f620c 100644 --- a/script/licenses.py +++ b/script/licenses.py @@ -203,8 +203,7 @@ EXCEPTIONS = { } # fmt: off -TODO = { - "TravisPy": AwesomeVersion("0.3.5"), # None -- GPL -- ['GNU General Public License v3 (GPLv3)'] +TODO: dict[str, AwesomeVersion] = { } # fmt: on