Skip to content

Commit

Permalink
Fix invalid RSSI byte used for TIC parsing. (#142)
Browse files Browse the repository at this point in the history
* Adjust TIC parsing

* Adjust linting for py10
  • Loading branch information
elupus committed Jun 28, 2022
1 parent 212d7af commit 02a41ee
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion RFXtrx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ def receive_blocking(self, data=None):
""" Emulate a receive by parsing the given data """
return self.receive(data)

def send(self, data): # pylint: disable=R0201
def send(self, data):
""" Emulate a send by doing nothing (except printing debug info if
requested) """
pkt = bytearray(data)
Expand Down
2 changes: 1 addition & 1 deletion RFXtrx/lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2264,7 +2264,7 @@ def load_receive(self, data):
self.currentwatt = None
self.state_byte = data[20]
self.teleinfo_ok = not (data[20] & 0x04) == 0x04
self.rssi_byte = data[17]
self.rssi_byte = data[21]
elif self.subtype == 0x02:
# Cartelectronic Encoder
self.counter1 = ((data[8] * pow(2, 24)) + (data[9] << 16) +
Expand Down
1 change: 0 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ reports=no

disable=
locally-disabled,
redefined-variable-type


[MESSAGES CONTROL]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def test_format_packet(self):
0x79]
event = core.transport.parse(bytes_array)
self.assertEqual(RFXtrx.SensorEvent, type(event))
self.assertEqual(event.__str__(),"<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='CARTELECTRONIC_TIC' id='77d200686'] values=[('Battery numeric', 0), ('Contract type', 17), ('Count', 0), ('Counter value', 3838665), ('Energy usage', 330), ('Rssi numeric', 0), ('Sensor Status', True)]")
self.assertEqual(event.__str__(),"<class 'RFXtrx.SensorEvent'> device=[<class 'RFXtrx.RFXtrxDevice'> type='CARTELECTRONIC_TIC' id='77d200686'] values=[('Battery numeric', 9), ('Contract type', 17), ('Count', 0), ('Counter value', 3838665), ('Energy usage', 330), ('Rssi numeric', 7), ('Sensor Status', True)]")

#Cartelectronic Encoder
bytes_array = [0x11, 0x60, 0x02, 0x5f, 0x3f, 0xfe, 0x61, 0xa3, 0x00, 0x00, 0x47, 0xd4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69]
Expand Down

0 comments on commit 02a41ee

Please sign in to comment.