diff --git a/.coveragerc b/.coveragerc index 6043d3d45f0..6339e09a034 100644 --- a/.coveragerc +++ b/.coveragerc @@ -899,7 +899,6 @@ omit = homeassistant/components/switcher_kis/switch.py homeassistant/components/switchmate/switch.py homeassistant/components/syncthru/sensor.py - homeassistant/components/synology/camera.py homeassistant/components/synology_chat/notify.py homeassistant/components/synology_dsm/__init__.py homeassistant/components/synology_dsm/binary_sensor.py diff --git a/homeassistant/components/synology/__init__.py b/homeassistant/components/synology/__init__.py deleted file mode 100644 index 0ab4b45e298..00000000000 --- a/homeassistant/components/synology/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""The synology component.""" diff --git a/homeassistant/components/synology/camera.py b/homeassistant/components/synology/camera.py deleted file mode 100644 index 4417f72918d..00000000000 --- a/homeassistant/components/synology/camera.py +++ /dev/null @@ -1,143 +0,0 @@ -"""Support for Synology Surveillance Station Cameras.""" -from functools import partial -import logging - -import requests -from synology.surveillance_station import SurveillanceStation -import voluptuous as vol - -from homeassistant.components.camera import PLATFORM_SCHEMA, Camera -from homeassistant.const import ( - CONF_NAME, - CONF_PASSWORD, - CONF_TIMEOUT, - CONF_URL, - CONF_USERNAME, - CONF_VERIFY_SSL, - CONF_WHITELIST, -) -from homeassistant.helpers.aiohttp_client import ( - async_aiohttp_proxy_web, - async_get_clientsession, -) -import homeassistant.helpers.config_validation as cv - -_LOGGER = logging.getLogger(__name__) - -DEFAULT_NAME = "Synology Camera" -DEFAULT_TIMEOUT = 5 - -PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( - { - vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string, - vol.Required(CONF_USERNAME): cv.string, - vol.Required(CONF_PASSWORD): cv.string, - vol.Required(CONF_URL): cv.string, - vol.Optional(CONF_TIMEOUT, default=DEFAULT_TIMEOUT): cv.positive_int, - vol.Optional(CONF_WHITELIST, default=[]): cv.ensure_list, - vol.Optional(CONF_VERIFY_SSL, default=True): cv.boolean, - } -) - - -async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): - """Set up a Synology IP Camera.""" - _LOGGER.warning( - "The Synology integration is deprecated." - " Please use the Synology DSM integration" - " (https://www.home-assistant.io/integrations/synology_dsm/) instead." - " This integration will be removed in version 0.118.0." - ) - - verify_ssl = config.get(CONF_VERIFY_SSL) - timeout = config.get(CONF_TIMEOUT) - - try: - surveillance = await hass.async_add_executor_job( - partial( - SurveillanceStation, - config.get(CONF_URL), - config.get(CONF_USERNAME), - config.get(CONF_PASSWORD), - verify_ssl=verify_ssl, - timeout=timeout, - ) - ) - except (requests.exceptions.RequestException, ValueError): - _LOGGER.exception("Error when initializing SurveillanceStation") - return False - - cameras = surveillance.get_all_cameras() - - # add cameras - devices = [] - for camera in cameras: - if not config[CONF_WHITELIST] or camera.name in config[CONF_WHITELIST]: - device = SynologyCamera(surveillance, camera.camera_id, verify_ssl) - devices.append(device) - - async_add_entities(devices) - - -class SynologyCamera(Camera): - """An implementation of a Synology NAS based IP camera.""" - - def __init__(self, surveillance, camera_id, verify_ssl): - """Initialize a Synology Surveillance Station camera.""" - super().__init__() - self._surveillance = surveillance - self._camera_id = camera_id - self._verify_ssl = verify_ssl - self._camera = self._surveillance.get_camera(camera_id) - self._motion_setting = self._surveillance.get_motion_setting(camera_id) - self.is_streaming = self._camera.is_enabled - - def camera_image(self): - """Return bytes of camera image.""" - return self._surveillance.get_camera_image(self._camera_id) - - async def handle_async_mjpeg_stream(self, request): - """Return a MJPEG stream image response directly from the camera.""" - streaming_url = self._camera.video_stream_url - - websession = async_get_clientsession(self.hass, self._verify_ssl) - stream_coro = websession.get(streaming_url) - - return await async_aiohttp_proxy_web(self.hass, request, stream_coro) - - @property - def name(self): - """Return the name of this device.""" - return self._camera.name - - @property - def is_recording(self): - """Return true if the device is recording.""" - return self._camera.is_recording - - @property - def should_poll(self): - """Update the recording state periodically.""" - return True - - def update(self): - """Update the status of the camera.""" - self._surveillance.update() - self._camera = self._surveillance.get_camera(self._camera.camera_id) - self._motion_setting = self._surveillance.get_motion_setting( - self._camera.camera_id - ) - self.is_streaming = self._camera.is_enabled - - @property - def motion_detection_enabled(self): - """Return the camera motion detection status.""" - return self._motion_setting.is_enabled - - def enable_motion_detection(self): - """Enable motion detection in the camera.""" - self._surveillance.enable_motion_detection(self._camera_id) - - def disable_motion_detection(self): - """Disable motion detection in camera.""" - self._surveillance.disable_motion_detection(self._camera_id) diff --git a/homeassistant/components/synology/manifest.json b/homeassistant/components/synology/manifest.json deleted file mode 100644 index a29dccc2a78..00000000000 --- a/homeassistant/components/synology/manifest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "domain": "synology", - "name": "Synology", - "documentation": "https://www.home-assistant.io/integrations/synology", - "requirements": ["py-synology==0.2.0"], - "codeowners": [] -} diff --git a/requirements_all.txt b/requirements_all.txt index 401009e9fef..9e7a75e8905 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1212,9 +1212,6 @@ py-nightscout==1.2.2 # homeassistant.components.schluter py-schluter==0.1.7 -# homeassistant.components.synology -py-synology==0.2.0 - # homeassistant.components.zabbix py-zabbix==1.1.7