from pymodbus.client import ModbusSerialClient

client = ModbusSerialClient(port="/dev/ttyUSB0", baudrate=9600)

result = client.read_input_registers(address=1, count=2, slave=1)

print(f"Temp {result.registers[0] / 10}, Humidity {result.registers[1] / 10}")

slave_id = client.read_holding_registers(address=257, count=4, slave=1)

print(f"""Slave id {slave_id.registers[0]} Baudrate {slave_id.registers[1]}
      Temp correction {slave_id.registers[2]} Humidity correction {slave_id.registers[3]}""")
print(slave_id)

# change_slave_id = client.write_register(address=257, value=1, slave=101)
# change_baudrate = client.write_register(address=258, value=1, slave=101)
# print(change_slave_id)
# print(change_baudrate)
