Skip to content

Commit 4f49baf

Browse files
authored
Support get_raw_config_parameter_value (#1093)
* Support get_raw_config_parameter_value * update require_schema * bump schema version to 39
1 parent d37834b commit 4f49baf

File tree

8 files changed

+65
-8
lines changed

8 files changed

+65
-8
lines changed

test/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def version_data_fixture():
240240
"serverVersion": "test_server_version",
241241
"homeId": "test_home_id",
242242
"minSchemaVersion": 0,
243-
"maxSchemaVersion": 37,
243+
"maxSchemaVersion": 39,
244244
}
245245

246246

test/model/test_node.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,6 +2682,30 @@ async def test_set_raw_config_parameter_value(
26822682
)
26832683

26842684

2685+
async def test_get_raw_config_parameter_value(
2686+
multisensor_6: node_pkg.Node, uuid4, mock_command
2687+
):
2688+
"""Test get raw config parameter value."""
2689+
node = multisensor_6
2690+
2691+
ack_commands = mock_command(
2692+
{"command": "endpoint.get_raw_config_parameter_value", "nodeId": node.node_id},
2693+
{"value": 1},
2694+
)
2695+
2696+
value = await node.async_get_raw_config_parameter_value(101)
2697+
assert value == 1
2698+
2699+
assert len(ack_commands) == 1
2700+
assert ack_commands[0] == {
2701+
"command": "endpoint.get_raw_config_parameter_value",
2702+
"nodeId": node.node_id,
2703+
"endpoint": 0,
2704+
"options": {"parameter": 101},
2705+
"messageId": uuid4,
2706+
}
2707+
2708+
26852709
async def test_supervision_result(inovelli_switch: node_pkg.Node, uuid4, mock_command):
26862710
"""Test Supervision Result."""
26872711
node = inovelli_switch

test/test_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ async def test_record_messages(client, wallmote_central_scene, mock_command, uui
391391
"nodeId": wallmote_central_scene.node_id,
392392
"args": {
393393
"commandClassName": "Binary Switch",
394-
"commandClass": 37,
394+
"commandClass": 39,
395395
"endpoint": 0,
396396
"property": "currentValue",
397397
"newValue": False,
@@ -415,7 +415,7 @@ async def test_record_messages(client, wallmote_central_scene, mock_command, uui
415415
"nodeId": wallmote_central_scene.node_id,
416416
"args": {
417417
"commandClassName": "Binary Switch",
418-
"commandClass": 37,
418+
"commandClass": 39,
419419
"endpoint": 0,
420420
"property": "currentValue",
421421
"newValue": False,
@@ -461,7 +461,7 @@ async def test_additional_user_agent_components(client_session, url):
461461
{
462462
"command": "initialize",
463463
"messageId": "initialize",
464-
"schemaVersion": 37,
464+
"schemaVersion": 39,
465465
"additionalUserAgentComponents": {
466466
"zwave-js-server-python": __version__,
467467
"foo": "bar",

test/test_dump.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async def test_dump_additional_user_agent_components(
106106
{
107107
"command": "initialize",
108108
"messageId": "initialize",
109-
"schemaVersion": 37,
109+
"schemaVersion": 39,
110110
"additionalUserAgentComponents": {
111111
"zwave-js-server-python": __version__,
112112
"foo": "bar",

test/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_dump_state(
5858
assert captured.out == (
5959
"{'type': 'version', 'driverVersion': 'test_driver_version', "
6060
"'serverVersion': 'test_server_version', 'homeId': 'test_home_id', "
61-
"'minSchemaVersion': 0, 'maxSchemaVersion': 37}\n"
61+
"'minSchemaVersion': 0, 'maxSchemaVersion': 39}\n"
6262
"{'type': 'result', 'success': True, 'result': {}, 'messageId': 'initialize'}\n"
6363
"test_result\n"
6464
)

zwave_js_server/const/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
__version__ = "0.58.1"
1212

1313
# minimal server schema version we can handle
14-
MIN_SERVER_SCHEMA_VERSION = 37
14+
MIN_SERVER_SCHEMA_VERSION = 39
1515
# max server schema version we can handle (and our code is compatible with)
16-
MAX_SERVER_SCHEMA_VERSION = 37
16+
MAX_SERVER_SCHEMA_VERSION = 39
1717

1818
VALUE_UNKNOWN = "unknown"
1919

zwave_js_server/model/endpoint.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,25 @@ async def async_set_raw_config_parameter_value(
373373
return zwave_value, SetConfigParameterResult(
374374
CommandStatus.ACCEPTED, SupervisionResult(result)
375375
)
376+
377+
async def async_get_raw_config_parameter_value(
378+
self,
379+
property_: int,
380+
property_key: int | None = None,
381+
allow_unexpected_response: bool | None = None,
382+
) -> Any:
383+
"""Call getRawConfigParameterValue."""
384+
options = {
385+
"parameter": property_,
386+
"bitMask": property_key,
387+
"allowUnexpectedResponse": allow_unexpected_response,
388+
}
389+
390+
result = await self.async_send_command(
391+
"get_raw_config_parameter_value",
392+
options={k: v for k, v in options.items() if v is not None},
393+
require_schema=39,
394+
wait_for_result=True,
395+
)
396+
assert result
397+
return result["value"]

zwave_js_server/model/node/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,17 @@ async def async_set_raw_config_parameter_value(
976976
new_value, property_, property_key, value_size, value_format
977977
)
978978

979+
async def async_get_raw_config_parameter_value(
980+
self,
981+
property_: int,
982+
property_key: int | None = None,
983+
allow_unexpected_response: bool | None = None,
984+
) -> int:
985+
"""Call getRawConfigParameterValue."""
986+
return await self.endpoints[0].async_get_raw_config_parameter_value(
987+
property_, property_key, allow_unexpected_response
988+
)
989+
979990
def handle_test_powerlevel_progress(self, event: Event) -> None:
980991
"""Process a test power level progress event."""
981992
event.data["test_power_level_progress"] = TestPowerLevelProgress(

0 commit comments

Comments
 (0)