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", "integration_type": "hub",
"iot_class": "local_push", "iot_class": "local_push",
"loggers": ["zwave_js_server"], "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": [ "usb": [
{ {
"vid": "0658", "vid": "0658",

View File

@ -9,7 +9,7 @@ from typing import Any
import voluptuous as vol import voluptuous as vol
from zwave_js_server.client import Client as ZwaveClient from zwave_js_server.client import Client as ZwaveClient
from zwave_js_server.const import CommandClass, CommandStatus 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.endpoint import Endpoint
from zwave_js_server.model.node import Node as ZwaveNode from zwave_js_server.model.node import Node as ZwaveNode
from zwave_js_server.model.value import ValueDataType, get_value_id_str from zwave_js_server.model.value import ValueDataType, get_value_id_str
@ -604,13 +604,16 @@ class ZWaveServices:
): ):
new_value = str(new_value) new_value = str(new_value)
success = await async_multicast_set_value( try:
client=client, success = await async_multicast_set_value(
new_value=new_value, client=client,
value_data=value, new_value=new_value,
nodes=None if broadcast else list(nodes), value_data=value,
options=options, 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: if success is False:
raise HomeAssistantError( raise HomeAssistantError(

View File

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

View File

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

View File

@ -1225,7 +1225,7 @@ async def test_multicast_set_value(
blocking=True, 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} client.async_send_command.return_value = {"success": False}
with pytest.raises(HomeAssistantError): with pytest.raises(HomeAssistantError):
@ -1245,6 +1245,29 @@ async def test_multicast_set_value(
blocking=True, 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 # 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 # return of helper function to check the validation for two nodes having different
# home IDs # home IDs