Skip to content

Home Information - Your home, your data, organized.

Python
2.0 KB
Raw Blame
from hi.apps.common.enums import LabeledEnum

    
class SecurityLevel( LabeledEnum ):
    """
    This defines the internal systrem security level for determing which
    alerts should be created.  The SecurityState and SecurtyStateActions
    control the transitions between security levels and how alerts will be
    handled.
    """
    
    HIGH      = ( 'High' , '' )
    LOW       = ( 'Low'  , '' )
    OFF       = ( 'Off'  , '' )

    @classmethod
    def non_off_choices(cls):
        choice_list = list()
        for security_level in cls:
            if security_level == SecurityLevel.OFF:
                continue
            choice_list.append( ( security_level.name.lower(), security_level.label ) )
            continue
        return choice_list
    
    
class SecurityState( LabeledEnum ):
    """
    This is the overall security level setting for security status monitoring
    that dictates what type of security events are relevant.
    """
    
    DISABLED      = ( 'Disabled' , '' , False , False )
    DAY           = ( 'Day'      , '' , True  , False )
    NIGHT         = ( 'Night'    , '' , True  , False )
    AWAY          = ( 'Away'     , '' , False , True )

    def __init__( self,
                  label                : str,
                  description          : str,
                  auto_change_allowed  : bool,
                  uses_notifications   : bool ):
        super().__init__( label, description )
        self.auto_change_allowed = auto_change_allowed  # Can automated tasks change from this state
        self.uses_notifications = uses_notifications
        return
    
    
class SecurityStateAction( LabeledEnum ):
    """
    This is the overall security level setting for security status monitoring
    that dictates what type of security events are relevant.
    """
    
    DISABLE       = ( 'Disable'  , '' )
    SET_DAY       = ( 'Day'      , '' )
    SET_NIGHT     = ( 'Night'    , '' )
    SET_AWAY      = ( 'Away'     , '' )
    SNOOZE        = ( 'Snooze'   , '' )