Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 committed Apr 8, 2024
1 parent 7f3e41a commit f12c3f5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sml2mqtt/sml_device/sml_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def set_status(self, new_status: DeviceStatus) -> bool:

self.status = new_status

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

self.log_status.log(level, f'{new_status:s}')
self.mqtt_status.publish(new_status.value)
Expand Down
1 change: 1 addition & 0 deletions tests/sml_device/frames/test_frame_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ async def test_frame_no_match_obis_id(no_mqtt, caplog, monkeypatch, sml_frame_1,
Found none of the following obis ids in the sml frame: 0100000009ff, 01006001ffff
Received Frame
-> b'760500531efa620062007263010176010105001bb4fe0b0a0149534b0005020de272620165001bb32e620163a71400760500531efb620062007263070177010b0a0149534b0005020de2070100620affff72620165001bb32e757707010060320101010101010449534b0177070100600100ff010101010b0a0149534b0005020de20177070100010800ff65001c010401621e52ff650026bea90177070100020800ff0101621e52ff62000177070100100700ff0101621b52005301100101016350ba00760500531efc6200620072630201710163ba1900'
Exception <class 'sml2mqtt.errors.ObisIdForConfigurationMappingNotFoundError'>: ""
ERROR
/device_name/status: ERROR (QOS: 0, retain: False)'''

Expand Down
1 change: 1 addition & 0 deletions tests/sml_device/frames/test_frame_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ async def test_frame_no_match_obis_id(no_mqtt, caplog, monkeypatch, sml_frame_2,
Found none of the following obis ids in the sml frame: 0100000009ff, 01006001ffff
Received Frame
-> b'7605065850a66200620072630101760107ffffffffffff05021d70370b0a014c475a0003403b4972620165021d7707016326de007605065850a762006200726307017707ffffffffffff0b0a014c475a0003403b49070100620affff72620165021d770775770701006032010101010101044c475a0177070100600100ff010101010b0a014c475a0003403b490177070100010800ff65001c010472620165021d7707621e52ff690000000003152c450177070100020800ff0172620165021d7707621e52ff6900000000000000000177070100100700ff0101621b52005900000000000000fb010101637264007605065850a862006200726302017101631c8c00'
Exception <class 'sml2mqtt.errors.ObisIdForConfigurationMappingNotFoundError'>: ""
ERROR
/device_name/status: ERROR (QOS: 0, retain: False)'''

0 comments on commit f12c3f5

Please sign in to comment.