Skip to content

Commit

Permalink
remove unneeded imports, formating
Browse files Browse the repository at this point in the history
  • Loading branch information
benderl committed Jul 12, 2021
1 parent 756a21e commit 5ee05ae
Show file tree
Hide file tree
Showing 237 changed files with 2,211 additions and 2,870 deletions.
1 change: 0 additions & 1 deletion modules/bezug_alphaess/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ fi

wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
echo $wattbezug

18 changes: 9 additions & 9 deletions modules/bezug_alphaess/readalpha.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/usr/bin/python
import sys
import os
# import sys
# import os
import time
import getopt
import socket
import ConfigParser
import struct
import binascii
import logging
# import getopt
# import socket
# import ConfigParser
# import struct
# import binascii
# import logging
from pymodbus.payload import BinaryPayloadDecoder
from pymodbus.constants import Endian
from pymodbus.client.sync import ModbusTcpClient

client = ModbusTcpClient('192.168.193.125', port=8899)

sdmid = int(85)
Expand Down Expand Up @@ -61,4 +62,3 @@
f = open('/var/www/html/openWB/ramdisk/bezuga3', 'w')
f.write(str(final))
f.close()

18 changes: 9 additions & 9 deletions modules/bezug_alphaess/readv123.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/usr/bin/python
import sys
import os
# import sys
# import os
import time
import getopt
import socket
import ConfigParser
import struct
import binascii
import logging
# import getopt
# import socket
# import ConfigParser
# import struct
# import binascii
# import logging
from pymodbus.payload import BinaryPayloadDecoder
from pymodbus.constants import Endian
from pymodbus.client.sync import ModbusTcpClient

client = ModbusTcpClient('192.168.193.125', port=8899)

sdmid = int(85)
Expand Down Expand Up @@ -58,4 +59,3 @@
f = open('/var/www/html/openWB/ramdisk/bezuga3', 'w')
f.write(str(final))
f.close()

1 change: 0 additions & 1 deletion modules/bezug_carlogavazzilan/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
python /var/www/html/openWB/modules/bezug_carlogavazzilan/readgavazzi.py $bezug1_ip
wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
echo $wattbezug

25 changes: 8 additions & 17 deletions modules/bezug_carlogavazzilan/readgavazzi.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
#!/usr/bin/python
import sys
import os
import time
import getopt
# import os
# import time
# import getopt
import struct
from pymodbus.client.sync import ModbusTcpClient

ipadd = str(sys.argv[1])

client = ModbusTcpClient(ipadd, port=502)
sdmid = 1


#Voltage
resp = client.read_input_registers(0x00,2, unit=sdmid)

all = format(resp.registers[1], '04x') + format(resp.registers[0], '04x')
voltage1 = float(struct.unpack('>i', all.decode('hex'))[0])
voltage1 = float("%.1f" % voltage1) / 10
f = open('/var/www/html/openWB/ramdisk/evuv1', 'w')
f.write(str(voltage1))
f.close()

resp = client.read_input_registers(0x02,2, unit=sdmid)
all = format(resp.registers[1], '04x') + format(resp.registers[0], '04x')
voltage2 = float(struct.unpack('>i', all.decode('hex'))[0])
voltage2 = float("%.1f" % voltage2) / 10
f = open('/var/www/html/openWB/ramdisk/evuv2', 'w')
f.write(str(voltage2))
f.close()

resp = client.read_input_registers(0x04,2, unit=sdmid)
all = format(resp.registers[1], '04x') + format(resp.registers[0], '04x')
voltage3 = float(struct.unpack('>i', all.decode('hex'))[0])
voltage3 = float("%.1f" % voltage3) / 10

f = open('/var/www/html/openWB/ramdisk/evuv3', 'w')
f.write(str(voltage3))
f.close()
Expand All @@ -50,24 +51,18 @@
f = open('/var/www/html/openWB/ramdisk/bezugw2', 'w')
f.write(str(finalw2))
f.close()

resp = client.read_input_registers(0x16,2, unit=sdmid)
all = format(resp.registers[1], '04x') + format(resp.registers[0], '04x')
finalw3 = int(struct.unpack('>i', all.decode('hex'))[0] / 10)

f = open('/var/www/html/openWB/ramdisk/bezugw3', 'w')
f.write(str(finalw3))
f.close()


finalw= finalw1 + finalw2 + finalw3
f = open('/var/www/html/openWB/ramdisk/wattbezug', 'w')
f.write(str(finalw))
f.close()




#ampere l1
resp = client.read_input_registers(0x0C,2, unit=sdmid)
all = format(resp.registers[1], '04x') + format(resp.registers[0], '04x')
Expand All @@ -79,12 +74,12 @@
else:
f.write(str(lla1))
f.close()

#ampere l2
resp = client.read_input_registers(0x0E,2, unit=sdmid)
all = format(resp.registers[1], '04x') + format(resp.registers[0], '04x')
lla1 = float(struct.unpack('>i', all.decode('hex'))[0])
lla2 = float("%.1f" % lla1) / 1000

f = open('/var/www/html/openWB/ramdisk/bezuga2', 'w')
if finalw2 < 0:
f.write(str(-lla2))
Expand All @@ -97,7 +92,6 @@
all = format(resp.registers[1], '04x') + format(resp.registers[0], '04x')
lla1 = float(struct.unpack('>i', all.decode('hex'))[0])
lla3 = float("%.1f" % lla1) / 1000

f = open('/var/www/html/openWB/ramdisk/bezuga3', 'w')
if finalw3 < 0:
f.write(str(-lla3))
Expand All @@ -108,12 +102,9 @@
#evuhz
resp = client.read_input_registers(0x33,2, unit=sdmid)
hz = resp.registers[0] / 10

evuhz = float("%.2f" % hz)
if evuhz > 100:
evuhz=float(evuhz / 10)
f = open('/var/www/html/openWB/ramdisk/evuhz', 'w')
f.write(str(evuhz))
f.close()


117 changes: 58 additions & 59 deletions modules/bezug_e3dc/e3dc.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#!/usr/bin/python
import sys
import os
import time
import getopt
import socket
import ConfigParser
# import os
# import time
# import getopt
# import socket
# import ConfigParser
import struct
import binascii
ipaddress = str(sys.argv[1])
# import binascii
from pymodbus.client.sync import ModbusTcpClient

ipaddress = str(sys.argv[1])

client = ModbusTcpClient(ipaddress, port=502)

#evu punkt
# evu punkt
resp= client.read_holding_registers(40073,2,unit=1)
value1 = resp.registers[0]
value2 = resp.registers[1]
Expand All @@ -20,11 +22,11 @@
f = open('/var/www/html/openWB/ramdisk/wattbezug', 'w')
f.write(str(final))
f.close()
#

volt=230
resp= client.read_holding_registers(40128,4,unit=1)

#print >>f1,(resp.registers)
# print >>f1,(resp.registers)

value1 = resp.registers[0]
all = format(value1, '04x')
Expand All @@ -40,52 +42,49 @@
finale3 = int(struct.unpack('>h', all.decode('hex'))[0])

if finale0 == 1:
# f1 = open('/var/www/html/openWB/ramdisk/logtest2', 'a')
# print >>f1,('e3dc zaehler %1d l1 %6d l2 %6d l3 %6d Watt' % (finale0,finale1,finale2,finale3))
if finale1 > 0:
finala1=finale1/volt
else:
finala1 = 0

if finale2 > 0:
finala2=finale2/volt
else:
finala2 = 0

if finale3 > 0:
finala3=finale3/volt
else:
finala3 = 0
# print >>f1,('e3dc zaehler %1d l1 %6d l2 %6d l3 %6d Amp' % (finale0,finala1,finala2,finala3))
# volt
f = open('/var/www/html/openWB/ramdisk/evuv1', 'w')
f.write(str(volt))
f.close()
f = open('/var/www/html/openWB/ramdisk/evuv2', 'w')
f.write(str(volt))
f.close()
f = open('/var/www/html/openWB/ramdisk/evuv3', 'w')
f.write(str(volt))
f.close()
#watt pro phase
f = open('/var/www/html/openWB/ramdisk/bezugw1', 'w')
f.write(str(finale1))
f.close()
f = open('/var/www/html/openWB/ramdisk/bezugw2', 'w')
f.write(str(finale2))
f.close()
f = open('/var/www/html/openWB/ramdisk/bezugw3', 'w')
f.write(str(finale3))
f.close()
#amp pro phase
f = open('/var/www/html/openWB/ramdisk/bezuga1', 'w')
f.write(str(finala1))
f.close()
f = open('/var/www/html/openWB/ramdisk/bezuga2', 'w')
f.write(str(finala2))
f.close()
f = open('/var/www/html/openWB/ramdisk/bezuga3', 'w')
f.write(str(finala3))
f.close()
#f1.close()

# f1 = open('/var/www/html/openWB/ramdisk/logtest2', 'a')
# print >>f1,('e3dc zaehler %1d l1 %6d l2 %6d l3 %6d Watt' % (finale0,finale1,finale2,finale3))
if finale1 > 0:
finala1=finale1/volt
else:
finala1 = 0
if finale2 > 0:
finala2=finale2/volt
else:
finala2 = 0
if finale3 > 0:
finala3=finale3/volt
else:
finala3 = 0
# print >>f1,('e3dc zaehler %1d l1 %6d l2 %6d l3 %6d Amp' % (finale0,finala1,finala2,finala3))
# volt
f = open('/var/www/html/openWB/ramdisk/evuv1', 'w')
f.write(str(volt))
f.close()
f = open('/var/www/html/openWB/ramdisk/evuv2', 'w')
f.write(str(volt))
f.close()
f = open('/var/www/html/openWB/ramdisk/evuv3', 'w')
f.write(str(volt))
f.close()
# watt pro phase
f = open('/var/www/html/openWB/ramdisk/bezugw1', 'w')
f.write(str(finale1))
f.close()
f = open('/var/www/html/openWB/ramdisk/bezugw2', 'w')
f.write(str(finale2))
f.close()
f = open('/var/www/html/openWB/ramdisk/bezugw3', 'w')
f.write(str(finale3))
f.close()
# amp pro phase
f = open('/var/www/html/openWB/ramdisk/bezuga1', 'w')
f.write(str(finala1))
f.close()
f = open('/var/www/html/openWB/ramdisk/bezuga2', 'w')
f.write(str(finala2))
f.close()
f = open('/var/www/html/openWB/ramdisk/bezuga3', 'w')
f.write(str(finala3))
f.close()
# f1.close()
2 changes: 0 additions & 2 deletions modules/bezug_ethmpm3pm/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ else
fi
wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
echo $wattbezug


27 changes: 9 additions & 18 deletions modules/bezug_ethmpm3pm/readlovato.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#!/usr/bin/python
import sys
import os
import time
import getopt
# import sys
# import os
# import time
# import getopt
import struct
from pymodbus.client.sync import ModbusTcpClient
client = ModbusTcpClient('192.168.193.15', port=8899)
#from pymodbus.transaction import ModbusRtuFramer
#client = ModbusTcpClient('192.168.0.7', port=8899, framer=ModbusRtuFramer)



client = ModbusTcpClient('192.168.193.15', port=8899)

#Voltage
resp = client.read_input_registers(0x0001,2, unit=0x02)
Expand All @@ -29,17 +25,13 @@
f.write(str(voltage3))
f.close()




#phasen watt
resp = client.read_input_registers(0x0013,2, unit=0x02)
all = format(resp.registers[0], '04x') + format(resp.registers[1], '04x')
finalw1 = int(struct.unpack('>i', all.decode('hex'))[0] / 100)
f = open('/var/www/html/openWB/ramdisk/bezugw1', 'w')
f.write(str(finalw1))
f.close()

resp = client.read_input_registers(0x0015,2, unit=0x02)
all = format(resp.registers[0], '04x') + format(resp.registers[1], '04x')
finalw2 = int(struct.unpack('>i', all.decode('hex'))[0] / 100)
Expand All @@ -54,15 +46,14 @@
f.close()

finalw= finalw1 + finalw2 + finalw3
#total watt
#resp = client.read_input_registers(0x0039,2, unit=0x02)
#all = format(resp.registers[0], '04x') + format(resp.registers[1], '04x')
#finalw = int(struct.unpack('>i', all.decode('hex'))[0] / 100)
# total watt
# resp = client.read_input_registers(0x0039,2, unit=0x02)
# all = format(resp.registers[0], '04x') + format(resp.registers[1], '04x')
# finalw = int(struct.unpack('>i', all.decode('hex'))[0] / 100)
f = open('/var/www/html/openWB/ramdisk/wattbezug', 'w')
f.write(str(finalw))
f.close()


#ampere l1
resp = client.read_input_registers(0x0007, 2, unit=0x02)
all = format(resp.registers[0], '04x') + format(resp.registers[1], '04x')
Expand Down
Loading

0 comments on commit 5ee05ae

Please sign in to comment.