title: Noob trying to get values from his EnergyMeter via Modbus RTU RS485 in python
body: <p>fist Post as i normaly find the answers if i search long enough.
  But today is the day...
  I bought a EnergyMeter from Aliexpress with MODBUS RTU connection and im trying to read it out. I already tried a lot of stuff from all over the Internet.</p>
  <p>This is the Datasheet of the EnergyMeter<a href="https://i.stack.imgur.com/9ko3A.jpg" rel="nofollow noreferrer">1</a></p>
  <p>I tried pyModbus and minimalmodbus.</p>
  <p>My both Scripts:</p>
  <pre><code>#!/usr/bin/env python3
  from pymodbus.client.sync import ModbusSerialClient as ModbusClient
  
  client = ModbusClient(method='rtu', port='/dev/ttyUSB0', timeout=1, stopbits = 1, bytesize = 8,  parity='N', baudrate= 9600)
  client.connect()
  request = client.read_holding_registers(0x00,0x01,unit=2)
  print (request.registers)`
  </code></pre>
  <p>and</p>
  <pre><code>#!/usr/bin/env python3
  
  import time
  import minimalmodbus
  
  rs485 = minimalmodbus.Instrument('/dev/ttyUSB0', 2)
  rs485.serial.baudrate = 9600
  rs485.serial.bytesize = 8
  rs485.serial.parity = minimalmodbus.serial.PARITY_NONE
  rs485.serial.stopbits = 1
  rs485.serial.timeout = 1
  rs485.debug = False
  rs485.mode = minimalmodbus.MODE_RTU
  print (rs485)
  print(rs485.read_register(0, functioncode=4,))
  #Volts_A = rs485.read_float(0, functioncode=4, number_of_registers=4)
  #print ('Voltage: {0:.1f} Volts'.format(Volts_A))
  </code></pre>
  <p>It seems i can read Data (first script puts out 17942 and second 17248.
  But honestly, i have no clue what to do with it.
  Also i dont understand that code...
  The manual states that I have to send a Hi and a Low Adress, but how can i do that? 0x00 is hexa - do i have to convert this? How?</p>
  <p>The Manual stats that i have to send Adress+functioncode+data+crc - how to do this, or is pymod/minimod doing this automatically? How does it now the right Function Code etc?
  Iam totally confused, would be happy if someone could help me...</p>
  <p>Thanks</p>