예제 #1
0
    def send(self, payload, radio_config=None):
        #   payload is a pydict suitable for OpenThings
        #   radio_params is an overlay on top of radio tx defaults
        p = OpenThings.encode(payload)

        # Set radio defaults, if no override
        outer_times = self.tx_defaults.outer_times
        outer_delay = self.tx_defaults.outer_delay
        inner_times = self.tx_defaults.inner_times

        # Merge any wanted radio params, if provided
        if radio_config != None:
            try:
                outer_times = radio_config.outer_times
            except AttributeError:
                pass
            try:
                outer_delay = radio_config.outer_delay
            except AttributeError:
                pass
            try:
                inner_times = radio_config.inner_times
            except AttributeError:
                pass

        radio.transmitter(fsk=True)
        ##print("inner times %s" % inner_times)
        radio.transmit(p,
                       outer_times=outer_times,
                       inner_times=inner_times,
                       outer_delay=outer_delay)
예제 #2
0
    def send(self, payload, radio_config=None):
        #   payload is just a list of bytes, or a byte buffer
        #   radio_config is an overlay on top of radio tx defaults

        house_address = payload["house_address"]
        cmd = payload["cmd"]
        bytes = EV1527.encode_send_msg(cmd, house_address)
        radio.modulation(ook=True)

        # Set radio defaults, if no override
        outer_times = self.tx_defaults.outer_times
        outer_delay = self.tx_defaults.outer_delay
        inner_times = self.tx_defaults.inner_times

        # Merge any wanted radio params, if provided
        if radio_config != None:
            try:
                outer_times = radio_config.outer_times
            except AttributeError:
                pass
            try:
                outer_delay = radio_config.outer_delay
            except AttributeError:
                pass
            try:
                inner_times = radio_config.inner_times
            except AttributeError:
                pass

        ##print("inner times %s" % inner_times)
        radio.transmit(bytes,
                       outer_times=outer_times,
                       inner_times=inner_times,
                       outer_delay=outer_delay)
예제 #3
0
파일: OnAir.py 프로젝트: maxf/home
    def send(self, payload, radio_config=None):
        #   payload is a pydict suitable for OpenThings
        #   radio_params is an overlay on top of radio tx defaults
        p = OpenThings.encode(payload)

        # Set radio defaults, if no override
        outer_times = self.tx_defaults.outer_times
        outer_delay = self.tx_defaults.outer_delay
        inner_times = self.tx_defaults.inner_times

        # Merge any wanted radio params, if provided
        if radio_config != None:
            try:
                outer_times = radio_config.outer_times
            except AttributeError: pass
            try:
                outer_delay = radio_config.outer_delay
            except AttributeError: pass
            try:
                inner_times = radio_config.inner_times
            except AttributeError: pass

        radio.transmitter(fsk=True)
        ##print("inner times %s" % inner_times)
        radio.transmit(p, outer_times=outer_times, inner_times=inner_times, outer_delay=outer_delay)
예제 #4
0
파일: OnAir.py 프로젝트: maxf/home
    def send(self, payload, radio_config=None):
        #   payload is just a list of bytes, or a byte buffer
        #   radio_config is an overlay on top of radio tx defaults

        house_address = payload["house_address"]
        device_index  = payload["device_index"]
        state         = payload["on"]
        bytes = TwoBit.encode_switch_message(state, device_index, house_address)
        radio.modulation(ook=True)

        # Set radio defaults, if no override
        outer_times = self.tx_defaults.outer_times
        outer_delay = self.tx_defaults.outer_delay
        inner_times = self.tx_defaults.inner_times

        # Merge any wanted radio params, if provided
        if radio_config != None:
            try:
                outer_times = radio_config.outer_times
            except AttributeError: pass
            try:
                outer_delay = radio_config.outer_delay
            except AttributeError: pass
            try:
                inner_times = radio_config.inner_times
            except AttributeError: pass

        ##print("inner times %s" % inner_times)
        radio.transmit(bytes, outer_times=outer_times, inner_times=inner_times, outer_delay=outer_delay)
예제 #5
0
def radio_test_ook():
    """Repeatedly test switch 1 ON then OFF"""

    radio.init()
    # init() defaults to standby()
    try:
        radio.modulation(ook=True)
        while True:
            print("Switch 1 ON")
            radio.transmit(enc_1on, TIMES)
            # auto returns to standby
            if DELAY != 0: time.sleep(DELAY)

            print("Switch 1 OFF")
            radio.transmit(enc_1off, TIMES)
            # auto returns to standby
            if DELAY != 0: time.sleep(DELAY)

    finally:
        radio.finished()
예제 #6
0
def radio_test_ook():
    """Repeatedly test switch 1 ON then OFF"""

    radio.init()
    # init() defaults to standby()
    try:
        radio.modulation(ook=True)
        while True:
            print("Switch 1 ON")
            radio.transmit(enc_1on, TIMES)
            # auto returns to standby
            if DELAY!=0: time.sleep(DELAY)

            print("Switch 1 OFF")
            radio.transmit(enc_1off, TIMES)
            # auto returns to standby
            if DELAY!=0: time.sleep(DELAY)

    finally:
        radio.finished()
예제 #7
0
    def _send2(self, payload, radio_config=None):
        """Actually send a payload"""
        #   payload is just a list of bytes, or a byte buffer
        #   radio_config is an overlay on top of radio tx defaults

        house_address = payload["house_address"]
        device_index = payload["device_index"]
        state = payload["on"]
        bytes = TwoBit.encode_switch_message(state, device_index,
                                             house_address)
        radio.modulation(ook=True)

        # Set radio defaults, if no override
        outer_times = self.tx_defaults.outer_times
        outer_delay = self.tx_defaults.outer_delay
        inner_times = self.tx_defaults.inner_times

        # Merge any wanted radio params, if provided
        if radio_config != None:
            try:
                outer_times = radio_config.outer_times
            except AttributeError:
                pass
            try:
                outer_delay = radio_config.outer_delay
            except AttributeError:
                pass
            try:
                inner_times = radio_config.inner_times
            except AttributeError:
                pass

        ##print("inner times %s" % inner_times)
        radio.transmit(bytes,
                       outer_times=outer_times,
                       inner_times=inner_times,
                       outer_delay=outer_delay)