Skip to content

Commit f12c3f5

Browse files
Fixed tests
1 parent 7f3e41a commit f12c3f5

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/sml2mqtt/sml_device/sml_device.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def set_status(self, new_status: DeviceStatus) -> bool:
7979

8080
self.status = new_status
8181

82+
# Don't log toggeling between CRC_ERROR and OK. Only log if new status is not OK
8283
level = LVL_INFO
8384
if new_status is DeviceStatus.CRC_ERROR:
8485
level = LVL_DEBUG
@@ -87,7 +88,7 @@ def set_status(self, new_status: DeviceStatus) -> bool:
8788
level = LVL_DEBUG
8889
else:
8990
# Log old status if new status is not OK
90-
self.log_status.log(level, f'Old status: {old_status:s}')
91+
self.log_status.log(level, f'Old status {old_status:s}')
9192

9293
self.log_status.log(level, f'{new_status:s}')
9394
self.mqtt_status.publish(new_status.value)

tests/sml_device/frames/test_frame_1.py

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ async def test_frame_no_match_obis_id(no_mqtt, caplog, monkeypatch, sml_frame_1,
2222
Found none of the following obis ids in the sml frame: 0100000009ff, 01006001ffff
2323
Received Frame
2424
-> b'760500531efa620062007263010176010105001bb4fe0b0a0149534b0005020de272620165001bb32e620163a71400760500531efb620062007263070177010b0a0149534b0005020de2070100620affff72620165001bb32e757707010060320101010101010449534b0177070100600100ff010101010b0a0149534b0005020de20177070100010800ff65001c010401621e52ff650026bea90177070100020800ff0101621e52ff62000177070100100700ff0101621b52005301100101016350ba00760500531efc6200620072630201710163ba1900'
25+
Exception <class 'sml2mqtt.errors.ObisIdForConfigurationMappingNotFoundError'>: ""
2526
ERROR
2627
/device_name/status: ERROR (QOS: 0, retain: False)'''
2728

tests/sml_device/frames/test_frame_2.py

+1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ async def test_frame_no_match_obis_id(no_mqtt, caplog, monkeypatch, sml_frame_2,
2222
Found none of the following obis ids in the sml frame: 0100000009ff, 01006001ffff
2323
Received Frame
2424
-> b'7605065850a66200620072630101760107ffffffffffff05021d70370b0a014c475a0003403b4972620165021d7707016326de007605065850a762006200726307017707ffffffffffff0b0a014c475a0003403b49070100620affff72620165021d770775770701006032010101010101044c475a0177070100600100ff010101010b0a014c475a0003403b490177070100010800ff65001c010472620165021d7707621e52ff690000000003152c450177070100020800ff0172620165021d7707621e52ff6900000000000000000177070100100700ff0101621b52005900000000000000fb010101637264007605065850a862006200726302017101631c8c00'
25+
Exception <class 'sml2mqtt.errors.ObisIdForConfigurationMappingNotFoundError'>: ""
2526
ERROR
2627
/device_name/status: ERROR (QOS: 0, retain: False)'''

0 commit comments

Comments
 (0)