From 13c9fb6e37d9bec574519783215cd6370ddcdc0b Mon Sep 17 00:00:00 2001 From: Manu <4445816+tr4nt0r@users.noreply.github.com> Date: Fri, 21 Nov 2025 19:47:04 +0100 Subject: [PATCH] Remove Domino's Pizza integration (#156879) --- homeassistant/components/dominos/__init__.py | 259 ------------------ homeassistant/components/dominos/icons.json | 7 - .../components/dominos/manifest.json | 11 - .../components/dominos/services.yaml | 6 - homeassistant/components/dominos/strings.json | 14 - homeassistant/generated/integrations.json | 6 - pylint/plugins/hass_enforce_class_module.py | 1 - requirements_all.txt | 3 - script/hassfest/requirements.py | 2 - 9 files changed, 309 deletions(-) delete mode 100644 homeassistant/components/dominos/__init__.py delete mode 100644 homeassistant/components/dominos/icons.json delete mode 100644 homeassistant/components/dominos/manifest.json delete mode 100644 homeassistant/components/dominos/services.yaml delete mode 100644 homeassistant/components/dominos/strings.json diff --git a/homeassistant/components/dominos/__init__.py b/homeassistant/components/dominos/__init__.py deleted file mode 100644 index 6fccecfec5c..00000000000 --- a/homeassistant/components/dominos/__init__.py +++ /dev/null @@ -1,259 +0,0 @@ -"""Support for Dominos Pizza ordering.""" - -from datetime import timedelta -import logging - -from pizzapi import Address, Customer, Order -import voluptuous as vol - -from homeassistant.components import http -from homeassistant.core import HomeAssistant, ServiceCall, callback -from homeassistant.exceptions import HomeAssistantError -from homeassistant.helpers import config_validation as cv -from homeassistant.helpers.entity import Entity -from homeassistant.helpers.entity_component import EntityComponent -from homeassistant.helpers.typing import ConfigType -from homeassistant.util import Throttle - -_LOGGER = logging.getLogger(__name__) - -# The domain of your component. Should be equal to the name of your component. -DOMAIN = "dominos" -ENTITY_ID_FORMAT = DOMAIN + ".{}" - -ATTR_COUNTRY = "country_code" -ATTR_FIRST_NAME = "first_name" -ATTR_LAST_NAME = "last_name" -ATTR_EMAIL = "email" -ATTR_PHONE = "phone" -ATTR_ADDRESS = "address" -ATTR_ORDERS = "orders" -ATTR_SHOW_MENU = "show_menu" -ATTR_ORDER_ENTITY = "order_entity_id" -ATTR_ORDER_NAME = "name" -ATTR_ORDER_CODES = "codes" - -MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=10) -MIN_TIME_BETWEEN_STORE_UPDATES = timedelta(minutes=3330) - -_ORDERS_SCHEMA = vol.Schema( - { - vol.Required(ATTR_ORDER_NAME): cv.string, - vol.Required(ATTR_ORDER_CODES): vol.All(cv.ensure_list, [cv.string]), - } -) - -CONFIG_SCHEMA = vol.Schema( - { - DOMAIN: vol.Schema( - { - vol.Required(ATTR_COUNTRY): cv.string, - vol.Required(ATTR_FIRST_NAME): cv.string, - vol.Required(ATTR_LAST_NAME): cv.string, - vol.Required(ATTR_EMAIL): cv.string, - vol.Required(ATTR_PHONE): cv.string, - vol.Required(ATTR_ADDRESS): cv.string, - vol.Optional(ATTR_SHOW_MENU): cv.boolean, - vol.Optional(ATTR_ORDERS, default=[]): vol.All( - cv.ensure_list, [_ORDERS_SCHEMA] - ), - } - ) - }, - extra=vol.ALLOW_EXTRA, -) - - -def setup(hass: HomeAssistant, config: ConfigType) -> bool: - """Set up is called when Home Assistant is loading our component.""" - dominos = Dominos(hass, config) - - component = EntityComponent[DominosOrder](_LOGGER, DOMAIN, hass) - hass.data[DOMAIN] = {} - entities: list[DominosOrder] = [] - conf = config[DOMAIN] - - hass.services.register( - DOMAIN, - "order", - dominos.handle_order, - vol.Schema( - { - vol.Required(ATTR_ORDER_ENTITY): cv.entity_ids, - } - ), - ) - - if conf.get(ATTR_SHOW_MENU): - hass.http.register_view(DominosProductListView(dominos)) - - for order_info in conf.get(ATTR_ORDERS): - order = DominosOrder(order_info, dominos) - entities.append(order) - - component.add_entities(entities) - - # Return boolean to indicate that initialization was successfully. - return True - - -class Dominos: - """Main Dominos service.""" - - def __init__(self, hass, config): - """Set up main service.""" - conf = config[DOMAIN] - - self.hass = hass - self.customer = Customer( - conf.get(ATTR_FIRST_NAME), - conf.get(ATTR_LAST_NAME), - conf.get(ATTR_EMAIL), - conf.get(ATTR_PHONE), - conf.get(ATTR_ADDRESS), - ) - self.address = Address( - *self.customer.address.split(","), country=conf.get(ATTR_COUNTRY) - ) - self.country = conf.get(ATTR_COUNTRY) - try: - self.closest_store = self.address.closest_store() - except Exception: # noqa: BLE001 - self.closest_store = None - - def handle_order(self, call: ServiceCall) -> None: - """Handle ordering pizza.""" - entity_ids = call.data[ATTR_ORDER_ENTITY] - - target_orders = [ - order - for order in self.hass.data[DOMAIN]["entities"] - if order.entity_id in entity_ids - ] - - for order in target_orders: - order.place() - - @Throttle(MIN_TIME_BETWEEN_STORE_UPDATES) - def update_closest_store(self): - """Update the shared closest store (if open).""" - try: - self.closest_store = self.address.closest_store() - except Exception: # noqa: BLE001 - self.closest_store = None - return False - return True - - def get_menu(self): - """Return the products from the closest stores menu.""" - self.update_closest_store() - if self.closest_store is None: - _LOGGER.warning("Cannot get menu. Store may be closed") - return [] - menu = self.closest_store.get_menu() - product_entries = [] - - for product in menu.products: - item = {} - if isinstance(product.menu_data["Variants"], list): - variants = ", ".join(product.menu_data["Variants"]) - else: - variants = product.menu_data["Variants"] - item["name"] = product.name - item["variants"] = variants - product_entries.append(item) - - return product_entries - - -class DominosProductListView(http.HomeAssistantView): - """View to retrieve product list content.""" - - url = "/api/dominos" - name = "api:dominos" - - def __init__(self, dominos): - """Initialize suite view.""" - self.dominos = dominos - - @callback - def get(self, request): - """Retrieve if API is running.""" - return self.json(self.dominos.get_menu()) - - -class DominosOrder(Entity): - """Represents a Dominos order entity.""" - - def __init__(self, order_info, dominos): - """Set up the entity.""" - self._name = order_info["name"] - self._product_codes = order_info["codes"] - self._orderable = False - self.dominos = dominos - - @property - def name(self): - """Return the orders name.""" - return self._name - - @property - def product_codes(self): - """Return the orders product codes.""" - return self._product_codes - - @property - def orderable(self): - """Return the true if orderable.""" - return self._orderable - - @property - def state(self): - """Return the state either closed, orderable or unorderable.""" - if self.dominos.closest_store is None: - return "closed" - return "orderable" if self._orderable else "unorderable" - - @Throttle(MIN_TIME_BETWEEN_UPDATES) - def update(self): - """Update the order state and refreshes the store.""" - try: - self.dominos.update_closest_store() - except Exception: # noqa: BLE001 - self._orderable = False - return - - try: - order = self.order() - order.pay_with() - self._orderable = True - except Exception: # noqa: BLE001 - self._orderable = False - - def order(self): - """Create the order object.""" - if self.dominos.closest_store is None: - raise HomeAssistantError("No store available") - - order = Order( - self.dominos.closest_store, - self.dominos.customer, - self.dominos.address, - self.dominos.country, - ) - - for code in self._product_codes: - order.add_item(code) - - return order - - def place(self): - """Place the order.""" - try: - order = self.order() - order.place() - except Exception: # noqa: BLE001 - self._orderable = False - _LOGGER.warning( - "Attempted to order Dominos - Order invalid or store closed" - ) diff --git a/homeassistant/components/dominos/icons.json b/homeassistant/components/dominos/icons.json deleted file mode 100644 index ca33ac91dfd..00000000000 --- a/homeassistant/components/dominos/icons.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "services": { - "order": { - "service": "mdi:pizza" - } - } -} diff --git a/homeassistant/components/dominos/manifest.json b/homeassistant/components/dominos/manifest.json deleted file mode 100644 index 5618c6f0d87..00000000000 --- a/homeassistant/components/dominos/manifest.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "domain": "dominos", - "name": "Dominos Pizza", - "codeowners": [], - "dependencies": ["http"], - "documentation": "https://www.home-assistant.io/integrations/dominos", - "iot_class": "cloud_polling", - "loggers": ["pizzapi"], - "quality_scale": "legacy", - "requirements": ["pizzapi==0.0.6"] -} diff --git a/homeassistant/components/dominos/services.yaml b/homeassistant/components/dominos/services.yaml deleted file mode 100644 index f2261072ddd..00000000000 --- a/homeassistant/components/dominos/services.yaml +++ /dev/null @@ -1,6 +0,0 @@ -order: - fields: - order_entity_id: - example: dominos.medium_pan - selector: - text: diff --git a/homeassistant/components/dominos/strings.json b/homeassistant/components/dominos/strings.json deleted file mode 100644 index eb6d5a8fc73..00000000000 --- a/homeassistant/components/dominos/strings.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "services": { - "order": { - "description": "Places a set of orders with Domino's Pizza.", - "fields": { - "order_entity_id": { - "description": "The ID (as specified in the configuration) of an order to place. If provided as an array, all the identified orders will be placed.", - "name": "Order entity" - } - }, - "name": "Order" - } - } -} diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index 0f5961e0f3d..26fccc97148 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -1387,12 +1387,6 @@ "config_flow": true, "iot_class": "cloud_polling" }, - "dominos": { - "name": "Dominos Pizza", - "integration_type": "hub", - "config_flow": false, - "iot_class": "cloud_polling" - }, "doods": { "name": "DOODS - Dedicated Open Object Detection Service", "integration_type": "hub", diff --git a/pylint/plugins/hass_enforce_class_module.py b/pylint/plugins/hass_enforce_class_module.py index 41c07819fe8..13c25b203a1 100644 --- a/pylint/plugins/hass_enforce_class_module.py +++ b/pylint/plugins/hass_enforce_class_module.py @@ -85,7 +85,6 @@ _ENTITY_COMPONENTS: set[str] = {platform.value for platform in Platform}.union( "alert", "automation", "counter", - "dominos", "input_boolean", "input_button", "input_datetime", diff --git a/requirements_all.txt b/requirements_all.txt index da8e2408d30..fc84047fa9c 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1713,9 +1713,6 @@ pigpio==1.78 # homeassistant.components.pilight pilight==0.1.1 -# homeassistant.components.dominos -pizzapi==0.0.6 - # homeassistant.components.plex plexauth==0.0.6 diff --git a/script/hassfest/requirements.py b/script/hassfest/requirements.py index 7f51c3cc501..4057b40453d 100644 --- a/script/hassfest/requirements.py +++ b/script/hassfest/requirements.py @@ -272,8 +272,6 @@ FORBIDDEN_PACKAGE_FILES_EXCEPTIONS = { "abode": {"jaraco-abode": {"jaraco-net"}}, # https://github.com/coinbase/coinbase-advanced-py "coinbase": {"homeassistant": {"coinbase-advanced-py"}}, - # https://github.com/ggrammar/pizzapi - "dominos": {"homeassistant": {"pizzapi"}}, # https://github.com/u9n/dlms-cosem "dsmr": {"dsmr-parser": {"dlms-cosem"}}, # https://github.com/ChrisMandich/PyFlume # Fixed with >=0.7.1