code: def mode(self):
          
  
          if self.is_in_schedule_mode:
              return "schedule"
  
          resource = "modes"
          mode_event = self.publish_and_get_event(resource)
          if mode_event:
              properties = mode_event.get('properties')
              active_mode = properties.get('active')
              modes = properties.get('modes')
              if not modes:
                  return None
  
              for mode in modes:
                  if mode.get('id') == active_mode:
                      return mode.get('type') \
                          if mode.get('type') is not None else mode.get('name')
          return None
docs: Return current mode key.