use of lmwParameter for perion parameter.

Extra parameter xBS1x
This commit is contained in:
Marcel Nijenhof
2021-08-30 16:20:29 +02:00
parent beadb51698
commit 34fe39371b

View File

@@ -208,6 +208,7 @@ Support for:
'ZV10S': ('WN', 1, 10), 'ZV10S': ('WN', 1, 10),
'WI': ('BL', 8, 10), 'WI': ('BL', 8, 10),
'xBS10S': ('WN', 1, 10), 'xBS10S': ('WN', 1, 10),
'xBS1S': ('WN', 1, 1),
'xBS10s': ('WN', 1, 10), 'xBS10s': ('WN', 1, 10),
'xC10P': ('WN', 1, 10), 'xC10P': ('WN', 1, 10),
'xCHL10': ('WN', 1, 10), 'xCHL10': ('WN', 1, 10),
@@ -563,13 +564,14 @@ Opens the connection and logs in.
# because we use GMT +1 (MET, UTC-1) # because we use GMT +1 (MET, UTC-1)
# #
now=time.time() now=time.time()
if (parameter.find("10") != -1): period = self.period(parameter)
if (period == 10):
dt = now%600 dt = now%600
if (dt < 330): if (dt < 330):
now = 3000 + now - dt now = 3000 + now - dt
else: else:
now = 3600 + now - dt now = 3600 + now - dt
else: elif (period == 1):
# #
# e.g. H1 use 30 seconds to calculate the time. # e.g. H1 use 30 seconds to calculate the time.
# #
@@ -578,6 +580,9 @@ Opens the connection and logs in.
now = 3540 + now - dt now = 3540 + now - dt
else: else:
now = 3600 + now - dt now = 3600 + now - dt
else:
# At the moment no support for parameters other than 1 or 10 minutes.
raise LmwParmWarn(parameter)
time_of_day=time.strftime("%H:%M", time.gmtime(now)) time_of_day=time.strftime("%H:%M", time.gmtime(now))
return { "day": time.strftime("%d-%m-%Y", time.gmtime(now)), return { "day": time.strftime("%d-%m-%Y", time.gmtime(now)),
"time_of_day": time.strftime("%H:%M", time.gmtime(now)) } "time_of_day": time.strftime("%H:%M", time.gmtime(now)) }