Support RMCARD205(305) firmware version 1.2.0

This commit is contained in:
Sergey Morozov 2019-11-14 22:31:01 +03:00
parent 126490dc80
commit 12d0abf288
2 changed files with 22 additions and 2 deletions

View File

@ -29,3 +29,13 @@ outlet_id = 1
isps = true
# Outlet bank
bank_id = 1
# I don't known what is sa, default value in PPBE is 1, but 0 is old behavior(?)
sa = 0
# Shutdown condition
# b - low battery
# r - runtime insufficient
# u - power failure
# You can combine a value for this parameter
# Example with two shutdown conditions (low battery and runtime insufficient):
# event = br
event = b

View File

@ -35,6 +35,8 @@ class cps_ups:
'" oid="' + self.outlet_id + \
'" isps="' + self.isps + \
'" bid="' + self.bank_id + \
'" sa="' + self.sa + \
'" event="' + self.event + \
'"/>'
digest = hmac.new(self.secret_key.encode(), msg = data_tag.encode('utf-8')).hexdigest().upper()
xml = '<?xml version="1.0" ' \
@ -51,6 +53,8 @@ class cps_ups:
hostname,
outlet_id,
bank_id,
sa,
event,
isps = "true",
contact = "",
location = "",
@ -65,6 +69,8 @@ class cps_ups:
self.contact = contact
self.location = location
self.bedt = bedt
self.sa = sa
self.event = event
try:
post_data = self.__genxml__(self.__get_keepalive_data__())
self.connection.request("POST", "/setup.xml", body = post_data)
@ -90,7 +96,9 @@ configuration_structure = {'UPS': ['address',
'isps',
'contact',
'location',
'bedt']}
'bedt',
'sa',
'event']}
try:
configfile = sys.argv[1]
except IndexError:
@ -127,4 +135,6 @@ u.register(ip_address = configuration['HOST']['ip_address'],
isps = configuration['HOST']['isps'],
contact = configuration['HOST']['contact'],
location = configuration['HOST']['location'],
bedt = configuration['HOST']['bedt'])
bedt = configuration['HOST']['bedt'],
sa = configuration['HOST']['sa'],
event = configuration['HOST']['event'])