diff --git a/homeassistant/components/zwave_js/api.py b/homeassistant/components/zwave_js/api.py index fee828c9fd8876..8f81790708f4fd 100644 --- a/homeassistant/components/zwave_js/api.py +++ b/homeassistant/components/zwave_js/api.py @@ -166,65 +166,6 @@ MINIMUM_QR_STRING_LENGTH = 52 -def convert_planned_provisioning_entry(info: dict) -> ProvisioningEntry: - """Handle provisioning entry dict to ProvisioningEntry.""" - return ProvisioningEntry( - dsk=info[DSK], - security_classes=info[SECURITY_CLASSES], - status=info[STATUS], - requested_security_classes=info.get(REQUESTED_SECURITY_CLASSES), - additional_properties={ - k: v - for k, v in info.items() - if k not in (DSK, SECURITY_CLASSES, STATUS, REQUESTED_SECURITY_CLASSES) - }, - ) - - -def convert_qr_provisioning_information(info: dict) -> QRProvisioningInformation: - """Convert QR provisioning information dict to QRProvisioningInformation.""" - ## Remove this when we have fix for QRProvisioningInformation.from_dict() - return QRProvisioningInformation( - version=info[VERSION], - security_classes=info[SECURITY_CLASSES], - dsk=info[DSK], - generic_device_class=info[GENERIC_DEVICE_CLASS], - specific_device_class=info[SPECIFIC_DEVICE_CLASS], - installer_icon_type=info[INSTALLER_ICON_TYPE], - manufacturer_id=info[MANUFACTURER_ID], - product_type=info[PRODUCT_TYPE], - product_id=info[PRODUCT_ID], - application_version=info[APPLICATION_VERSION], - max_inclusion_request_interval=info.get(MAX_INCLUSION_REQUEST_INTERVAL), - uuid=info.get(UUID), - supported_protocols=info.get(SUPPORTED_PROTOCOLS), - status=info[STATUS], - requested_security_classes=info.get(REQUESTED_SECURITY_CLASSES), - additional_properties={ - k: v - for k, v in info.items() - if k - not in ( - VERSION, - SECURITY_CLASSES, - DSK, - GENERIC_DEVICE_CLASS, - SPECIFIC_DEVICE_CLASS, - INSTALLER_ICON_TYPE, - MANUFACTURER_ID, - PRODUCT_TYPE, - PRODUCT_ID, - APPLICATION_VERSION, - MAX_INCLUSION_REQUEST_INTERVAL, - UUID, - SUPPORTED_PROTOCOLS, - STATUS, - REQUESTED_SECURITY_CLASSES, - ) - }, - ) - - # Helper schemas PLANNED_PROVISIONING_ENTRY_SCHEMA = vol.All( vol.Schema( @@ -244,7 +185,7 @@ def convert_qr_provisioning_information(info: dict) -> QRProvisioningInformation # Provisioning entries can have extra keys for SmartStart extra=vol.ALLOW_EXTRA, ), - convert_planned_provisioning_entry, + ProvisioningEntry.from_dict, ) QR_PROVISIONING_INFORMATION_SCHEMA = vol.All( @@ -278,7 +219,7 @@ def convert_qr_provisioning_information(info: dict) -> QRProvisioningInformation }, extra=vol.ALLOW_EXTRA, ), - convert_qr_provisioning_information, + QRProvisioningInformation.from_dict, ) QR_CODE_STRING_SCHEMA = vol.All(str, vol.Length(min=MINIMUM_QR_STRING_LENGTH))