Bump zwave-js-server-python to 0.48.0 (#91989)

* Bump zwave-js-server-python to 0.48.0

* Add handling of FailedZWaveCommand exception

* Reset mock to avoid unintentional side effects

* Fix bump
This commit is contained in:
Raman Gupta 2023-04-25 15:41:37 -04:00 committed by GitHub
parent dedb3f8b6b
commit 78a49ecbce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 12 deletions

View file

@ -8,7 +8,7 @@
"integration_type": "hub",
"iot_class": "local_push",
"loggers": ["zwave_js_server"],
"requirements": ["pyserial==3.5", "zwave-js-server-python==0.47.3"],
"requirements": ["pyserial==3.5", "zwave-js-server-python==0.48.0"],
"usb": [
{
"vid": "0658",

View file

@ -9,7 +9,7 @@ from typing import Any
import voluptuous as vol
from zwave_js_server.client import Client as ZwaveClient
from zwave_js_server.const import CommandClass, CommandStatus
from zwave_js_server.exceptions import SetValueFailed
from zwave_js_server.exceptions import FailedZWaveCommand, SetValueFailed
from zwave_js_server.model.endpoint import Endpoint
from zwave_js_server.model.node import Node as ZwaveNode
from zwave_js_server.model.value import ValueDataType, get_value_id_str
@ -604,13 +604,16 @@ class ZWaveServices:
):
new_value = str(new_value)
success = await async_multicast_set_value(
client=client,
new_value=new_value,
value_data=value,
nodes=None if broadcast else list(nodes),
options=options,
)
try:
success = await async_multicast_set_value(
client=client,
new_value=new_value,
value_data=value,
nodes=None if broadcast else list(nodes),
options=options,
)
except FailedZWaveCommand as err:
raise HomeAssistantError("Unable to set value via multicast") from err
if success is False:
raise HomeAssistantError(

View file

@ -2745,7 +2745,7 @@ zigpy==0.55.0
zm-py==0.5.2
# homeassistant.components.zwave_js
zwave-js-server-python==0.47.3
zwave-js-server-python==0.48.0
# homeassistant.components.zwave_me
zwave_me_ws==0.4.2

View file

@ -1982,7 +1982,7 @@ zigpy-znp==0.11.1
zigpy==0.55.0
# homeassistant.components.zwave_js
zwave-js-server-python==0.47.3
zwave-js-server-python==0.48.0
# homeassistant.components.zwave_me
zwave_me_ws==0.4.2

View file

@ -1225,7 +1225,7 @@ async def test_multicast_set_value(
blocking=True,
)
# Test that when a command fails we raise an exception
# Test that when a command is unsuccessful we raise an exception
client.async_send_command.return_value = {"success": False}
with pytest.raises(HomeAssistantError):
@ -1245,6 +1245,29 @@ async def test_multicast_set_value(
blocking=True,
)
client.async_send_command.reset_mock()
# Test that when we get an exception from the library we raise an exception
client.async_send_command.side_effect = FailedZWaveCommand("test", 12, "test")
with pytest.raises(HomeAssistantError):
await hass.services.async_call(
DOMAIN,
SERVICE_MULTICAST_SET_VALUE,
{
ATTR_ENTITY_ID: [
CLIMATE_DANFOSS_LC13_ENTITY,
CLIMATE_EUROTRONICS_SPIRIT_Z_ENTITY,
],
ATTR_COMMAND_CLASS: 67,
ATTR_PROPERTY: "setpoint",
ATTR_PROPERTY_KEY: 1,
ATTR_VALUE: 2,
},
blocking=True,
)
client.async_send_command.reset_mock()
# Create a fake node with a different home ID from a real node and patch it into
# return of helper function to check the validation for two nodes having different
# home IDs