diff --git a/.coveragerc b/.coveragerc index 65b499c372f..0609051f196 100644 --- a/.coveragerc +++ b/.coveragerc @@ -623,7 +623,6 @@ omit = homeassistant/components/norway_air/air_quality.py homeassistant/components/notify_events/notify.py homeassistant/components/nsw_fuel_station/sensor.py - homeassistant/components/nuimo_controller/* homeassistant/components/nuki/__init__.py homeassistant/components/nuki/const.py homeassistant/components/nuki/lock.py diff --git a/homeassistant/components/nuimo_controller/__init__.py b/homeassistant/components/nuimo_controller/__init__.py deleted file mode 100644 index 013c2caf23d..00000000000 --- a/homeassistant/components/nuimo_controller/__init__.py +++ /dev/null @@ -1,190 +0,0 @@ -"""Support for Nuimo device over Bluetooth LE.""" -import logging -import threading -import time - -# pylint: disable=import-error -from nuimo import NuimoController, NuimoDiscoveryManager -import voluptuous as vol - -from homeassistant.const import CONF_MAC, CONF_NAME, EVENT_HOMEASSISTANT_STOP -import homeassistant.helpers.config_validation as cv - -_LOGGER = logging.getLogger(__name__) - -DOMAIN = "nuimo_controller" -EVENT_NUIMO = "nuimo_input" - -DEFAULT_NAME = "None" - -CONFIG_SCHEMA = vol.Schema( - { - DOMAIN: vol.Schema( - { - vol.Optional(CONF_MAC): cv.string, - vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - } - ) - }, - extra=vol.ALLOW_EXTRA, -) - -SERVICE_NUIMO = "led_matrix" -DEFAULT_INTERVAL = 2.0 - -SERVICE_NUIMO_SCHEMA = vol.Schema( - { - vol.Required("matrix"): cv.string, - vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - vol.Optional("interval", default=DEFAULT_INTERVAL): float, - } -) - -DEFAULT_ADAPTER = "hci0" - - -def setup(hass, config): - """Set up the Nuimo component.""" - conf = config[DOMAIN] - mac = conf.get(CONF_MAC) - name = conf.get(CONF_NAME) - NuimoThread(hass, mac, name).start() - return True - - -class NuimoLogger: - """Handle Nuimo Controller event callbacks.""" - - def __init__(self, hass, name): - """Initialize Logger object.""" - self._hass = hass - self._name = name - - def received_gesture_event(self, event): - """Input Event received.""" - _LOGGER.debug( - "Received event: name=%s, gesture_id=%s,value=%s", - event.name, - event.gesture, - event.value, - ) - self._hass.bus.fire( - EVENT_NUIMO, {"type": event.name, "value": event.value, "name": self._name} - ) - - -class NuimoThread(threading.Thread): - """Manage one Nuimo controller.""" - - def __init__(self, hass, mac, name): - """Initialize thread object.""" - super().__init__() - self._hass = hass - self._mac = mac - self._name = name - self._hass_is_running = True - self._nuimo = None - hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, self.stop) - - def run(self): - """Set up the connection or be idle.""" - while self._hass_is_running: - if not self._nuimo or not self._nuimo.is_connected(): - self._attach() - self._connect() - else: - time.sleep(1) - - if self._nuimo: - self._nuimo.disconnect() - self._nuimo = None - - def stop(self, event): - """Terminate Thread by unsetting flag.""" - _LOGGER.debug("Stopping thread for Nuimo %s", self._mac) - self._hass_is_running = False - - def _attach(self): - """Create a Nuimo object from MAC address or discovery.""" - - if self._nuimo: - self._nuimo.disconnect() - self._nuimo = None - - if self._mac: - self._nuimo = NuimoController(self._mac) - else: - nuimo_manager = NuimoDiscoveryManager( - bluetooth_adapter=DEFAULT_ADAPTER, delegate=DiscoveryLogger() - ) - nuimo_manager.start_discovery() - # Were any Nuimos found? - if not nuimo_manager.nuimos: - _LOGGER.debug("No Nuimo devices detected") - return - # Take the first Nuimo found. - self._nuimo = nuimo_manager.nuimos[0] - self._mac = self._nuimo.addr - - def _connect(self): - """Build up connection and set event delegator and service.""" - if not self._nuimo: - return - - try: - self._nuimo.connect() - _LOGGER.debug("Connected to %s", self._mac) - except RuntimeError as error: - _LOGGER.error("Could not connect to %s: %s", self._mac, error) - time.sleep(1) - return - - nuimo_event_delegate = NuimoLogger(self._hass, self._name) - self._nuimo.set_delegate(nuimo_event_delegate) - - def handle_write_matrix(call): - """Handle led matrix service.""" - matrix = call.data.get("matrix", None) - name = call.data.get(CONF_NAME, DEFAULT_NAME) - interval = call.data.get("interval", DEFAULT_INTERVAL) - if self._name == name and matrix: - self._nuimo.write_matrix(matrix, interval) - - self._hass.services.register( - DOMAIN, SERVICE_NUIMO, handle_write_matrix, schema=SERVICE_NUIMO_SCHEMA - ) - - self._nuimo.write_matrix(HOMEASSIST_LOGO, 2.0) - - -# must be 9x9 matrix -HOMEASSIST_LOGO = ( - " . " - + " ... " - + " ..... " - + " ....... " - + "..... ..." - + " ....... " - + " .. .... " - + " .. .... " - + "........." -) - - -class DiscoveryLogger: - """Handle Nuimo Discovery callbacks.""" - - # pylint: disable=no-self-use - def discovery_started(self): - """Discovery started.""" - _LOGGER.info("Started discovery") - - # pylint: disable=no-self-use - def discovery_finished(self): - """Discovery finished.""" - _LOGGER.info("Finished discovery") - - # pylint: disable=no-self-use - def controller_added(self, nuimo): - """Return that a controller was found.""" - _LOGGER.info("Added Nuimo: %s", nuimo) diff --git a/homeassistant/components/nuimo_controller/manifest.json b/homeassistant/components/nuimo_controller/manifest.json deleted file mode 100644 index dddd4a97523..00000000000 --- a/homeassistant/components/nuimo_controller/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "domain": "nuimo_controller", - "name": "Nuimo controller", - "documentation": "https://www.home-assistant.io/integrations/nuimo_controller", - "requirements": ["--only-binary=all nuimo==0.1.0"], - "codeowners": [] -} diff --git a/homeassistant/components/nuimo_controller/services.yaml b/homeassistant/components/nuimo_controller/services.yaml deleted file mode 100644 index d98659caa8b..00000000000 --- a/homeassistant/components/nuimo_controller/services.yaml +++ /dev/null @@ -1,17 +0,0 @@ -led_matrix: - description: Sends an LED Matrix to your display - fields: - matrix: - description: "A string representation of the matrix to be displayed. See the SDK documentation for more info: https://github.com/getSenic/nuimo-linux-python#write-to-nuimos-led-matrix" - example: "........ - 0000000. - .000000. - ..00000. - .0.0000. - .00.000. - .000000. - .000000. - ........" - interval: - description: Display interval in seconds - example: 0.5 diff --git a/requirements_all.txt b/requirements_all.txt index 60df4ea85f0..804b0495297 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1,9 +1,6 @@ # Home Assistant Core, full dependency set -r requirements.txt -# homeassistant.components.nuimo_controller -# --only-binary=all nuimo==0.1.0 - # homeassistant.components.dht # Adafruit-DHT==1.4.0 diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py index dc1ef9a471b..52820bfa572 100755 --- a/script/gen_requirements_all.py +++ b/script/gen_requirements_all.py @@ -28,7 +28,6 @@ COMMENT_REQUIREMENTS = ( "evdev", "face_recognition", "i2csense", - "nuimo", "opencv-python-headless", "py_noaa", "pybluez",