Exemplo n.º 1
0
def check_time_constraint(args, name):
  unconstrained = True
  if "constrain_start_time" in args or "constrain_end_time" in args:
    if "constrain_start_time" not in args:
      start_time = "00:00:00"
    else:
      start_time = args["constrain_start_time"]
    if "constrain_end_time" not in args:
      end_time = "23:59:59"
    else:
      end_time = args["constrain_end_time"]
    if not ha.now_is_between(start_time, end_time, name):
      unconstrained = False

  return unconstrained
Exemplo n.º 2
0
 def now_is_between(self, start_time_str, end_time_str):
     return ha.now_is_between(start_time_str, end_time_str, self.name)