File: requestor_uuid.py

package info (click to toggle)
python-bond-async 0.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: python: 1,537; makefile: 4
file content (16 lines) | stat: -rw-r--r-- 432 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from enum import Enum


class RequestorUUID(Enum):
    # These are the existing requestor IDs that are already allocated
    TEST = 0x00
    # Only allow requestor IDs greater than 0xA0
    ANONYMOUS = 0xFF
    HOME_ASSISTANT = 0xA0

    # method that returns if a given hex requestor is allowed
    def is_allowed(self) -> bool:
        return self.value >= 0xA0

    def hex_value(self) -> str:
        return f"{self.value:02x}"