Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion greeclimate/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def packet_received(self, obj, addr: IPAddr) -> None:
params = {
Response.BIND_OK.value: lambda o, a: [o["pack"]["key"]],
Response.DATA.value: lambda o, a: [dict(zip(o["pack"]["cols"], o["pack"]["dat"]))],
Response.RESULT.value: lambda o, a: [dict(zip(o["pack"]["opt"], o["pack"]["val"]))],
Response.RESULT.value: lambda o, a: [dict(zip(o["pack"]["opt"], o["pack"].get("val", []) or o["pack"].get("p", [])))],
}
handlers = {
Response.BIND_OK.value: lambda *args: self.__handle_device_bound(*args),
Expand Down
7 changes: 4 additions & 3 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ def test_handle_state_update():
assert protocol.state == {'key': 'value'}


def test_handle_result_update():
@pytest.mark.parametrize('values_key', ['val', 'p'])
def test_handle_result_update(values_key):

# Arrange
protocol = DeviceProtocol2Test()
Expand All @@ -386,7 +387,7 @@ def test_handle_result_update():
'pack': {
't': 'res',
'opt': list(state.keys()),
'val': list(state.values())
values_key: list(state.values())
}
}, ("0.0.0.0", 0))

Expand Down Expand Up @@ -571,4 +572,4 @@ def test_device_key_get_set():

# Assert
assert protocol.device_key == key