From bcb8777982b4f784df900248004b0afafa9ea5d1 Mon Sep 17 00:00:00 2001 From: Raman Gupta <7243222+raman325@users.noreply.github.com> Date: Sat, 29 Jul 2023 02:26:04 -0400 Subject: [PATCH] handle additional upstream changes --- .../components/zwave_js/diagnostics.py | 22 +++- .../components/zwave_js/triggers/event.py | 6 +- tests/components/zwave_js/conftest.py | 118 +++++++++--------- tests/components/zwave_js/test_api.py | 6 +- tests/components/zwave_js/test_climate.py | 3 + tests/components/zwave_js/test_diagnostics.py | 6 +- tests/components/zwave_js/test_init.py | 14 +-- tests/components/zwave_js/test_trigger.py | 4 +- 8 files changed, 102 insertions(+), 77 deletions(-) diff --git a/homeassistant/components/zwave_js/diagnostics.py b/homeassistant/components/zwave_js/diagnostics.py index 2fe2b17fe1b939..f36c0ad39fad0a 100644 --- a/homeassistant/components/zwave_js/diagnostics.py +++ b/homeassistant/components/zwave_js/diagnostics.py @@ -2,7 +2,7 @@ from __future__ import annotations from copy import deepcopy -from typing import Any +from typing import Any, cast from zwave_js_server.client import Client from zwave_js_server.const import CommandClass @@ -129,8 +129,8 @@ async def async_get_config_entry_diagnostics( handshake_msgs = msgs[:-1] network_state = msgs[-1] network_state["result"]["state"]["nodes"] = [ - redact_node_state(async_redact_data(node, KEYS_TO_REDACT)) - for node in network_state["result"]["state"]["nodes"] + redact_node_state(async_redact_data(node_data, KEYS_TO_REDACT)) + for node_data in network_state["result"]["state"]["nodes"] ] return {"messages": [*handshake_msgs, network_state]} @@ -148,7 +148,21 @@ async def async_get_device_diagnostics( node = driver.controller.nodes[node_id] entities = get_device_entities(hass, node, config_entry, device) assert client.version - node_state = redact_node_state(async_redact_data(node.data, KEYS_TO_REDACT)) + node_state = redact_node_state( + async_redact_data( + cast( + NodeDataType, + { + **node.data, + "values": [value.data for value in node.values.values()], + "endpoints": [ + endpoint.data for endpoint in node.endpoints.values() + ], + }, + ), + KEYS_TO_REDACT, + ) + ) return { "versionInfo": { "driverVersion": client.version.driver_version, diff --git a/homeassistant/components/zwave_js/triggers/event.py b/homeassistant/components/zwave_js/triggers/event.py index edc10d4a16e0e1..24d834697d605f 100644 --- a/homeassistant/components/zwave_js/triggers/event.py +++ b/homeassistant/components/zwave_js/triggers/event.py @@ -4,7 +4,6 @@ from collections.abc import Callable import functools -from pydantic import ValidationError import voluptuous as vol from zwave_js_server.client import Client from zwave_js_server.model.controller import CONTROLLER_EVENT_MODEL_MAP @@ -18,6 +17,11 @@ from homeassistant.helpers.trigger import TriggerActionType, TriggerInfo from homeassistant.helpers.typing import ConfigType +try: + from pydantic.v1 import ValidationError +except ImportError: + from pydantic import ValidationError + from ..const import ( ATTR_CONFIG_ENTRY_ID, ATTR_EVENT, diff --git a/tests/components/zwave_js/conftest.py b/tests/components/zwave_js/conftest.py index 0eb4ec775f932a..43471c46a7c000 100644 --- a/tests/components/zwave_js/conftest.py +++ b/tests/components/zwave_js/conftest.py @@ -240,19 +240,19 @@ def create_backup_fixture(): # State fixtures -@pytest.fixture(name="controller_state", scope="session") +@pytest.fixture(name="controller_state") def controller_state_fixture(): """Load the controller state fixture data.""" return json.loads(load_fixture("zwave_js/controller_state.json")) -@pytest.fixture(name="controller_node_state", scope="session") +@pytest.fixture(name="controller_node_state") def controller_node_state_fixture(): """Load the controller node state fixture data.""" return json.loads(load_fixture("zwave_js/controller_node_state.json")) -@pytest.fixture(name="version_state", scope="session") +@pytest.fixture(name="version_state") def version_state_fixture(): """Load the version state fixture data.""" return { @@ -275,67 +275,67 @@ def log_config_state_fixture(): } -@pytest.fixture(name="config_entry_diagnostics", scope="session") +@pytest.fixture(name="config_entry_diagnostics") def config_entry_diagnostics_fixture(): """Load the config entry diagnostics fixture data.""" return json.loads(load_fixture("zwave_js/config_entry_diagnostics.json")) -@pytest.fixture(name="config_entry_diagnostics_redacted", scope="session") +@pytest.fixture(name="config_entry_diagnostics_redacted") def config_entry_diagnostics_redacted_fixture(): """Load the redacted config entry diagnostics fixture data.""" return json.loads(load_fixture("zwave_js/config_entry_diagnostics_redacted.json")) -@pytest.fixture(name="multisensor_6_state", scope="session") +@pytest.fixture(name="multisensor_6_state") def multisensor_6_state_fixture(): """Load the multisensor 6 node state fixture data.""" return json.loads(load_fixture("zwave_js/multisensor_6_state.json")) -@pytest.fixture(name="ecolink_door_sensor_state", scope="session") +@pytest.fixture(name="ecolink_door_sensor_state") def ecolink_door_sensor_state_fixture(): """Load the Ecolink Door/Window Sensor node state fixture data.""" return json.loads(load_fixture("zwave_js/ecolink_door_sensor_state.json")) -@pytest.fixture(name="hank_binary_switch_state", scope="session") +@pytest.fixture(name="hank_binary_switch_state") def binary_switch_state_fixture(): """Load the hank binary switch node state fixture data.""" return json.loads(load_fixture("zwave_js/hank_binary_switch_state.json")) -@pytest.fixture(name="bulb_6_multi_color_state", scope="session") +@pytest.fixture(name="bulb_6_multi_color_state") def bulb_6_multi_color_state_fixture(): """Load the bulb 6 multi-color node state fixture data.""" return json.loads(load_fixture("zwave_js/bulb_6_multi_color_state.json")) -@pytest.fixture(name="light_color_null_values_state", scope="session") +@pytest.fixture(name="light_color_null_values_state") def light_color_null_values_state_fixture(): """Load the light color null values node state fixture data.""" return json.loads(load_fixture("zwave_js/light_color_null_values_state.json")) -@pytest.fixture(name="eaton_rf9640_dimmer_state", scope="session") +@pytest.fixture(name="eaton_rf9640_dimmer_state") def eaton_rf9640_dimmer_state_fixture(): """Load the eaton rf9640 dimmer node state fixture data.""" return json.loads(load_fixture("zwave_js/eaton_rf9640_dimmer_state.json")) -@pytest.fixture(name="lock_schlage_be469_state", scope="session") +@pytest.fixture(name="lock_schlage_be469_state") def lock_schlage_be469_state_fixture(): """Load the schlage lock node state fixture data.""" return json.loads(load_fixture("zwave_js/lock_schlage_be469_state.json")) -@pytest.fixture(name="lock_august_asl03_state", scope="session") +@pytest.fixture(name="lock_august_asl03_state") def lock_august_asl03_state_fixture(): """Load the August Pro lock node state fixture data.""" return json.loads(load_fixture("zwave_js/lock_august_asl03_state.json")) -@pytest.fixture(name="climate_radio_thermostat_ct100_plus_state", scope="session") +@pytest.fixture(name="climate_radio_thermostat_ct100_plus_state") def climate_radio_thermostat_ct100_plus_state_fixture(): """Load the climate radio thermostat ct100 plus node state fixture data.""" return json.loads( @@ -359,13 +359,13 @@ def climate_radio_thermostat_ct100_plus_different_endpoints_state_fixture(): ) -@pytest.fixture(name="climate_adc_t3000_state", scope="session") +@pytest.fixture(name="climate_adc_t3000_state") def climate_adc_t3000_state_fixture(): """Load the climate ADC-T3000 node state fixture data.""" return json.loads(load_fixture("zwave_js/climate_adc_t3000_state.json")) -@pytest.fixture(name="climate_airzone_aidoo_control_hvac_unit_state", scope="session") +@pytest.fixture(name="climate_airzone_aidoo_control_hvac_unit_state") def climate_airzone_aidoo_control_hvac_unit_state_fixture(): """Load the climate Airzone Aidoo Control HVAC Unit state fixture data.""" return json.loads( @@ -373,31 +373,31 @@ def climate_airzone_aidoo_control_hvac_unit_state_fixture(): ) -@pytest.fixture(name="climate_danfoss_lc_13_state", scope="session") +@pytest.fixture(name="climate_danfoss_lc_13_state") def climate_danfoss_lc_13_state_fixture(): """Load Danfoss (LC-13) electronic radiator thermostat node state fixture data.""" return json.loads(load_fixture("zwave_js/climate_danfoss_lc_13_state.json")) -@pytest.fixture(name="climate_eurotronic_spirit_z_state", scope="session") +@pytest.fixture(name="climate_eurotronic_spirit_z_state") def climate_eurotronic_spirit_z_state_fixture(): """Load the climate Eurotronic Spirit Z thermostat node state fixture data.""" return json.loads(load_fixture("zwave_js/climate_eurotronic_spirit_z_state.json")) -@pytest.fixture(name="climate_heatit_z_trm3_state", scope="session") +@pytest.fixture(name="climate_heatit_z_trm3_state") def climate_heatit_z_trm3_state_fixture(): """Load the climate HEATIT Z-TRM3 thermostat node state fixture data.""" return json.loads(load_fixture("zwave_js/climate_heatit_z_trm3_state.json")) -@pytest.fixture(name="climate_heatit_z_trm2fx_state", scope="session") +@pytest.fixture(name="climate_heatit_z_trm2fx_state") def climate_heatit_z_trm2fx_state_fixture(): """Load the climate HEATIT Z-TRM2fx thermostat node state fixture data.""" return json.loads(load_fixture("zwave_js/climate_heatit_z_trm2fx_state.json")) -@pytest.fixture(name="climate_heatit_z_trm3_no_value_state", scope="session") +@pytest.fixture(name="climate_heatit_z_trm3_no_value_state") def climate_heatit_z_trm3_no_value_state_fixture(): """Load the climate HEATIT Z-TRM3 thermostat node w/no value state fixture data.""" return json.loads( @@ -405,129 +405,127 @@ def climate_heatit_z_trm3_no_value_state_fixture(): ) -@pytest.fixture(name="nortek_thermostat_state", scope="session") +@pytest.fixture(name="nortek_thermostat_state") def nortek_thermostat_state_fixture(): """Load the nortek thermostat node state fixture data.""" return json.loads(load_fixture("zwave_js/nortek_thermostat_state.json")) -@pytest.fixture(name="srt321_hrt4_zw_state", scope="session") +@pytest.fixture(name="srt321_hrt4_zw_state") def srt321_hrt4_zw_state_fixture(): """Load the climate HRT4-ZW / SRT321 / SRT322 thermostat node state fixture data.""" return json.loads(load_fixture("zwave_js/srt321_hrt4_zw_state.json")) -@pytest.fixture(name="chain_actuator_zws12_state", scope="session") +@pytest.fixture(name="chain_actuator_zws12_state") def window_cover_state_fixture(): """Load the window cover node state fixture data.""" return json.loads(load_fixture("zwave_js/chain_actuator_zws12_state.json")) -@pytest.fixture(name="fan_generic_state", scope="session") +@pytest.fixture(name="fan_generic_state") def fan_generic_state_fixture(): """Load the fan node state fixture data.""" return json.loads(load_fixture("zwave_js/fan_generic_state.json")) -@pytest.fixture(name="hs_fc200_state", scope="session") +@pytest.fixture(name="hs_fc200_state") def hs_fc200_state_fixture(): """Load the HS FC200+ node state fixture data.""" return json.loads(load_fixture("zwave_js/fan_hs_fc200_state.json")) -@pytest.fixture(name="leviton_zw4sf_state", scope="session") +@pytest.fixture(name="leviton_zw4sf_state") def leviton_zw4sf_state_fixture(): """Load the Leviton ZW4SF node state fixture data.""" return json.loads(load_fixture("zwave_js/leviton_zw4sf_state.json")) -@pytest.fixture(name="fan_honeywell_39358_state", scope="session") +@pytest.fixture(name="fan_honeywell_39358_state") def fan_honeywell_39358_state_fixture(): """Load the fan node state fixture data.""" return json.loads(load_fixture("zwave_js/fan_honeywell_39358_state.json")) -@pytest.fixture(name="gdc_zw062_state", scope="session") +@pytest.fixture(name="gdc_zw062_state") def motorized_barrier_cover_state_fixture(): """Load the motorized barrier cover node state fixture data.""" return json.loads(load_fixture("zwave_js/cover_zw062_state.json")) -@pytest.fixture(name="iblinds_v2_state", scope="session") +@pytest.fixture(name="iblinds_v2_state") def iblinds_v2_state_fixture(): """Load the iBlinds v2 node state fixture data.""" return json.loads(load_fixture("zwave_js/cover_iblinds_v2_state.json")) -@pytest.fixture(name="iblinds_v3_state", scope="session") +@pytest.fixture(name="iblinds_v3_state") def iblinds_v3_state_fixture(): """Load the iBlinds v3 node state fixture data.""" return json.loads(load_fixture("zwave_js/cover_iblinds_v3_state.json")) -@pytest.fixture(name="qubino_shutter_state", scope="session") +@pytest.fixture(name="qubino_shutter_state") def qubino_shutter_state_fixture(): """Load the Qubino Shutter node state fixture data.""" return json.loads(load_fixture("zwave_js/cover_qubino_shutter_state.json")) -@pytest.fixture(name="aeotec_nano_shutter_state", scope="session") +@pytest.fixture(name="aeotec_nano_shutter_state") def aeotec_nano_shutter_state_fixture(): """Load the Aeotec Nano Shutter node state fixture data.""" return json.loads(load_fixture("zwave_js/cover_aeotec_nano_shutter_state.json")) -@pytest.fixture(name="fibaro_fgr222_shutter_state", scope="session") +@pytest.fixture(name="fibaro_fgr222_shutter_state") def fibaro_fgr222_shutter_state_fixture(): """Load the Fibaro FGR222 node state fixture data.""" return json.loads(load_fixture("zwave_js/cover_fibaro_fgr222_state.json")) -@pytest.fixture(name="merten_507801_state", scope="session") +@pytest.fixture(name="merten_507801_state") def merten_507801_state_fixture(): """Load the Merten 507801 Shutter node state fixture data.""" return json.loads(load_fixture("zwave_js/cover_merten_507801_state.json")) -@pytest.fixture(name="aeon_smart_switch_6_state", scope="session") +@pytest.fixture(name="aeon_smart_switch_6_state") def aeon_smart_switch_6_state_fixture(): """Load the AEON Labs (ZW096) Smart Switch 6 node state fixture data.""" return json.loads(load_fixture("zwave_js/aeon_smart_switch_6_state.json")) -@pytest.fixture(name="ge_12730_state", scope="session") +@pytest.fixture(name="ge_12730_state") def ge_12730_state_fixture(): """Load the GE 12730 node state fixture data.""" return json.loads(load_fixture("zwave_js/fan_ge_12730_state.json")) -@pytest.fixture(name="aeotec_radiator_thermostat_state", scope="session") +@pytest.fixture(name="aeotec_radiator_thermostat_state") def aeotec_radiator_thermostat_state_fixture(): """Load the Aeotec Radiator Thermostat node state fixture data.""" return json.loads(load_fixture("zwave_js/aeotec_radiator_thermostat_state.json")) -@pytest.fixture(name="inovelli_lzw36_state", scope="session") +@pytest.fixture(name="inovelli_lzw36_state") def inovelli_lzw36_state_fixture(): """Load the Inovelli LZW36 node state fixture data.""" return json.loads(load_fixture("zwave_js/inovelli_lzw36_state.json")) -@pytest.fixture(name="null_name_check_state", scope="session") +@pytest.fixture(name="null_name_check_state") def null_name_check_state_fixture(): """Load the null name check node state fixture data.""" return json.loads(load_fixture("zwave_js/null_name_check_state.json")) -@pytest.fixture(name="lock_id_lock_as_id150_state", scope="session") +@pytest.fixture(name="lock_id_lock_as_id150_state") def lock_id_lock_as_id150_state_fixture(): """Load the id lock id-150 lock node state fixture data.""" return json.loads(load_fixture("zwave_js/lock_id_lock_as_id150_state.json")) -@pytest.fixture( - name="climate_radio_thermostat_ct101_multiple_temp_units_state", scope="session" -) +@pytest.fixture(name="climate_radio_thermostat_ct101_multiple_temp_units_state") def climate_radio_thermostat_ct101_multiple_temp_units_state_fixture(): """Load the climate multiple temp units node state fixture data.""" return json.loads( @@ -552,37 +550,37 @@ def climate_radio_thermostat_ct100_mode_and_setpoint_on_different_endpoints_stat ) -@pytest.fixture(name="vision_security_zl7432_state", scope="session") +@pytest.fixture(name="vision_security_zl7432_state") def vision_security_zl7432_state_fixture(): """Load the vision security zl7432 switch node state fixture data.""" return json.loads(load_fixture("zwave_js/vision_security_zl7432_state.json")) -@pytest.fixture(name="zen_31_state", scope="session") +@pytest.fixture(name="zen_31_state") def zem_31_state_fixture(): """Load the zen_31 node state fixture data.""" return json.loads(load_fixture("zwave_js/zen_31_state.json")) -@pytest.fixture(name="wallmote_central_scene_state", scope="session") +@pytest.fixture(name="wallmote_central_scene_state") def wallmote_central_scene_state_fixture(): """Load the wallmote central scene node state fixture data.""" return json.loads(load_fixture("zwave_js/wallmote_central_scene_state.json")) -@pytest.fixture(name="ge_in_wall_dimmer_switch_state", scope="session") +@pytest.fixture(name="ge_in_wall_dimmer_switch_state") def ge_in_wall_dimmer_switch_state_fixture(): """Load the ge in-wall dimmer switch node state fixture data.""" return json.loads(load_fixture("zwave_js/ge_in_wall_dimmer_switch_state.json")) -@pytest.fixture(name="aeotec_zw164_siren_state", scope="session") +@pytest.fixture(name="aeotec_zw164_siren_state") def aeotec_zw164_siren_state_fixture(): """Load the aeotec zw164 siren node state fixture data.""" return json.loads(load_fixture("zwave_js/aeotec_zw164_siren_state.json")) -@pytest.fixture(name="lock_popp_electric_strike_lock_control_state", scope="session") +@pytest.fixture(name="lock_popp_electric_strike_lock_control_state") def lock_popp_electric_strike_lock_control_state_fixture(): """Load the popp electric strike lock control node state fixture data.""" return json.loads( @@ -590,61 +588,61 @@ def lock_popp_electric_strike_lock_control_state_fixture(): ) -@pytest.fixture(name="fortrezz_ssa1_siren_state", scope="session") +@pytest.fixture(name="fortrezz_ssa1_siren_state") def fortrezz_ssa1_siren_state_fixture(): """Load the fortrezz ssa1 siren node state fixture data.""" return json.loads(load_fixture("zwave_js/fortrezz_ssa1_siren_state.json")) -@pytest.fixture(name="fortrezz_ssa3_siren_state", scope="session") +@pytest.fixture(name="fortrezz_ssa3_siren_state") def fortrezz_ssa3_siren_state_fixture(): """Load the fortrezz ssa3 siren node state fixture data.""" return json.loads(load_fixture("zwave_js/fortrezz_ssa3_siren_state.json")) -@pytest.fixture(name="zp3111_not_ready_state", scope="session") +@pytest.fixture(name="zp3111_not_ready_state") def zp3111_not_ready_state_fixture(): """Load the zp3111 4-in-1 sensor not-ready node state fixture data.""" return json.loads(load_fixture("zwave_js/zp3111-5_not_ready_state.json")) -@pytest.fixture(name="zp3111_state", scope="session") +@pytest.fixture(name="zp3111_state") def zp3111_state_fixture(): """Load the zp3111 4-in-1 sensor node state fixture data.""" return json.loads(load_fixture("zwave_js/zp3111-5_state.json")) -@pytest.fixture(name="express_controls_ezmultipli_state", scope="session") +@pytest.fixture(name="express_controls_ezmultipli_state") def light_express_controls_ezmultipli_state_fixture(): """Load the Express Controls EZMultiPli node state fixture data.""" return json.loads(load_fixture("zwave_js/express_controls_ezmultipli_state.json")) -@pytest.fixture(name="lock_home_connect_620_state", scope="session") +@pytest.fixture(name="lock_home_connect_620_state") def lock_home_connect_620_state_fixture(): """Load the Home Connect 620 lock node state fixture data.""" return json.loads(load_fixture("zwave_js/lock_home_connect_620_state.json")) -@pytest.fixture(name="switch_zooz_zen72_state", scope="session") +@pytest.fixture(name="switch_zooz_zen72_state") def switch_zooz_zen72_state_fixture(): """Load the Zooz Zen72 switch node state fixture data.""" return json.loads(load_fixture("zwave_js/switch_zooz_zen72_state.json")) -@pytest.fixture(name="indicator_test_state", scope="session") +@pytest.fixture(name="indicator_test_state") def indicator_test_state_fixture(): """Load the indicator CC test node state fixture data.""" return json.loads(load_fixture("zwave_js/indicator_test_state.json")) -@pytest.fixture(name="energy_production_state", scope="session") +@pytest.fixture(name="energy_production_state") def energy_production_state_fixture(): """Load a mock node with energy production CC state fixture data.""" return json.loads(load_fixture("zwave_js/energy_production_state.json")) -@pytest.fixture(name="nice_ibt4zwave_state", scope="session") +@pytest.fixture(name="nice_ibt4zwave_state") def nice_ibt4zwave_state_fixture(): """Load a Nice IBT4ZWAVE cover node state fixture data.""" return json.loads(load_fixture("zwave_js/cover_nice_ibt4zwave_state.json")) diff --git a/tests/components/zwave_js/test_api.py b/tests/components/zwave_js/test_api.py index b50f50a2197130..5bafe9323625dd 100644 --- a/tests/components/zwave_js/test_api.py +++ b/tests/components/zwave_js/test_api.py @@ -276,14 +276,16 @@ async def test_subscribe_node_status( msg = await ws_client.receive_json() assert msg["success"] - node.data["ready"] = True + new_node_data = deepcopy(multisensor_6_state) + new_node_data["ready"] = True + event = Event( "ready", { "source": "node", "event": "ready", "nodeId": node.node_id, - "nodeState": node.data, + "nodeState": new_node_data, }, ) node.receive_event(event) diff --git a/tests/components/zwave_js/test_climate.py b/tests/components/zwave_js/test_climate.py index fcdfc58433d6a0..e06f8cec539c48 100644 --- a/tests/components/zwave_js/test_climate.py +++ b/tests/components/zwave_js/test_climate.py @@ -743,6 +743,8 @@ async def test_thermostat_raise_repair_issue_and_warning_when_setting_dry_preset caplog: pytest.LogCaptureFixture, ) -> None: """Test raise of repair issue and warning when setting Dry preset.""" + client.async_send_command.return_value = {"result": {"status": 1}} + state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY) assert state @@ -777,6 +779,7 @@ async def test_thermostat_raise_repair_issue_and_warning_when_setting_fan_preset caplog: pytest.LogCaptureFixture, ) -> None: """Test raise of repair issue and warning when setting Fan preset.""" + client.async_send_command.return_value = {"result": {"status": 1}} state = hass.states.get(CLIMATE_AIDOO_HVAC_UNIT_ENTITY) assert state diff --git a/tests/components/zwave_js/test_diagnostics.py b/tests/components/zwave_js/test_diagnostics.py index 4454e38e0d8c85..d502bb0ab2e1c9 100644 --- a/tests/components/zwave_js/test_diagnostics.py +++ b/tests/components/zwave_js/test_diagnostics.py @@ -125,7 +125,11 @@ async def test_device_diagnostics( entity["entity_id"] == "test.unrelated_entity" for entity in diagnostics_data["entities"] ) - assert diagnostics_data["state"] == multisensor_6.data + assert diagnostics_data["state"] == { + **multisensor_6.data, + "values": [val.data for val in multisensor_6.values.values()], + "endpoints": [endpoint.data for endpoint in multisensor_6.endpoints.values()], + } async def test_device_diagnostics_error(hass: HomeAssistant, integration) -> None: diff --git a/tests/components/zwave_js/test_init.py b/tests/components/zwave_js/test_init.py index a23945b6720424..c421e0434130dc 100644 --- a/tests/components/zwave_js/test_init.py +++ b/tests/components/zwave_js/test_init.py @@ -1005,7 +1005,7 @@ async def test_node_removed( event = { "source": "controller", "event": "node added", - "node": node.data, + "node": multisensor_6_state, "result": {}, } @@ -1139,8 +1139,8 @@ async def test_replace_different_node( """Test when a node is replaced with a different node.""" dev_reg = dr.async_get(hass) node_id = multisensor_6.node_id - hank_binary_switch_state = deepcopy(hank_binary_switch_state) - hank_binary_switch_state["nodeId"] = node_id + state = deepcopy(hank_binary_switch_state) + state["nodeId"] = node_id device_id = f"{client.driver.controller.home_id}-{node_id}" multisensor_6_device_id = ( @@ -1148,9 +1148,9 @@ async def test_replace_different_node( f"{multisensor_6.product_type}:{multisensor_6.product_id}" ) hank_device_id = ( - f"{device_id}-{hank_binary_switch_state['manufacturerId']}:" - f"{hank_binary_switch_state['productType']}:" - f"{hank_binary_switch_state['productId']}" + f"{device_id}-{state['manufacturerId']}:" + f"{state['productType']}:" + f"{state['productId']}" ) device = dev_reg.async_get_device(identifiers={(DOMAIN, device_id)}) @@ -1228,7 +1228,7 @@ async def test_replace_different_node( "source": "node", "event": "ready", "nodeId": node_id, - "nodeState": hank_binary_switch_state, + "nodeState": state, }, ) client.driver.receive_event(event) diff --git a/tests/components/zwave_js/test_trigger.py b/tests/components/zwave_js/test_trigger.py index 501ad13cbaa4db..25553489b4ed84 100644 --- a/tests/components/zwave_js/test_trigger.py +++ b/tests/components/zwave_js/test_trigger.py @@ -1158,7 +1158,7 @@ async def test_server_reconnect_event( data={ "source": "controller", "event": "node removed", - "replaced": False, + "reason": 0, "node": lock_schlage_be469_state, }, ) @@ -1238,7 +1238,7 @@ async def test_server_reconnect_value_updated( data={ "source": "controller", "event": "node removed", - "replaced": False, + "reason": 0, "node": lock_schlage_be469_state, }, )