Example #1
0
def main() -> None:
    """Run main code entrypoint."""
    sys.path.insert(
        0, os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))

    parser = argparse.ArgumentParser(description="list-devices")
    parser.add_argument("-u",
                        "--url",
                        help="Vera URL, e.g. http://192.168.1.161:3480",
                        required=True)
    args = parser.parse_args()

    # Start the controller
    controller = VeraController(args.url)
    controller.start()

    try:
        # Get a list of all the devices on the vera controller
        all_devices = controller.get_devices()

        # Print the devices out
        for device in all_devices:
            print("{} {} ({})".format(
                type(device).__name__, device.name, device.device_id))

    finally:
        # Stop the subscription listening thread so we can quit
        controller.stop()
Example #2
0
def main() -> None:
    """Run main code entrypoint."""
    sys.path.insert(
        0, os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))

    parser = argparse.ArgumentParser(description="list-devices")
    parser.add_argument("-u",
                        "--url",
                        help="Vera URL, e.g. http://192.168.1.161:3480",
                        required=True)
    parser.add_argument("--close",
                        help="Close garage door(s)",
                        action="store_true")
    args = parser.parse_args()

    # Start the controller
    controller = VeraController(args.url)
    controller.start()

    try:
        # Get a list of all the devices on the vera controller
        all_devices = controller.get_devices()

        # Open/close all garage doors.
        for device in all_devices:
            if isinstance(device, VeraGarageDoor):
                if args.close:
                    device.switch_off()
                else:
                    device.switch_on()

    finally:
        # Stop the subscription listening thread so we can quit
        controller.stop()
def main() -> None:
    """Run main code entrypoint."""
    sys.path.insert(
        0, os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))

    parser = argparse.ArgumentParser(description="lock-all-doors-with-status")
    parser.add_argument("-u",
                        "--url",
                        help="Vera URL, e.g. http://192.168.1.161:3480",
                        required=True)
    args = parser.parse_args()

    # Start the controller
    controller = VeraController(args.url)
    controller.start()

    try:
        # Get a list of all the devices on the vera controller
        all_devices = controller.get_devices()

        # Look over the list and find the lock devices
        lock_devices = []
        for device in all_devices:
            if isinstance(device, VeraLock):
                # Register a callback that runs when the info for that device is updated
                controller.register(device, device_info_callback)
                print("Initially, {}_{}: locked={}".format(
                    device.name, device.device_id, device.is_locked()))
                lock_devices.append(device)
                if not device.is_locked():
                    device.lock()

        # Loop until someone hits Ctrl-C to interrupt the listener
        try:
            all_locked = False
            while not all_locked:
                time.sleep(1)
                all_locked = True
                for device in lock_devices:
                    if not device.is_locked():
                        all_locked = False
            print("All doors are now locked")

        except KeyboardInterrupt:
            print("Got interrupted by user")

        # Unregister our callback
        for device in lock_devices:
            controller.unregister(device, device_info_callback)

    finally:
        # Stop the subscription listening thread so we can quit
        controller.stop()
Example #4
0
def main() -> None:
    """Run main code entrypoint."""
    sys.path.insert(
        0, os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))

    parser = argparse.ArgumentParser(description="show-lock-info")
    parser.add_argument("-u",
                        "--url",
                        help="Vera URL, e.g. http://192.168.1.161:3480",
                        required=True)
    args = parser.parse_args()

    # Start the controller
    controller = VeraController(args.url)
    controller.start()

    try:
        # Get a list of all the devices on the vera controller
        all_devices = controller.get_devices()

        # Look over the list and find the lock devices
        for device in all_devices:
            if isinstance(device, VeraLock):
                print("{} {} ({})".format(
                    type(device).__name__, device.name, device.device_id))
                print("    comm_failure: {}".format(device.comm_failure))
                print("    room_id: {}".format(device.room_id))
                print("    is_locked(): {}".format(device.is_locked()))
                print("    get_pin_failed(): {}".format(
                    device.get_pin_failed()))
                print("    get_unauth_user(): {}".format(
                    device.get_unauth_user()))
                print("    get_lock_failed(): {}".format(
                    device.get_lock_failed()))
                print("    get_last_user(): {}".format(device.get_last_user()))
                print("    get_pin_codes(): {}".format(device.get_pin_codes()))

    finally:
        # Stop the subscription listening thread so we can quit
        controller.stop()
Example #5
0
 def setup_callback(controller: pv.VeraController) -> None:
     controller.get_devices()[0].is_trippable = False
Example #6
0
 def setup_callback(controller: VeraController, hass_config: dict) -> None:
     controller.get_devices()[0].is_trippable = False