config Pfad geändert, modbus angepasst, database modul angepasst

This commit is contained in:
Philipp Rauch 2014-02-03 12:43:10 +01:00
parent 6c07fec275
commit 3533b5164c
11 changed files with 310 additions and 311 deletions

View 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()