# Path: insteonplm/constants.py
# HC_LOOKUP = {
#     "a": 0x06,
#     "b": 0x0E,
#     "c": 0x02,
#     "d": 0x0A,
#     "e": 0x01,
#     "f": 0x09,
#     "g": 0x05,
#     "h": 0x0D,
#     "i": 0x07,
#     "j": 0x0F,
#     "k": 0x03,
#     "l": 0x0B,
#     "m": 0x00,
#     "n": 0x08,
#     "o": 0x04,
#     "p": 0x0C,
# }
# 
# UC_LOOKUP = {
#     1: 0x06,
#     2: 0x0E,
#     3: 0x02,
#     4: 0x0A,
#     5: 0x01,
#     6: 0x09,
#     7: 0x05,
#     8: 0x0D,
#     9: 0x07,
#     10: 0x0F,
#     11: 0x03,
#     12: 0x0B,
#     13: 0x00,
#     14: 0x08,
#     15: 0x04,
#     16: 0x0C,
#     20: 0x20,  # All Units Off fake device
#     21: 0x21,  # All Lights On fake device
#     22: 0x22,
# }  # All Lights Off fake device
# 
# X10_COMMAND_ALL_UNITS_OFF = 0x00
# 
# X10_COMMAND_ALL_LIGHTS_ON = 0x01
# 
# X10_COMMAND_ALL_LIGHTS_OFF = 0x06
# 
# class X10CommandType(Enum):
#     """X10 command types."""
# 
#     DIRECT = 0
#     BROADCAST = 1


from insteonplm.constants import (
    HC_LOOKUP,
    UC_LOOKUP,
    X10_COMMAND_ALL_UNITS_OFF,
    X10_COMMAND_ALL_LIGHTS_ON,
    X10_COMMAND_ALL_LIGHTS_OFF,
    X10CommandType,
)
"""Utility methods."""




def housecode_to_byte(housecode):
    """Return the byte value of an X10 housecode."""
    return HC_LOOKUP.get(housecode.lower())


def unitcode_to_byte(unitcode):
    """Return the byte value of an X10 unitcode."""
    return UC_LOOKUP.get(unitcode)


def byte_to_housecode(bytecode):
    """Return an X10 housecode value from a byte value."""

# Path: insteonplm/constants.py
# HC_LOOKUP = {
#     "a": 0x06,
#     "b": 0x0E,
#     "c": 0x02,
#     "d": 0x0A,
#     "e": 0x01,
#     "f": 0x09,
#     "g": 0x05,
#     "h": 0x0D,
#     "i": 0x07,
#     "j": 0x0F,
#     "k": 0x03,
#     "l": 0x0B,
#     "m": 0x00,
#     "n": 0x08,
#     "o": 0x04,
#     "p": 0x0C,
# }
# 
# UC_LOOKUP = {
#     1: 0x06,
#     2: 0x0E,
#     3: 0x02,
#     4: 0x0A,
#     5: 0x01,
#     6: 0x09,
#     7: 0x05,
#     8: 0x0D,
#     9: 0x07,
#     10: 0x0F,
#     11: 0x03,
#     12: 0x0B,
#     13: 0x00,
#     14: 0x08,
#     15: 0x04,
#     16: 0x0C,
#     20: 0x20,  # All Units Off fake device
#     21: 0x21,  # All Lights On fake device
#     22: 0x22,
# }  # All Lights Off fake device
# 
# X10_COMMAND_ALL_UNITS_OFF = 0x00
# 
# X10_COMMAND_ALL_LIGHTS_ON = 0x01
# 
# X10_COMMAND_ALL_LIGHTS_OFF = 0x06
# 
# class X10CommandType(Enum):
#     """X10 command types."""
# 
#     DIRECT = 0
#     BROADCAST = 1


# Path: insteonplm/utils.py
from insteonplm.constants import (
    HC_LOOKUP,
    UC_LOOKUP,
    X10_COMMAND_ALL_UNITS_OFF,
    X10_COMMAND_ALL_LIGHTS_ON,
    X10_COMMAND_ALL_LIGHTS_OFF,
    X10CommandType,
)

"""Utility methods."""




def housecode_to_byte(housecode):
    """Return the byte value of an X10 housecode."""
    return HC_LOOKUP.get(housecode.lower())


def unitcode_to_byte(unitcode):
    """Return the byte value of an X10 unitcode."""
    return UC_LOOKUP.get(unitcode)


def byte_to_housecode(bytecode):
    """Return an X10 housecode value from a byte value."""

    hc = list(HC_LOOKUP.keys())[list(HC_LOOKUP.values()).index(bytecode)]