config Pfad geändert, modbus angepasst, database modul angepasst
This commit is contained in:
parent
6c07fec275
commit
3533b5164c
11 changed files with 310 additions and 311 deletions
38
Connector/modules/modbus.py
Normal file
38
Connector/modules/modbus.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
'''
|
||||
Created on 05.12.2013
|
||||
|
||||
@author: Philipp Rauch
|
||||
'''
|
||||
from pymodbus.client.sync import ModbusTcpClient
|
||||
|
||||
def setup(conf):
|
||||
PACS = []
|
||||
|
||||
### INITIALIZE ###
|
||||
PACS.append(ModbusTcpClient('10.2.6.5'))
|
||||
PACS.append(ModbusTcpClient('10.2.6.6'))
|
||||
PACS.append(ModbusTcpClient('10.2.6.7'))
|
||||
PACS.append(ModbusTcpClient('10.2.6.8'))
|
||||
|
||||
### CONNECT ###
|
||||
for PAC in PACS:
|
||||
PAC.connect()
|
||||
|
||||
return PACS
|
||||
|
||||
|
||||
def loop(PACS, item):
|
||||
# PAC[0].write_coil(213, 100,2)
|
||||
# result = PAC[0].read_coils(213,1,unit=2)
|
||||
#
|
||||
# ans = PAC[0].write_registers(213,(1,0),unit=2)
|
||||
# print "Antwort: %s" % ans
|
||||
|
||||
res = PACS[0].read_holding_registers(213,4,unit=2)
|
||||
print "Werte: %s" % res.registers
|
||||
|
||||
|
||||
def close(PACS):
|
||||
### CLOSE ###
|
||||
for PAC in PACS:
|
||||
PAC.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue