R1 TS code slice is not working
this code slice is not working since is not breaking anything:
def unpack_date_time_response(sef, n_bytes, msg):
value = []
for i in range(0, n_bytes, 1):
if sys.byteorder == "little":
new_message = bytearray()
new_message.append(msg[i])
value.append(struct.unpack("1B", new_message)[0])
this function is being called once here:
def get_measurement_value_from_response(self, message_received_data):
"""
Method responsible to read a value (int/float)
from a Modbus RTU response.
Args:
message_received_data: The Modbus RTU response.
Returns:
int: if the value on response is an int.
float: if the value on response is an float.
"""
n_bytes = message_received_data[2]
msg = bytearray(message_received_data[3:-2])
if n_bytes == 2:
return self._unpack_int_response(n_bytes, msg)
elif n_bytes == 8:
return self.unpack_date_time_response(n_bytes, msg) # HERE
else:
return self._unpack_float_response(n_bytes, msg)