diff --git a/homeassistant/components/zwave_js/const.py b/homeassistant/components/zwave_js/const.py index 4687110e208..ae5607745f6 100644 --- a/homeassistant/components/zwave_js/const.py +++ b/homeassistant/components/zwave_js/const.py @@ -70,7 +70,3 @@ ATTR_BROADCAST = "broadcast" SERVICE_PING = "ping" ADDON_SLUG = "core_zwave_js" - -# Siren constants -TONE_ID_DEFAULT = 255 -TONE_ID_OFF = 0 diff --git a/homeassistant/components/zwave_js/entity.py b/homeassistant/components/zwave_js/entity.py index 432bc2fa868..6df7c8d546b 100644 --- a/homeassistant/components/zwave_js/entity.py +++ b/homeassistant/components/zwave_js/entity.py @@ -4,7 +4,7 @@ from __future__ import annotations import logging from zwave_js_server.client import Client as ZwaveClient -from zwave_js_server.model.node import NodeStatus +from zwave_js_server.const import NodeStatus from zwave_js_server.model.value import Value as ZwaveValue, get_value_id from homeassistant.config_entries import ConfigEntry @@ -213,13 +213,13 @@ class ZWaveBaseEntity(Entity): # If we haven't found a value and check_all_endpoints is True, we should # return the first value we can find on any other endpoint if return_value is None and check_all_endpoints: - for endpoint_ in self.info.node.endpoints: - if endpoint_.index != self.info.primary_value.endpoint: + for endpoint_idx in self.info.node.endpoints: + if endpoint_idx != self.info.primary_value.endpoint: value_id = get_value_id( self.info.node, command_class, value_property, - endpoint=endpoint_.index, + endpoint=endpoint_idx, property_key=value_property_key, ) return_value = self.info.node.values.get(value_id) diff --git a/homeassistant/components/zwave_js/manifest.json b/homeassistant/components/zwave_js/manifest.json index d719e3976a4..b24bc957303 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.27.1"], + "requirements": ["zwave-js-server-python==0.28.0"], "codeowners": ["@home-assistant/z-wave"], "dependencies": ["http", "websocket_api"], "iot_class": "local_push" diff --git a/homeassistant/components/zwave_js/siren.py b/homeassistant/components/zwave_js/siren.py index fa6e24878ed..de74f55fa9a 100644 --- a/homeassistant/components/zwave_js/siren.py +++ b/homeassistant/components/zwave_js/siren.py @@ -4,6 +4,7 @@ from __future__ import annotations from typing import Any from zwave_js_server.client import Client as ZwaveClient +from zwave_js_server.const import ToneID from homeassistant.components.siren import DOMAIN as SIREN_DOMAIN, SirenEntity from homeassistant.components.siren.const import ( @@ -19,7 +20,7 @@ from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity_platform import AddEntitiesCallback -from .const import DATA_CLIENT, DOMAIN, TONE_ID_DEFAULT, TONE_ID_OFF +from .const import DATA_CLIENT, DOMAIN from .discovery import ZwaveDiscoveryInfo from .entity import ZWaveBaseEntity @@ -87,7 +88,7 @@ class ZwaveSirenEntity(ZWaveBaseEntity, SirenEntity): options["volume"] = round(volume * 100) # Play the default tone if a tone isn't provided if tone is None: - await self.async_set_value(TONE_ID_DEFAULT, options) + await self.async_set_value(ToneID.DEFAULT, options) return tone_id = int( @@ -102,4 +103,4 @@ class ZwaveSirenEntity(ZWaveBaseEntity, SirenEntity): async def async_turn_off(self, **kwargs: Any) -> None: """Turn the device off.""" - await self.async_set_value(TONE_ID_OFF) + await self.async_set_value(ToneID.OFF) diff --git a/requirements_all.txt b/requirements_all.txt index fa3b4d2ba4c..32223f0fdfb 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -2461,4 +2461,4 @@ zigpy==0.35.2 zm-py==0.5.2 # homeassistant.components.zwave_js -zwave-js-server-python==0.27.1 +zwave-js-server-python==0.28.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index eb34d203904..2baf16de687 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1355,4 +1355,4 @@ zigpy-znp==0.5.1 zigpy==0.35.2 # homeassistant.components.zwave_js -zwave-js-server-python==0.27.1 +zwave-js-server-python==0.28.0 diff --git a/tests/components/zwave_js/test_services.py b/tests/components/zwave_js/test_services.py index 92ead72e2ad..4b66e178e6f 100644 --- a/tests/components/zwave_js/test_services.py +++ b/tests/components/zwave_js/test_services.py @@ -35,6 +35,7 @@ from .common import ( AEON_SMART_SWITCH_LIGHT_ENTITY, AIR_TEMPERATURE_SENSOR, CLIMATE_DANFOSS_LC13_ENTITY, + CLIMATE_EUROTRONICS_SPIRIT_Z_ENTITY, CLIMATE_RADIO_THERMOSTAT_ENTITY, ) @@ -805,7 +806,7 @@ async def test_multicast_set_value( hass, client, climate_danfoss_lc_13, - climate_radio_thermostat_ct100_plus_different_endpoints, + climate_eurotronic_spirit_z, integration, ): """Test multicast_set_value service.""" @@ -816,7 +817,7 @@ async def test_multicast_set_value( { ATTR_ENTITY_ID: [ CLIMATE_DANFOSS_LC13_ENTITY, - CLIMATE_RADIO_THERMOSTAT_ENTITY, + CLIMATE_EUROTRONICS_SPIRIT_Z_ENTITY, ], ATTR_COMMAND_CLASS: 117, ATTR_PROPERTY: "local", @@ -829,7 +830,7 @@ async def test_multicast_set_value( args = client.async_send_command.call_args[0][0] assert args["command"] == "multicast_group.set_value" assert args["nodeIDs"] == [ - climate_radio_thermostat_ct100_plus_different_endpoints.node_id, + climate_eurotronic_spirit_z.node_id, climate_danfoss_lc_13.node_id, ] assert args["valueId"] == { @@ -847,7 +848,7 @@ async def test_multicast_set_value( { ATTR_ENTITY_ID: [ CLIMATE_DANFOSS_LC13_ENTITY, - CLIMATE_RADIO_THERMOSTAT_ENTITY, + CLIMATE_EUROTRONICS_SPIRIT_Z_ENTITY, ], ATTR_COMMAND_CLASS: 117, ATTR_PROPERTY: "local", @@ -860,7 +861,7 @@ async def test_multicast_set_value( args = client.async_send_command.call_args[0][0] assert args["command"] == "multicast_group.set_value" assert args["nodeIDs"] == [ - climate_radio_thermostat_ct100_plus_different_endpoints.node_id, + climate_eurotronic_spirit_z.node_id, climate_danfoss_lc_13.node_id, ] assert args["valueId"] == { @@ -937,7 +938,7 @@ async def test_multicast_set_value( { ATTR_ENTITY_ID: [ CLIMATE_DANFOSS_LC13_ENTITY, - CLIMATE_RADIO_THERMOSTAT_ENTITY, + CLIMATE_EUROTRONICS_SPIRIT_Z_ENTITY, ], ATTR_COMMAND_CLASS: 117, ATTR_PROPERTY: "local", diff --git a/tests/components/zwave_js/test_siren.py b/tests/components/zwave_js/test_siren.py index 23507e6a705..937b2c0fa67 100644 --- a/tests/components/zwave_js/test_siren.py +++ b/tests/components/zwave_js/test_siren.py @@ -53,6 +53,7 @@ TONE_ID_VALUE_ID = { "30": "30DOOR~1 (27 sec)", "255": "default", }, + "valueChangeOptions": ["volume"], }, } diff --git a/tests/fixtures/zwave_js/aeotec_zw164_siren_state.json b/tests/fixtures/zwave_js/aeotec_zw164_siren_state.json index 6bf7ece9758..5616abd6e0f 100644 --- a/tests/fixtures/zwave_js/aeotec_zw164_siren_state.json +++ b/tests/fixtures/zwave_js/aeotec_zw164_siren_state.json @@ -2597,7 +2597,8 @@ "writeable": true, "label": "Tone ID", "min": 0, - "max": 255 + "max": 255, + "valueChangeOptions": ["volume"] } }, { @@ -2726,7 +2727,8 @@ "29": "29UPWA~1 (2 sec)", "30": "30DOOR~1 (27 sec)", "255": "default" - } + }, + "valueChangeOptions": ["volume"] } }, { @@ -2856,7 +2858,8 @@ "29": "29UPWA~1 (2 sec)", "30": "30DOOR~1 (27 sec)", "255": "default" - } + }, + "valueChangeOptions": ["volume"] } }, { @@ -3011,7 +3014,8 @@ "29": "29UPWA~1 (2 sec)", "30": "30DOOR~1 (27 sec)", "255": "default" - } + }, + "valueChangeOptions": ["volume"] } }, { @@ -3166,7 +3170,8 @@ "29": "29UPWA~1 (2 sec)", "30": "30DOOR~1 (27 sec)", "255": "default" - } + }, + "valueChangeOptions": ["volume"] } }, { @@ -3321,7 +3326,8 @@ "29": "29UPWA~1 (2 sec)", "30": "30DOOR~1 (27 sec)", "255": "default" - } + }, + "valueChangeOptions": ["volume"] } }, { @@ -3451,7 +3457,8 @@ "29": "29UPWA~1 (2 sec)", "30": "30DOOR~1 (27 sec)", "255": "default" - } + }, + "valueChangeOptions": ["volume"] } }, { @@ -3581,7 +3588,8 @@ "29": "29UPWA~1 (2 sec)", "30": "30DOOR~1 (27 sec)", "255": "default" - } + }, + "valueChangeOptions": ["volume"] } }, { diff --git a/tests/fixtures/zwave_js/bulb_6_multi_color_state.json b/tests/fixtures/zwave_js/bulb_6_multi_color_state.json index 58608131e90..dfa72af6aa4 100644 --- a/tests/fixtures/zwave_js/bulb_6_multi_color_state.json +++ b/tests/fixtures/zwave_js/bulb_6_multi_color_state.json @@ -267,7 +267,8 @@ "min": 0, "max": 255, "label": "Target value (Warm White)", - "description": "The target value of the Warm White color." + "description": "The target value of the Warm White color.", + "valueChangeOptions": ["transitionDuration"] } }, { @@ -285,7 +286,8 @@ "min": 0, "max": 255, "label": "Target value (Cold White)", - "description": "The target value of the Cold White color." + "description": "The target value of the Cold White color.", + "valueChangeOptions": ["transitionDuration"] } }, { @@ -303,7 +305,8 @@ "min": 0, "max": 255, "label": "Target value (Red)", - "description": "The target value of the Red color." + "description": "The target value of the Red color.", + "valueChangeOptions": ["transitionDuration"] } }, { @@ -321,7 +324,8 @@ "min": 0, "max": 255, "label": "Target value (Green)", - "description": "The target value of the Green color." + "description": "The target value of the Green color.", + "valueChangeOptions": ["transitionDuration"] } }, { @@ -339,7 +343,8 @@ "min": 0, "max": 255, "label": "Target value (Blue)", - "description": "The target value of the Blue color." + "description": "The target value of the Blue color.", + "valueChangeOptions": ["transitionDuration"] } }, {