Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pymodbus library
#1
Good evening everyone, I am new to this forum and am just getting into python. I have some basics on the C language but I can't really understand how python works, I hope someone can help me. My goal is to read the values of my solar system and turn the system on and off remotely. For the point of reading the values I managed to understand how it works, the problem comes when I have to write to turn on or respectively turn off.

To read the data, the code is as follows:
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
 
client = ModbusClient(method = 'rtu', port = '/dev/ttyUSB0', baudrate = 115200)
client.connect()
 
result = client.read_input_registers(0x3100,6,unit=1)
solarVoltage = float(result.registers[0] / 100.0)
solarCurrent = float(result.registers[1] / 100.0)
batteryVoltage = float(result.registers[4] / 100.0)
chargeCurrent = float(result.registers[5] / 100.0)
 
# Do something with the data
 
client.close()
This is the document where you can find the various addresses for the values you can read and write: http://www.solar-elektro.cz/data/dokumen...otocol.pdf

The part I'm not able to do is the one at the bottom where it says: Manual control the load 2 When the load is manual modeļ¼Œ1-manual on0 -manual off.
I guess it's just a few lines of code but I really can't do it, can anyone help me? Cry
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020