def run(self):
    self._push_rpc = pushrpc.PushRPC(self._push_event_callback, self._args)

    # These modules should work 100% of the time -
    # they don't need special hardware, or root
    self._proxies = {
        'hue': hue.Hue(self._args.hue_scan_interval_secs,
                       self._device_event_callback),
        'wemo': wemo.Wemo(self._args.hue_scan_interval_secs,
                          self._device_event_callback),
        'sonos': sonos.Sonos(self._args.hue_scan_interval_secs,
                             self._device_event_callback),
    }

    try:
      from pi import network
      self._proxies['network'] = network.NetworkMonitor(
          self._device_event_callback,
          self._args.network_scan_interval_secs,
          self._args.network_scan_timeout_secs)
    except:
      logging.debug('Exception was:', exc_info=sys.exc_info())
      logging.error('Failed to initialize network module - did you '
                    'run as root?')

    # This module needs a 433Mhz transmitter, wiringPi etc, so might not work
    try:
      from pi import rfswitch
      self._proxies['rfswitch'] = rfswitch.RFSwitch(self._args.rfswtich_pin)
    except:
      logging.debug('Exception was:', exc_info=sys.exc_info())
      logging.error('Failed to initialize rfswitch module - have you '
                    'installed rcswitch?')

    # This module needs a zwave usb stick
    try:
      from pi import zwave
      self._proxies['zwave'] = zwave.ZWave(
          self._args.zwave_device, self._device_event_callback)
    except:
      logging.debug('Exception was:', exc_info=sys.exc_info())
      logging.error('Failed to initialize zwave module - have you '
                    'installed libopenzwave?')

    # Just sit in a loop sleeping for now
    try:
      events.run()
    except __HOLE__:
      logging.info('Shutting down')

    # Now try and shut everything down gracefully
    self._push_rpc.stop()

    for proxy in self._proxies.itervalues():
      proxy.stop()

    for proxy in self._proxies.itervalues():
      proxy.join()
dataset/ETHPy150Open tomwilkie/awesomation/src/pi/control.py/Control.run