Exemplo n.º 1
0
 def push_values(self):
     command_set = []
     for setpoint_item in self.get_group_config():
         setpoint_id = setpoint_item.setpoint_id
         value = setpoint_item.value
         priority = setpoint_item.priority
         for entity_map in self.get_entity_mapping().get(setpoint_id):
             try:
                 property = entity_map.get_property_reference()
             except:
                 message = 'Error pushing value to %s' % (
                     entity_map.entity_path)
                 msglog.log('Global Setpoint Manager', msglog.types.INFO,
                            message)
                 msglog.exception()
                 continue
             if hasattr(property, 'override'):
                 command = OverrideCommand(property, value, priority)
             elif hasattr(property, 'set'):
                 command = SetCommand(property, value)
             else:
                 continue
             command_set.append(command)
     command_set = CommandSet(command_set)
     COMMAND_MANAGER.enqueue(command_set)
     return command_set.get_transaction_id()
Exemplo n.º 2
0
 def release_setpoint(self, setpoint_id, priority_level):
     command_set = []
     if ((len(self.get_entity_mapping()) != 0) and (setpoint_id in self.get_entity_mapping().keys())):
         ##
         # Entity map is not empty and also contains an entry for the 
         # setpoint_id, proceed ...
         ##
         for entity_map in self.get_entity_mapping().get(setpoint_id):
             try:
                 property = entity_map.get_property_reference()
             except:
                 message = 'Error releasing override for %s' % (entity_map.entity_path)
                 msglog.log('Global Setpoint Manager', msglog.types.INFO, message) 
                 msglog.exception()
                 continue
             if not hasattr(property, 'release'):
                 continue
             command_set.append(ReleaseCommand(property, priority_level))
     command_set = CommandSet(command_set)
     COMMAND_MANAGER.enqueue(command_set)
     return command_set.get_transaction_id()
Exemplo n.º 3
0
 def push_values(self):
     command_set = []
     for setpoint_item in self.get_group_config():
         setpoint_id = setpoint_item.setpoint_id
         value = setpoint_item.value
         priority = setpoint_item.priority
         for entity_map in self.get_entity_mapping().get(setpoint_id):
             try:
                 property = entity_map.get_property_reference()
             except:
                 message = 'Error pushing value to %s' % (entity_map.entity_path)
                 msglog.log('Global Setpoint Manager', msglog.types.INFO, message) 
                 msglog.exception()
                 continue
             if hasattr(property, 'override'):
                 command = OverrideCommand(property, value, priority)
             elif hasattr(property, 'set'):
                 command = SetCommand(property, value)
             else: 
                 continue
             command_set.append(command)
     command_set = CommandSet(command_set)
     COMMAND_MANAGER.enqueue(command_set)
     return command_set.get_transaction_id()
Exemplo n.º 4
0
 def release_setpoint(self, setpoint_id, priority_level):
     command_set = []
     if ((len(self.get_entity_mapping()) != 0)
             and (setpoint_id in self.get_entity_mapping().keys())):
         ##
         # Entity map is not empty and also contains an entry for the
         # setpoint_id, proceed ...
         ##
         for entity_map in self.get_entity_mapping().get(setpoint_id):
             try:
                 property = entity_map.get_property_reference()
             except:
                 message = 'Error releasing override for %s' % (
                     entity_map.entity_path)
                 msglog.log('Global Setpoint Manager', msglog.types.INFO,
                            message)
                 msglog.exception()
                 continue
             if not hasattr(property, 'release'):
                 continue
             command_set.append(ReleaseCommand(property, priority_level))
     command_set = CommandSet(command_set)
     COMMAND_MANAGER.enqueue(command_set)
     return command_set.get_transaction_id()
Exemplo n.º 5
0
 def get_push_values_progress(self, transaction_id):
     return COMMAND_MANAGER.get_push_values_progress(transaction_id)
Exemplo n.º 6
0
 def get_push_values_progress(self, transaction_id):
     return COMMAND_MANAGER.get_push_values_progress(transaction_id)