sc200-push working.

This commit is contained in:
Adrian Woodley
2016-12-20 12:42:08 +08:00
parent 944243660b
commit 061306ab15
2 changed files with 44 additions and 302 deletions

View File

@@ -2,7 +2,7 @@
from netaddr import IPNetwork
#from netaddr import IPAddress
from xmlrpc.client import ServerProxy
import sqlite3
#import sqlite3
import socket
import csv
import queue
@@ -56,10 +56,10 @@ else:
Settings = [
'Site-Name',
'Site-Address',
'System-Location',
'Site-Notes',
'Serial-Number',
'Float-Voltage',
'Operating-Voltage',
'Battery-Capacity',
'AC-Rectifier-Current-Limit',
'High-Float-Threshold',
@@ -85,79 +85,12 @@ Settings = [
'Battery-Test-Duration',
'Battery-Test-Termination-Voltage',
'LVD-Disconnect-Voltage:1',
'LVD-Reconnect-Voltage:1',
'Number-Of-Registered-Rectifiers',
'Number-Of-Rectifiers-Failed'
'LVD-Reconnect-Voltage:1'
] + \
['Alarm-Name:' + repr(x) for x in range(59)] + \
['Alarm-Severity:' + repr(x) for x in range(59)]
#Settings = [
#'Site-Name'
#]
def Setup():
db.execute('''CREATE TABLE SettingsValues (
IP TEXT,
SettingsID TEXT,
Value TEXT)''')
#db.execute('''CREATE TABLE Settings (
#ID INTEGER PRIMARY KEY,
#Name TEXT UNIQUE)''')
#db.execute('''CREATE TABLE SC200 (
#IP text PRIMARY KEY,
#SiteName text,
#SiteNotes text,
#SerialNumber text,
#FloatVoltage float,
#OperatingVoltage float,
#BatteryCapacity int,
#ACRectifierCurrentLimit int,
#HighFloatThreshold float,
#EnableActiveVoltageControl bool,
#EnableTemperatureCompensation bool,
#TemperatureCompensationSlope float,
#TemperatureCompensationReferenceTemperature float,
#TemperatureCompensationUpperLimit float,
#TemperatureCompensationLowerLimit float,
#EnableEqualize bool,
#EqualizeVoltage float,
#EqualizeDuration int,
#EnableFastCharge bool,
#FastChargeVoltage float,
#FastChargeVoltageThreshold float,
#FastChargeAmpereHourThreshold int,
#FastChargeRechargePercentage int,
#FastChargeMaximumDuration int,
#FastChargeAmpereHourStopThreshold int,
#EnableBatterCurrentLimit bool,
#BCLLimit int,
#EnableBatterTest bool,
#BatteryTestDuration int,
#BatteryTestTerminationVoltage float,
#LVDDisconnectVoltage float,
#LVDReconnectVoltage float,
#NumberOfRegisteredRectifiers int,
#NumberOfRectifiersFailed int
#)''')
#SQL = '''CREATE TABLE AlarmNames (
#SiteIP text primary key'''
#for x in range(59):
#SQL = SQL + ', Alarm' + repr(x) + ' text'
#SQL = SQL + ')'
#db.execute(SQL)
#SQL = '''CREATE TABLE AlarmSeverities (
#SiteIP text primary key'''
#for x in range(59):
#SQL = SQL + ', Alarm' + repr(x) + ' int'
#SQL = SQL + ')'
#db.execute(SQL)
['Alarm-Name'] + \
['Alarm-Name:' + repr(x) for x in range(1, 59)] + \
['Alarm-Severity'] + \
['Alarm-Severity:' + repr(x) for x in range(1, 59)]
def GetStatusCode(host, path="/"):