From fe3fa0ae17569898144a5710933b2069f9a6122c Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Wed, 25 May 2022 13:46:55 -0400 Subject: [PATCH] Bump zwave-js-server-python to 0.37.0 (#72395) --- homeassistant/components/zwave_js/api.py | 3 +- homeassistant/components/zwave_js/climate.py | 2 +- .../components/zwave_js/device_action.py | 4 +- .../components/zwave_js/device_condition.py | 4 +- .../components/zwave_js/device_trigger.py | 4 +- .../zwave_js/discovery_data_template.py | 2 +- .../components/zwave_js/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- .../fixtures/aeon_smart_switch_6_state.json | 9 +- .../fixtures/climate_danfoss_lc_13_state.json | 58 ++- ..._ct100_plus_different_endpoints_state.json | 354 +++++++++++++++++- tests/components/zwave_js/test_api.py | 5 + tests/components/zwave_js/test_services.py | 18 +- 14 files changed, 445 insertions(+), 24 deletions(-) diff --git a/homeassistant/components/zwave_js/api.py b/homeassistant/components/zwave_js/api.py index 05591e8ecfb..5d81dc46803 100644 --- a/homeassistant/components/zwave_js/api.py +++ b/homeassistant/components/zwave_js/api.py @@ -114,8 +114,7 @@ DRY_RUN = "dry_run" # constants for inclusion INCLUSION_STRATEGY = "inclusion_strategy" -# Remove type ignore when bumping library to 0.37.0 -INCLUSION_STRATEGY_NOT_SMART_START: dict[ # type: ignore[misc] +INCLUSION_STRATEGY_NOT_SMART_START: dict[ int, Literal[ InclusionStrategy.DEFAULT, diff --git a/homeassistant/components/zwave_js/climate.py b/homeassistant/components/zwave_js/climate.py index cad0b6a1e5c..7b07eb09619 100644 --- a/homeassistant/components/zwave_js/climate.py +++ b/homeassistant/components/zwave_js/climate.py @@ -238,7 +238,7 @@ class ZWaveClimate(ZWaveBaseEntity, ClimateEntity): if self._current_mode is None or self._current_mode.value is None: # Thermostat(valve) with no support for setting a mode is considered heating-only return [ThermostatSetpointType.HEATING] - return THERMOSTAT_MODE_SETPOINT_MAP.get(int(self._current_mode.value), []) # type: ignore[no-any-return] + return THERMOSTAT_MODE_SETPOINT_MAP.get(int(self._current_mode.value), []) @property def temperature_unit(self) -> str: diff --git a/homeassistant/components/zwave_js/device_action.py b/homeassistant/components/zwave_js/device_action.py index 2494cb8216d..728b376228e 100644 --- a/homeassistant/components/zwave_js/device_action.py +++ b/homeassistant/components/zwave_js/device_action.py @@ -326,7 +326,9 @@ async def async_get_action_capabilities( vol.Required(ATTR_COMMAND_CLASS): vol.In( { CommandClass(cc.id).value: cc.name - for cc in sorted(node.command_classes, key=lambda cc: cc.name) # type: ignore[no-any-return] + for cc in sorted( + node.command_classes, key=lambda cc: cc.name + ) } ), vol.Required(ATTR_PROPERTY): cv.string, diff --git a/homeassistant/components/zwave_js/device_condition.py b/homeassistant/components/zwave_js/device_condition.py index 549319d23f4..7775995437a 100644 --- a/homeassistant/components/zwave_js/device_condition.py +++ b/homeassistant/components/zwave_js/device_condition.py @@ -221,7 +221,9 @@ async def async_get_condition_capabilities( vol.Required(ATTR_COMMAND_CLASS): vol.In( { CommandClass(cc.id).value: cc.name - for cc in sorted(node.command_classes, key=lambda cc: cc.name) # type: ignore[no-any-return] + for cc in sorted( + node.command_classes, key=lambda cc: cc.name + ) if cc.id != CommandClass.CONFIGURATION } ), diff --git a/homeassistant/components/zwave_js/device_trigger.py b/homeassistant/components/zwave_js/device_trigger.py index ad860089d1d..dfca2eb4b27 100644 --- a/homeassistant/components/zwave_js/device_trigger.py +++ b/homeassistant/components/zwave_js/device_trigger.py @@ -534,7 +534,9 @@ async def async_get_trigger_capabilities( vol.Required(ATTR_COMMAND_CLASS): vol.In( { CommandClass(cc.id).value: cc.name - for cc in sorted(node.command_classes, key=lambda cc: cc.name) # type: ignore[no-any-return] + for cc in sorted( + node.command_classes, key=lambda cc: cc.name + ) if cc.id != CommandClass.CONFIGURATION } ), diff --git a/homeassistant/components/zwave_js/discovery_data_template.py b/homeassistant/components/zwave_js/discovery_data_template.py index 5c853d9ea9f..74847c3f4da 100644 --- a/homeassistant/components/zwave_js/discovery_data_template.py +++ b/homeassistant/components/zwave_js/discovery_data_template.py @@ -505,7 +505,7 @@ class ConfigurableFanValueMappingDataTemplate( self, value: ZwaveValue ) -> dict[str, ZwaveConfigurationValue | None]: """Resolve helper class data for a discovered value.""" - zwave_value = cast( # type: ignore[redundant-cast] + zwave_value = cast( Union[ZwaveConfigurationValue, None], self._get_value_from_id(value.node, self.configuration_option), ) diff --git a/homeassistant/components/zwave_js/manifest.json b/homeassistant/components/zwave_js/manifest.json index 934c3f9a3f5..555da5fe954 100644 --- a/homeassistant/components/zwave_js/manifest.json +++ b/homeassistant/components/zwave_js/manifest.json @@ -3,7 +3,7 @@ "name": "Z-Wave JS", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zwave_js", - "requirements": ["zwave-js-server-python==0.36.1"], + "requirements": ["zwave-js-server-python==0.37.0"], "codeowners": ["@home-assistant/z-wave"], "dependencies": ["usb", "http", "websocket_api"], "iot_class": "local_push", diff --git a/requirements_all.txt b/requirements_all.txt index 9e6729d6af1..27c5a401bd4 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2528,7 +2528,7 @@ zigpy==0.45.1 zm-py==0.5.2 # homeassistant.components.zwave_js -zwave-js-server-python==0.36.1 +zwave-js-server-python==0.37.0 # homeassistant.components.zwave_me zwave_me_ws==0.2.4 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 1d26030bedb..58a345adbfc 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1665,7 +1665,7 @@ zigpy-znp==0.7.0 zigpy==0.45.1 # homeassistant.components.zwave_js -zwave-js-server-python==0.36.1 +zwave-js-server-python==0.37.0 # homeassistant.components.zwave_me zwave_me_ws==0.2.4 diff --git a/tests/components/zwave_js/fixtures/aeon_smart_switch_6_state.json b/tests/components/zwave_js/fixtures/aeon_smart_switch_6_state.json index cc26ce14e3e..62b6205926b 100644 --- a/tests/components/zwave_js/fixtures/aeon_smart_switch_6_state.json +++ b/tests/components/zwave_js/fixtures/aeon_smart_switch_6_state.json @@ -51,7 +51,14 @@ "index": 0, "installerIcon": 1792, "userIcon": 1792, - "commandClasses": [] + "commandClasses": [ + { + "id": 50, + "name": "Meter", + "version": 3, + "isSecure": false + } + ] } ], "values": [ diff --git a/tests/components/zwave_js/fixtures/climate_danfoss_lc_13_state.json b/tests/components/zwave_js/fixtures/climate_danfoss_lc_13_state.json index a877f82b53f..cb8e78881df 100644 --- a/tests/components/zwave_js/fixtures/climate_danfoss_lc_13_state.json +++ b/tests/components/zwave_js/fixtures/climate_danfoss_lc_13_state.json @@ -126,7 +126,63 @@ "endpoints": [ { "nodeId": 5, - "index": 0 + "index": 0, + "commandClasses": [ + { + "id": 67, + "name": "Thermostat Setpoint", + "version": 2, + "isSecure": false + }, + { + "id": 70, + "name": "Climate Control Schedule", + "version": 1, + "isSecure": false + }, + { + "id": 114, + "name": "Manufacturer Specific", + "version": 1, + "isSecure": false + }, + { + "id": 117, + "name": "Protection", + "version": 2, + "isSecure": false + }, + { + "id": 128, + "name": "Battery", + "version": 1, + "isSecure": false + }, + { + "id": 129, + "name": "Clock", + "version": 1, + "isSecure": false + }, + { + "id": 132, + "name": "Wake Up", + "version": 1, + "isSecure": false + }, + { + "id": 134, + "name": "Version", + "version": 1, + "isSecure": false + }, + { + "id": 143, + "name": "Multi Command", + "version": 1, + "isSecure": false + } + ] } ], "values": [ diff --git a/tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_plus_different_endpoints_state.json b/tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_plus_different_endpoints_state.json index 15823a8f6ca..ca0efb56711 100644 --- a/tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_plus_different_endpoints_state.json +++ b/tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_plus_different_endpoints_state.json @@ -62,7 +62,123 @@ }, "mandatorySupportedCCs": [32, 114, 64, 67, 134], "mandatoryControlledCCs": [] - } + }, + "commandClasses": [ + { + "id": 49, + "name": "Multilevel Sensor", + "version": 5, + "isSecure": false + }, + { + "id": 64, + "name": "Thermostat Mode", + "version": 2, + "isSecure": false + }, + { + "id": 66, + "name": "Thermostat Operating State", + "version": 2, + "isSecure": false + }, + { + "id": 67, + "name": "Thermostat Setpoint", + "version": 2, + "isSecure": false + }, + { + "id": 68, + "name": "Thermostat Fan Mode", + "version": 1, + "isSecure": false + }, + { + "id": 69, + "name": "Thermostat Fan State", + "version": 1, + "isSecure": false + }, + { + "id": 89, + "name": "Association Group Information", + "version": 1, + "isSecure": false + }, + { + "id": 90, + "name": "Device Reset Locally", + "version": 1, + "isSecure": false + }, + { + "id": 94, + "name": "Z-Wave Plus Info", + "version": 2, + "isSecure": false + }, + { + "id": 96, + "name": "Multi Channel", + "version": 4, + "isSecure": false + }, + { + "id": 112, + "name": "Configuration", + "version": 1, + "isSecure": false + }, + { + "id": 114, + "name": "Manufacturer Specific", + "version": 2, + "isSecure": false + }, + { + "id": 122, + "name": "Firmware Update Meta Data", + "version": 3, + "isSecure": false + }, + { + "id": 128, + "name": "Battery", + "version": 1, + "isSecure": false + }, + { + "id": 129, + "name": "Clock", + "version": 1, + "isSecure": false + }, + { + "id": 133, + "name": "Association", + "version": 2, + "isSecure": false + }, + { + "id": 134, + "name": "Version", + "version": 2, + "isSecure": false + }, + { + "id": 135, + "name": "Indicator", + "version": 1, + "isSecure": false + }, + { + "id": 142, + "name": "Multi Channel Association", + "version": 3, + "isSecure": false + } + ] }, { "nodeId": 26, @@ -82,7 +198,123 @@ }, "mandatorySupportedCCs": [32, 114, 64, 67, 134], "mandatoryControlledCCs": [] - } + }, + "commandClasses": [ + { + "id": 49, + "name": "Multilevel Sensor", + "version": 5, + "isSecure": false + }, + { + "id": 64, + "name": "Thermostat Mode", + "version": 2, + "isSecure": false + }, + { + "id": 66, + "name": "Thermostat Operating State", + "version": 2, + "isSecure": false + }, + { + "id": 67, + "name": "Thermostat Setpoint", + "version": 2, + "isSecure": false + }, + { + "id": 68, + "name": "Thermostat Fan Mode", + "version": 1, + "isSecure": false + }, + { + "id": 69, + "name": "Thermostat Fan State", + "version": 1, + "isSecure": false + }, + { + "id": 89, + "name": "Association Group Information", + "version": 1, + "isSecure": false + }, + { + "id": 90, + "name": "Device Reset Locally", + "version": 1, + "isSecure": false + }, + { + "id": 94, + "name": "Z-Wave Plus Info", + "version": 2, + "isSecure": false + }, + { + "id": 96, + "name": "Multi Channel", + "version": 4, + "isSecure": false + }, + { + "id": 112, + "name": "Configuration", + "version": 1, + "isSecure": false + }, + { + "id": 114, + "name": "Manufacturer Specific", + "version": 2, + "isSecure": false + }, + { + "id": 122, + "name": "Firmware Update Meta Data", + "version": 3, + "isSecure": false + }, + { + "id": 128, + "name": "Battery", + "version": 1, + "isSecure": false + }, + { + "id": 129, + "name": "Clock", + "version": 1, + "isSecure": false + }, + { + "id": 133, + "name": "Association", + "version": 2, + "isSecure": false + }, + { + "id": 134, + "name": "Version", + "version": 2, + "isSecure": false + }, + { + "id": 135, + "name": "Indicator", + "version": 1, + "isSecure": false + }, + { + "id": 142, + "name": "Multi Channel Association", + "version": 3, + "isSecure": false + } + ] }, { "nodeId": 26, @@ -102,7 +334,123 @@ }, "mandatorySupportedCCs": [32, 49], "mandatoryControlledCCs": [] - } + }, + "commandClasses": [ + { + "id": 49, + "name": "Multilevel Sensor", + "version": 5, + "isSecure": false + }, + { + "id": 64, + "name": "Thermostat Mode", + "version": 2, + "isSecure": false + }, + { + "id": 66, + "name": "Thermostat Operating State", + "version": 2, + "isSecure": false + }, + { + "id": 67, + "name": "Thermostat Setpoint", + "version": 2, + "isSecure": false + }, + { + "id": 68, + "name": "Thermostat Fan Mode", + "version": 1, + "isSecure": false + }, + { + "id": 69, + "name": "Thermostat Fan State", + "version": 1, + "isSecure": false + }, + { + "id": 89, + "name": "Association Group Information", + "version": 1, + "isSecure": false + }, + { + "id": 90, + "name": "Device Reset Locally", + "version": 1, + "isSecure": false + }, + { + "id": 94, + "name": "Z-Wave Plus Info", + "version": 2, + "isSecure": false + }, + { + "id": 96, + "name": "Multi Channel", + "version": 4, + "isSecure": false + }, + { + "id": 112, + "name": "Configuration", + "version": 1, + "isSecure": false + }, + { + "id": 114, + "name": "Manufacturer Specific", + "version": 2, + "isSecure": false + }, + { + "id": 122, + "name": "Firmware Update Meta Data", + "version": 3, + "isSecure": false + }, + { + "id": 128, + "name": "Battery", + "version": 1, + "isSecure": false + }, + { + "id": 129, + "name": "Clock", + "version": 1, + "isSecure": false + }, + { + "id": 133, + "name": "Association", + "version": 2, + "isSecure": false + }, + { + "id": 134, + "name": "Version", + "version": 2, + "isSecure": false + }, + { + "id": 135, + "name": "Indicator", + "version": 1, + "isSecure": false + }, + { + "id": 142, + "name": "Multi Channel Association", + "version": 3, + "isSecure": false + } + ] } ], "values": [ diff --git a/tests/components/zwave_js/test_api.py b/tests/components/zwave_js/test_api.py index ee6a85db70f..e59a923ff44 100644 --- a/tests/components/zwave_js/test_api.py +++ b/tests/components/zwave_js/test_api.py @@ -1147,6 +1147,8 @@ async def test_get_provisioning_entries(hass, integration, client, hass_ws_clien { "dsk": "test", "security_classes": [SecurityClass.S2_UNAUTHENTICATED], + "requested_security_classes": None, + "status": 0, "additional_properties": {"fake": "test"}, } ] @@ -1235,6 +1237,8 @@ async def test_parse_qr_code_string(hass, integration, client, hass_ws_client): "max_inclusion_request_interval": 1, "uuid": "test", "supported_protocols": [Protocols.ZWAVE], + "status": 0, + "requested_security_classes": None, "additional_properties": {}, } @@ -3535,6 +3539,7 @@ async def test_check_for_config_updates(hass, client, integration, hass_ws_clien client.async_send_command.return_value = { "updateAvailable": True, "newVersion": "test", + "installedVersion": "test", } await ws_client.send_json( { diff --git a/tests/components/zwave_js/test_services.py b/tests/components/zwave_js/test_services.py index dec4c3c0a9d..b5ef083bf64 100644 --- a/tests/components/zwave_js/test_services.py +++ b/tests/components/zwave_js/test_services.py @@ -1817,7 +1817,7 @@ async def test_invoke_cc_api( device_radio_thermostat.id, device_danfoss.id, ], - ATTR_COMMAND_CLASS: 132, + ATTR_COMMAND_CLASS: 67, ATTR_ENDPOINT: 0, ATTR_METHOD_NAME: "someMethod", ATTR_PARAMETERS: [1, 2], @@ -1827,7 +1827,7 @@ async def test_invoke_cc_api( assert len(client.async_send_command.call_args_list) == 1 args = client.async_send_command.call_args[0][0] assert args["command"] == "endpoint.invoke_cc_api" - assert args["commandClass"] == 132 + assert args["commandClass"] == 67 assert args["endpoint"] == 0 assert args["methodName"] == "someMethod" assert args["args"] == [1, 2] @@ -1839,7 +1839,7 @@ async def test_invoke_cc_api( assert len(client.async_send_command_no_wait.call_args_list) == 1 args = client.async_send_command_no_wait.call_args[0][0] assert args["command"] == "endpoint.invoke_cc_api" - assert args["commandClass"] == 132 + assert args["commandClass"] == 67 assert args["endpoint"] == 0 assert args["methodName"] == "someMethod" assert args["args"] == [1, 2] @@ -1870,7 +1870,7 @@ async def test_invoke_cc_api( "select.living_connect_z_thermostat_local_protection_state", "sensor.living_connect_z_thermostat_node_status", ], - ATTR_COMMAND_CLASS: 132, + ATTR_COMMAND_CLASS: 67, ATTR_METHOD_NAME: "someMethod", ATTR_PARAMETERS: [1, 2], }, @@ -1879,7 +1879,7 @@ async def test_invoke_cc_api( assert len(client.async_send_command.call_args_list) == 1 args = client.async_send_command.call_args[0][0] assert args["command"] == "endpoint.invoke_cc_api" - assert args["commandClass"] == 132 + assert args["commandClass"] == 67 assert args["endpoint"] == 0 assert args["methodName"] == "someMethod" assert args["args"] == [1, 2] @@ -1891,7 +1891,7 @@ async def test_invoke_cc_api( assert len(client.async_send_command_no_wait.call_args_list) == 1 args = client.async_send_command_no_wait.call_args[0][0] assert args["command"] == "endpoint.invoke_cc_api" - assert args["commandClass"] == 132 + assert args["commandClass"] == 67 assert args["endpoint"] == 0 assert args["methodName"] == "someMethod" assert args["args"] == [1, 2] @@ -1916,7 +1916,7 @@ async def test_invoke_cc_api( device_danfoss.id, device_radio_thermostat.id, ], - ATTR_COMMAND_CLASS: 132, + ATTR_COMMAND_CLASS: 67, ATTR_ENDPOINT: 0, ATTR_METHOD_NAME: "someMethod", ATTR_PARAMETERS: [1, 2], @@ -1926,7 +1926,7 @@ async def test_invoke_cc_api( assert len(client.async_send_command.call_args_list) == 1 args = client.async_send_command.call_args[0][0] assert args["command"] == "endpoint.invoke_cc_api" - assert args["commandClass"] == 132 + assert args["commandClass"] == 67 assert args["endpoint"] == 0 assert args["methodName"] == "someMethod" assert args["args"] == [1, 2] @@ -1938,7 +1938,7 @@ async def test_invoke_cc_api( assert len(client.async_send_command_no_wait.call_args_list) == 1 args = client.async_send_command_no_wait.call_args[0][0] assert args["command"] == "endpoint.invoke_cc_api" - assert args["commandClass"] == 132 + assert args["commandClass"] == 67 assert args["endpoint"] == 0 assert args["methodName"] == "someMethod" assert args["args"] == [1, 2]