How to use the broadlink.__init__.rm function in broadlink

To help you get started, we’ve selected a few broadlink examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mjg59 / python-broadlink / broadlink / __init__.py View on Github external
packet = bytearray(16)
        packet[0] = 1
        response = self.send_packet(0x6a, packet)
        err = response[0x22] | (response[0x23] << 8)
        if err != 0:
            return False
        payload = self.decrypt(bytes(response[0x38:]))
        if isinstance(payload[0x4], int):
            temp = (payload[0x4] * 10 + payload[0x5]) / 10.0
        else:
            temp = (ord(payload[0x4]) * 10 + ord(payload[0x5])) / 10.0
        return temp


# For legacy compatibility - don't use this
class rm2(rm):
    def __init__(self):
        device.__init__(self, None, None, None)

    def discover(self):
        dev = discover()
        self.host = dev.host
        self.mac = dev.mac


class hysen(device):
    def __init__(self, host, mac, devtype):
        device.__init__(self, host, mac, devtype)
        self.type = "Hysen heating controller"

    # Send a request
    # input_payload should be a bytearray, usually 6 bytes, e.g. bytearray([0x01,0x06,0x00,0x02,0x10,0x00])
github mjg59 / python-broadlink / broadlink / __init__.py View on Github external
def gendevice(devtype, host, mac):
    devices = {
        sp1: [0],
        sp2: [0x2711,  # SP2
              0x2719, 0x7919, 0x271a, 0x791a,  # Honeywell SP2
              0x2720,  # SPMini
              0x753e,  # SP3
              0x7D00,  # OEM branded SP3
              0x947a, 0x9479,  # SP3S
              0x2728,  # SPMini2
              0x2733, 0x273e,  # OEM branded SPMini
              0x7530, 0x7546, 0x7918,  # OEM branded SPMini2
              0x7D0D,  # TMall OEM SPMini3
              0x2736  # SPMiniPlus
              ],
        rm: [0x2712,  # RM2
             0x2737,  # RM Mini
             0x273d,  # RM Pro Phicomm
             0x2783,  # RM2 Home Plus
             0x277c,  # RM2 Home Plus GDT
             0x272a,  # RM2 Pro Plus
             0x2787,  # RM2 Pro Plus2
             0x279d,  # RM2 Pro Plus3
             0x27a9,  # RM2 Pro Plus_300
             0x278b,  # RM2 Pro Plus BL
             0x2797,  # RM2 Pro Plus HYC
             0x27a1,  # RM2 Pro Plus R1
             0x27a6,  # RM2 Pro PP
             0x278f,  # RM Mini Shate
             0x27c2  # RM Mini 3
             ],
        a1: [0x2714],  # A1