diff --git a/homeassistant/components/synology_dsm/__init__.py b/homeassistant/components/synology_dsm/__init__.py index 70c7e76a53a126..cc90900d4b9b09 100644 --- a/homeassistant/components/synology_dsm/__init__.py +++ b/homeassistant/components/synology_dsm/__init__.py @@ -12,7 +12,8 @@ from homeassistant.const import CONF_MAC, CONF_SCAN_INTERVAL, CONF_VERIFY_SSL from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady -from homeassistant.helpers import device_registry as dr +from homeassistant.helpers import config_validation as cv, device_registry as dr +from homeassistant.helpers.typing import ConfigType from .common import SynoApi, raise_config_entry_auth_error from .const import ( @@ -36,9 +37,17 @@ ) from .service import async_setup_services +CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN) + _LOGGER = logging.getLogger(__name__) +async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: + """Set up the Synology DSM services.""" + await async_setup_services(hass) + return True + + async def async_setup_entry(hass: HomeAssistant, entry: SynologyDSMConfigEntry) -> bool: """Set up Synology DSM sensors.""" @@ -89,9 +98,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: SynologyDSMConfigEntry) details = EXCEPTION_UNKNOWN raise ConfigEntryNotReady(details) from err - # Services - await async_setup_services(hass) - # For SSDP compat if not entry.data.get(CONF_MAC): hass.config_entries.async_update_entry( diff --git a/homeassistant/components/synology_dsm/quality_scale.yaml b/homeassistant/components/synology_dsm/quality_scale.yaml new file mode 100644 index 00000000000000..e925ae71b6f58c --- /dev/null +++ b/homeassistant/components/synology_dsm/quality_scale.yaml @@ -0,0 +1,69 @@ +rules: + # Bronze + action-setup: done + appropriate-polling: done + brands: done + common-modules: done + config-flow-test-coverage: todo + config-flow: done + dependency-transparency: done + docs-actions: todo + docs-high-level-description: done + docs-installation-instructions: done + docs-removal-instructions: done + entity-event-setup: done + entity-unique-id: done + has-entity-name: + status: todo + comment: button entities missing + runtime-data: done + test-before-configure: done + test-before-setup: done + unique-config-entry: done + + # Silver + action-exceptions: todo + config-entry-unloading: done + docs-configuration-parameters: todo + docs-installation-parameters: todo + entity-unavailable: done + integration-owner: done + log-when-unavailable: + status: done + comment: | + Handled by coordinator. + parallel-updates: todo + reauthentication-flow: done + test-coverage: todo + + # Gold + devices: done + diagnostics: done + discovery-update-info: done + discovery: done + docs-data-update: done + docs-examples: todo + docs-known-limitations: done + docs-supported-devices: done + docs-supported-functions: done + docs-troubleshooting: done + docs-use-cases: done + dynamic-devices: + status: todo + comment: cameras and disks can be replaced and removed + entity-category: done + entity-device-class: done + entity-disabled-by-default: done + entity-translations: done + exception-translations: todo + icon-translations: done + reconfiguration-flow: todo + repair-issues: done + stale-devices: + status: todo + comment: see dynamic-devices + + # Platinum + async-dependency: done + inject-websession: done + strict-typing: done diff --git a/homeassistant/components/synology_dsm/strings.json b/homeassistant/components/synology_dsm/strings.json index f51184ef1cbc83..42cc5f03664339 100644 --- a/homeassistant/components/synology_dsm/strings.json +++ b/homeassistant/components/synology_dsm/strings.json @@ -1,4 +1,15 @@ { + "common": { + "data_description_host": "The hostname or IP address of your Synology NAS.", + "data_description_port": "The port number of your Synology NAS WebUI. Leave empty to use the default port.", + "data_description_username": "Synology NAS user.", + "data_description_password": "Password for the Synology NAS user.", + "data_description_ssl": "Use SSL to connect to the Synology NAS.", + "data_description_verify_ssl": "Verify the SSL certificate of the Synology NAS. This should be off for self-signed certificates.", + "data_description_snap_profile_type": "The quality level of camera snapshots (0:high 1:medium 2:low)", + "data_description_backup_share": "Select the shared folder, where the automatic Home-Assistant backup should be stored.", + "data_description_backup_path": "Define the path on the selected shared folder (will automatically be created, if not exist)." + }, "config": { "flow_title": "{name} ({host})", "step": { @@ -12,13 +23,21 @@ "password": "[%key:common::config_flow::data::password%]" }, "data_description": { - "host": "The hostname or IP address of your Synology NAS." + "host": "[%key:component::synology_dsm::common::data_description_host%]", + "port": "[%key:component::synology_dsm::common::data_description_port%]", + "username": "[%key:component::synology_dsm::common::data_description_username%]", + "password": "[%key:component::synology_dsm::common::data_description_password%]", + "ssl": "[%key:component::synology_dsm::common::data_description_ssl%]", + "verify_ssl": "[%key:component::synology_dsm::common::data_description_verify_ssl%]" } }, "2sa": { "title": "Synology DSM: two-step authentication", "data": { "otp_code": "Code" + }, + "data_description": { + "otp_code": "A one-time-password generated by the authenticator app." } }, "backup_share": { @@ -28,8 +47,8 @@ "backup_path": "Path" }, "data_description": { - "backup_share": "Select the shared folder, where the automatic Home-Assistant backup should be stored.", - "backup_path": "Define the path on the selected shared folder (will automatically be created, if not exist)." + "backup_share": "[%key:component::synology_dsm::common::data_description_backup_share%]", + "backup_path": "[%key:component::synology_dsm::common::data_description_backup_path%]" } }, "link": { @@ -40,6 +59,13 @@ "username": "[%key:common::config_flow::data::username%]", "password": "[%key:common::config_flow::data::password%]", "port": "[%key:common::config_flow::data::port%]" + }, + "data_description": { + "port": "[%key:component::synology_dsm::common::data_description_port%]", + "username": "[%key:component::synology_dsm::common::data_description_username%]", + "password": "[%key:component::synology_dsm::common::data_description_password%]", + "ssl": "[%key:component::synology_dsm::common::data_description_ssl%]", + "verify_ssl": "[%key:component::synology_dsm::common::data_description_verify_ssl%]" } }, "reauth_confirm": { @@ -47,6 +73,10 @@ "data": { "username": "[%key:common::config_flow::data::username%]", "password": "[%key:common::config_flow::data::password%]" + }, + "data_description": { + "username": "[%key:component::synology_dsm::common::data_description_username%]", + "password": "[%key:component::synology_dsm::common::data_description_password%]" } } }, @@ -68,13 +98,14 @@ "step": { "init": { "data": { - "snap_profile_type": "Quality level of camera snapshots (0:high 1:medium 2:low)", + "snap_profile_type": "Camera snapshots quality", "backup_share": "[%key:component::synology_dsm::config::step::backup_share::data::backup_share%]", "backup_path": "[%key:component::synology_dsm::config::step::backup_share::data::backup_path%]" }, "data_description": { - "backup_share": "[%key:component::synology_dsm::config::step::backup_share::data_description::backup_share%]", - "backup_path": "[%key:component::synology_dsm::config::step::backup_share::data_description::backup_path%]" + "snap_profile_type": "[%key:component::synology_dsm::common::data_description_snap_profile_type%]", + "backup_share": "[%key:component::synology_dsm::common::data_description_backup_share%]", + "backup_path": "[%key:component::synology_dsm::common::data_description_backup_path%]" } } } @@ -204,8 +235,8 @@ "backup_path": "[%key:component::synology_dsm::config::step::backup_share::data::backup_path%]" }, "data_description": { - "backup_share": "[%key:component::synology_dsm::config::step::backup_share::data_description::backup_share%]", - "backup_path": "[%key:component::synology_dsm::config::step::backup_share::data_description::backup_path%]" + "backup_share": "[%key:component::synology_dsm::common::data_description_backup_share%]", + "backup_path": "[%key:component::synology_dsm::common::data_description_backup_path%]" } } }, diff --git a/script/hassfest/quality_scale.py b/script/hassfest/quality_scale.py index d74011801d5b6e..4072aa2ab18aa6 100644 --- a/script/hassfest/quality_scale.py +++ b/script/hassfest/quality_scale.py @@ -977,7 +977,6 @@ class Rule: "syncthing", "syncthru", "synology_chat", - "synology_dsm", "synology_srm", "syslog", "system_bridge",