def test2_1_flip_main(self): """ GpioCtrl >2_1> flip pin2 w/ and w/o main pin be set (manually) """ ctrl = GpioCtrl(self.opt) ctrl.read_cfg() # set the main-pin to 0 ctrl.set_pin('5', 0) self.check_pin(5, 0) ctrl.set_pin('1', 0) self.check_pin(1, 0) main_cfg = { 'groups': 'garden', } ctrl.set_pin_cfg('5', main_cfg) pin5 = ctrl.get_pin(5) pin5.change_mode('off') pprint(pin5.get_json()) ctrl.flip('1') # should be still 0, since pin5 as main-pin does not allow a switch self.check_pin(1, 0) ctrl.flip('5') self.check_pin(5, 1) ctrl.flip('1') # should be still 0, since pin5 as main-pin does not allow a switch self.check_pin(1, 1)
def test2_0_flip(self): """ GpioCtrl >2_0> flip pin2 """ ctrl = GpioCtrl(self.opt) ctrl.read_cfg() ctrl.set_pin('5', 1) self.check_pin(5, 1) ctrl.flip('2') self.check_pin(2, 1) ctrl.flip('2') self.check_pin(2, 0)
def test2_2_flip_main_auto(self): """ GpioCtrl >2_2> flip pin1 with main pin set to on (auto) """ ctrl = GpioCtrl(self.opt) ctrl.read_cfg() # set the main-pin to 0 ctrl.set_pin('5', 0) self.check_pin(5, 0) ctrl.set_pin('1', 0) self.check_pin(1, 0) main_cfg = { 'groups': 'garden', } ctrl.set_pin_cfg('5', main_cfg) pin5 = ctrl.get_pin(5) pin5.change_mode('off') pprint(pin5.get_json())