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 luxtronik/shi/modbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def send(self, telegrams):

# Exit the function if no operation is necessary
if total_count <= 0:
return False
return True

# Acquire lock, connect and read/write data. Disconnect afterwards.
success = False
Expand Down
12 changes: 6 additions & 6 deletions tests/shi/test_shi_modbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_no_holdings_read_data(self):

# Read zero holdings
result = self.modbus_interface.send(data_list)
assert not result
assert result # no error when there is no data
assert data_list[0].data == []
assert data_list[1].data == []

Expand All @@ -167,15 +167,15 @@ def test_no_holdings_write_data(self):

# Write zero holdings
result = self.modbus_interface.send(data_list)
assert not result
assert result # no error when there is no data


def test_no_inputs_read_data(self):
data_list = [LuxtronikSmartHomeReadInputsTelegram(0, 0), LuxtronikSmartHomeReadInputsTelegram(0, 0)]

# Read zero inputs
result = self.modbus_interface.send(data_list)
assert not result
assert result # no error when there is no data
assert data_list[0].data == []
assert data_list[1].data == []

Expand All @@ -185,7 +185,7 @@ def test_no_inputs_read_data(self):
[
(1, 2, True, [1, 2]),
(5, 3, True, [5, 6, 7]),
(0, 0, False, []),
(0, 0, True, []), # no error when there is no data
(1000, 2, False, None), # client has read error
(1001, 3, False, None), # client returns to less data
(1002, 4, False, None), # client returns to much data
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_read_holdings(self, addr, count, valid, data):
[
(1, 2, True, [1, 2]),
(5, 3, True, [5, 6, 7]),
(0, 0, False, []),
(0, 0, True, []), # no error when there is no data
(1000, 2, False, None), # client has read error
(1001, 3, False, None), # client returns to less data
(1002, 4, False, None), # client returns to much data
Expand Down Expand Up @@ -241,7 +241,7 @@ def test_read_inputs(self, addr, count, valid, data):
[
(1, [1, 2], True),
(5, [5, 6, 7], True),
(0, [], False),
(0, [], True), # no error when there is no data
(1000, [8, 9], False), # Write error
(1001, [11], False), # Exception
]
Expand Down
Loading