当前位置: 首页>>代码示例>>Python>>正文


Python ZWaveOption.set_console_output方法代码示例

本文整理汇总了Python中openzwave.option.ZWaveOption.set_console_output方法的典型用法代码示例。如果您正苦于以下问题:Python ZWaveOption.set_console_output方法的具体用法?Python ZWaveOption.set_console_output怎么用?Python ZWaveOption.set_console_output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openzwave.option.ZWaveOption的用法示例。


在下文中一共展示了ZWaveOption.set_console_output方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
    def __init__(self, name, location, nodefilename="/opt/seciot/nodenames.json"):
        IOTDeviceController.__init__(self, name)

        # Restore node stuff
        nodefile = open(nodefilename, "r")
        nodejson = nodefile.read()
        self.node_dict = json.loads(nodejson)

        # Init options
        device = "/dev/ttyACM0"
        sniff = 300.0
        options = ZWaveOption(device, config_path="/opt/openzwave/config", user_path=".", cmd_line="")
        options.set_logging(False)
        options.set_console_output(False)
        options.lock()
        # Create a network object
        self.network = ZWaveNetwork(options, autostart=False)
        self.network.set_poll_interval(10, True)
        # We connect to the louie dispatcher
        dispatcher.connect(self.louie_network_started, ZWaveNetwork.SIGNAL_NETWORK_STARTED)
        dispatcher.connect(self.louie_network_failed, ZWaveNetwork.SIGNAL_NETWORK_FAILED)
        self.network.start()
        # We wait for the network.
        print "***** Waiting for network to become ready : "
        for i in range(0, 300):
            if self.network.state >= self.network.STATE_READY:
                print "***** Network is ready"
                break
            else:
                sys.stdout.write(".")
                sys.stdout.flush()
            time.sleep(1.0)
            # We update the name of the controller
        self.network.controller.node.name = name
        self.network.controller.node.location = location
开发者ID:aakatz3,项目名称:seciot,代码行数:37,代码来源:zwservice.py

示例2: Open_zwave

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
class Open_zwave(HAInterface):
    VERSION='0.0.1'
    awake=False
    ready=False
    nodesdisplayed=False
    
    def __init__(self, *args, **kwargs):
        self._serialDevicePath = kwargs.get('serialDevicePath', None)
        self._options = ZWaveOption(self._serialDevicePath, \
          config_path="/usr/share/python-openzwave/config", \
          user_path=".", cmd_line="")
        self._options.set_log_file("OZW_Log.log")
        self._options.set_append_log_file(False)
        self._options.set_console_output(True)
        #self._options.set_save_log_level(log)
        self._options.set_save_log_level('Info')
        self._options.set_logging(False)
        self._options.lock()
        self._network = ZWaveNetwork(self._options, log=None)       
        super(Open_zwave, self).__init__(self, *args, **kwargs)
        

    def _init(self, *args, **kwargs):   
        super(Open_zwave, self)._init(self, *args, **kwargs)

    def _readInterface(self, lastPacketHash):
        if self._network.state>=self._network.STATE_AWAKED and not self.awake:
            self.awake = True
            self._logger.info("Network Awaked")
        if self._network.state>=self._network.STATE_READY and not self.ready:
            self.ready = True
            self._logger.info("Network Ready")
        if not self.awake:
            time.sleep(1.0)
            self._logger.debug("Not awaked")
            return
        if self.awake and not self.ready:
            time.sleep(1.0)
            self._logger.debug("Not ready")
            return
        if not nodesdisplayed:           
            for node in self._network.nodes:
                print
                print "------------------------------------------------------------"
                print "%s - Name : %s" % (self._network.nodes[node].node_id,self._network.nodes[node].name)
                print "%s - Manufacturer name / id : %s / %s" % (self._network.nodes[node].node_id,self._network.nodes[node].manufacturer_name, self._network.nodes[node].manufacturer_id)
                print "%s - Product name / id / type : %s / %s / %s" % (self._network.nodes[node].node_id,self._network.nodes[node].product_name, self._network.nodes[node].product_id, self._network.nodes[node].product_type)
                print "%s - Version : %s" % (self._network.nodes[node].node_id, self._network.nodes[node].version)
                print "%s - Command classes : %s" % (self._network.nodes[node].node_id,self._network.nodes[node].command_classes_as_string)
                print "%s - Capabilities : %s" % (self._network.nodes[node].node_id,self._network.nodes[node].capabilities)
                print "%s - Neigbors : %s" % (self._network.nodes[node].node_id,self._network.nodes[node].neighbors)
                print "%s - Can sleep : %s" % (self._network.nodes[node].node_id,self._network.nodes[node].can_wake_up())
            nodesdisplayed=True
    
    def version(self):
        self._logger.info("Open_zwave Pytomation Driver version " + self.VERSION)
        self._logger.info("Use openzwave library : %s" % self._network.controller.ozw_library_version)
        self._logger.info("Use python library : %s" % self._network.controller.python_library_version)
        self._logger.info("Use ZWave library : %s" % self._network.controller.library_description)
        
开发者ID:Jstaud,项目名称:pytomation,代码行数:61,代码来源:open_zwave.py

示例3: setup

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
    def setup(self, updateCallback):
        dispatcher.connect(self.onNetworkReady, ZWaveNetwork.SIGNAL_NETWORK_READY)
        dispatcher.connect(self.onNetworkStart, ZWaveNetwork.SIGNAL_NETWORK_STARTED)
        dispatcher.connect(self.onNetworkFailed, ZWaveNetwork.SIGNAL_NETWORK_FAILED)

        # TODO: make udev.symlink rule to a specific port (USB0/1)
        # Uncomment this to run on PC (remember to update the zwave config path)
        #options = ZWaveOption("/dev/ttyUSB0", \
        #  config_path="/home/<USER>/software/python-openzwave-0.2.6/openzwave/config", \
        options = ZWaveOption("/dev/serial/by-path/platform-bcm2708_usb-usb-0:1.2:1.0-port0", \
          config_path="/home/pi/software/python-openzwave-0.2.6/openzwave/config", \
          user_path=".", cmd_line="")
        options.set_append_log_file(False)
        options.set_console_output(False)
        options.set_save_log_level('Debug')
        options.set_poll_interval(30);
        options.set_suppress_value_refresh(False)
        options.addOptionBool("AssumeAwake", True)
        options.set_logging(False)
        options.lock()
        self.network = ZWaveNetwork(options, autostart=False)
        self.onDeviceUpdateCallback = updateCallback
        self.network.start()
        self.addedConnections = False
        Timer(2*60, self.setupConnections).start()
开发者ID:hoffmannmatheus,项目名称:eaZy,代码行数:27,代码来源:zwave_controller.py

示例4: startup_zwave

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
  def startup_zwave(self, args={}):
    ffEvent(self._id,{'zwave':'starting_up'})
    zwaveSetup = ZWaveOption(self._port, self._configFile)
    zwaveSetup.set_console_output(False)
    zwaveSetup.lock()
    network = ZWaveNetwork(zwaveSetup, autostart=False)
    network.start()

    stdout.write("Waking up Zwave (This can take up to 5 minutes)")
    for i in xrange(3):
      if network.state >= network.STATE_AWAKED:
        logging.info('Zwave Network Awake')
        break
      else:
        stdout.write(".")
        stdout.flush()
        sleep(1)

    for x in xrange(3):
      if network.state >= network.STATE_READY:
        ffEvent(self._id,{'zwave':'network_ready'})
      else:
        stdout.write(".")
        stdout.flush()
        sleep(.5)

    return network
开发者ID:zpriddy,项目名称:Firefly,代码行数:29,代码来源:ffZwave.py

示例5: start_zwnetwork

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
def start_zwnetwork(app):
    options = ZWaveOption(device=app.config['ZWAVE_DEVICE'], config_path=app.config['ZWAVE_DIR'], user_path=app.config['USER_DIR'])
    options.set_log_file("OZW_Log.log")
    options.set_append_log_file(False)
    options.set_console_output(False)
    options.set_save_log_level(app.config['ZWAVE_DEBUG'])
    options.set_logging(app.config['ZWAVE_LOGGING'])
    options.lock()
    zwnetwork = ZWaveNetwork(options)
    return zwnetwork
开发者ID:emanuelliborio,项目名称:python-openzwave,代码行数:12,代码来源:__init__.py

示例6: TestApi

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
class TestApi(TestPyZWave):
    """
    Parent test class for api
    """

    @classmethod
    def setUpClass(self):
        super(TestApi, self).setUpClass()
        self.options = ZWaveOption(device=self.device, user_path=self.userpath)
        self.options.set_log_file("OZW_Log.log")
        self.options.set_append_log_file(False)
        self.options.set_console_output(False)
        self.options.set_save_log_level("Debug")
        self.options.set_logging(True)
        self.options.lock()
        self.ctrl_command_result = None
        dispatcher.connect(self.ctrl_message, ZWaveController.SIGNAL_CONTROLLER)
        self.node_result = None
        dispatcher.connect(self.node_update, ZWaveNetwork.SIGNAL_NODE)
        self.network = ZWaveNetwork(self.options)
        time.sleep(1.0)

    @classmethod
    def tearDownClass(self):
        self.network.stop()
        time.sleep(2.0)
        super(TestApi, self).tearDownClass()
        self.network=None

    def setUp(self):
        self.wait_for_network_state(self.network.STATE_AWAKED, 1)

    def wait_for_queue(self):
        for i in range(0,60):
            if self.network.controller.send_queue_count <= 0:
                break
            else:
                time.sleep(0.5)

    def wait_for_network_state(self, state, multiply=1):
        for i in range(0,SLEEP*multiply):
            if self.network.state>=state:
                break
            else:
                #sys.stdout.write(".")
                #sys.stdout.flush()
                time.sleep(1.0)

    def ctrl_message(self, state, message, network, controller):
        self.ctrl_command_result = state

    def node_update(self, network, node):
        self.node_result = node
开发者ID:emanuelliborio,项目名称:python-openzwave,代码行数:55,代码来源:common.py

示例7: __init__

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
    def __init__(self):

	###################  instanciation de l'objet backend ########################################################


	###### options needed for python openzwave library like config files path, logging, 
        device = configpi.interface
        options = ZWaveOption(device, config_path="/home/pi/git-repo/python-openzwave/openzwave/config", user_path=".", cmd_line="")
        options.set_log_file("OZW.log")
        options.set_append_log_file(False)
        options.set_console_output(False)
        options.set_save_log_level('Warning')
        options.set_logging(True)
        options.lock()

        # creation of the object network using the options entity already created
        self.network = ZWaveNetwork(options, autostart=False)

	###### 	 These dispatchers associate a method to a signal. the signals are generated by the library python-openzwave.
	######   Once the signal is reveived. It's associated method is executed (see "_node_added" example below in "_network_started" method)
        dispatcher.connect(self._network_started, ZWaveNetwork.SIGNAL_NETWORK_STARTED)
        dispatcher.connect(self._network_failed, ZWaveNetwork.SIGNAL_NETWORK_FAILED)
        dispatcher.connect(self._network_ready, ZWaveNetwork.SIGNAL_NETWORK_READY)

	###### backend object attributes
#        self.devices = OrderedDict()  ### will contain the list of nodes in the network
#        self.sensors = OrderedDict()  ### will contain the list of sensors (only) in the network
        self.node_added = False
        self.node_removed = False
	self.timestamps = {}	      ### will contain the time of the last values' update for each sensor
        self.queryStages = {	      ### the diffrent stages that a node object gets through before being ready 
                "None"                  :  1, # Query process hasn't started for this node
                "ProtocolInfo"          :  2, # Retrieve protocol information
                "Probe"                 :  3, # Ping device to see if alive
                "WakeUp"                :  4, # Start wake up process if a sleeping node
                "ManufacturerSpecific1" :  5, # Retrieve manufacturer name and product ids if ProtocolInfo lets us
                "NodeInfo"              :  6, # Retrieve info about supported, controlled command classes
                "SecurityReport"        :  7, # Retrieve a list of Command Classes that require Security
                "ManufacturerSpecific2" :  8, # Retrieve manufacturer name and product ids
                "Versions"              :  9, # Retrieve version information
                "Instances"             : 10, # Retrieve information about multiple command class instances
                "Static"                : 11, # Retrieve static information (doesn't change)
                "Probe1"                : 12, # Ping a device upon starting with configuration
                "Associations"          : 13, # Retrieve information about associations
                "Neighbors"             : 14, # Retrieve node neighbor list
                "Session"               : 15, # Retrieve session information (changes infrequently)
                "Dynamic"               : 16, # Retrieve dynamic information (changes frequently)
                "Configuration"         : 17, # Retrieve configurable parameter information (only done on request)
                "Complete"              : 18  # Query process is completed for this node
        }
开发者ID:wheelin,项目名称:iot_src_report,代码行数:52,代码来源:backend_modif.py

示例8: __init__

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
    def __init__(self, object_group, config):
        Plugin.__init__(self, config=config, object_group=object_group, plugin_name=PLUGIN_NAME)

        # Get parameters from the config file

        if not self.is_enabled():
            return

        # Initialize zwave library
        # Options
        try:
            opts = ZWaveOption(device="/dev/ttyUSB0",
                               config_path="/home/mlamonta/git/python-openzwave/openzwave/config/",
                               user_path="logs")
            opts.set_log_file("./logs/zwave.log")
            opts.set_save_log_level("Alert")
            opts.set_append_log_file(False)
            opts.set_console_output(False)
            opts.set_logging(True)
            opts.lock()
        except ZWaveException as e:
            self.logger.error(str(e))
            return

        # Network
        self.net = ZWaveNetwork(opts)

        self.logger.info("------------------------------------------------------------")
        self.logger.info("Waiting for network awake : ")
        self.logger.info("------------------------------------------------------------")
        for i in range(0, 300):
            if self.net.state >= self.net.STATE_AWAKED:
                self.logger.info("done")
                break
            else:
                time.sleep(1.0)

        if self.net.state < self.net.STATE_AWAKED:
            self.logger.warning("Network is not awake")
            return

        self.logger.info("------------------------------------------------------------")

        for node in self.net.nodes:
            self.logger.info("%s - %s / %s" % (self.net.nodes[node].node_id,
                                               self.net.nodes[node].manufacturer_name,
                                               self.net.nodes[node].product_name) )

        self._initialized = True
开发者ID:lemontongs,项目名称:AllSpark,代码行数:51,代码来源:zwave_control.py

示例9: __init__

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
    def __init__(self):
        device = "/dev/ttyUSB0"
        options = ZWaveOption(device, config_path="/home/rich/openzwave/config", user_path=".", cmd_line="")
        options.set_log_file("OZW_Log.log")
        options.set_append_log_file(False)
        options.set_console_output(False)
        options.set_save_log_level('Debug')
        options.set_logging(True)
        options.lock()

        self.values = {}
        dispatcher.connect(self._network_started, ZWaveNetwork.SIGNAL_NETWORK_STARTED)
        dispatcher.connect(self._network_failed, ZWaveNetwork.SIGNAL_NETWORK_FAILED)
        dispatcher.connect(self._network_ready, ZWaveNetwork.SIGNAL_NETWORK_READY)
        self.network = ZWaveNetwork(options, autostart=False)
开发者ID:richbeales,项目名称:flask-openzwave,代码行数:17,代码来源:backend.py

示例10: TestNetworkStartStop

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
class TestNetworkStartStop(TestPyZWave):

    @classmethod
    def setUpClass(self):
        super(TestNetworkStartStop, self).setUpClass()
        self.options = None
        self.network = None

    @classmethod
    def tearDownClass(self):
        if self.network is not None:
            self.network.stop()
        super(TestNetworkStartStop, self).tearDownClass()

    def test_000_network_start_stop(self):
        self.driver_ready = False
        self.driver_removed = False
        self.options = ZWaveOption(device=self.device, user_path=self.userpath)
        self.options.set_log_file("OZW_Log.log")
        self.options.set_append_log_file(False)
        self.options.set_console_output(False)
        self.options.set_save_log_level("Debug")
        self.options.set_logging(True)
        self.options.lock()
        dispatcher.connect(self.driver_ready_message, ZWaveNetwork.SIGNAL_DRIVER_READY)
        dispatcher.connect(self.driver_removed_message, ZWaveNetwork.SIGNAL_DRIVER_REMOVED)
        self.network = ZWaveNetwork(self.options)
        for i in range(0, SLEEP):
            if self.network.state>=self.network.STATE_AWAKED:
                break
            else:
                time.sleep(1.0)
        self.assertTrue(self.driver_ready)
        self.network.stop()
        for i in range(0, SLEEP):
            if self.network.state==self.network.STATE_STOPPED:
                break
            else:
                time.sleep(1.0)
        self.assertEqual(self.network.state, self.network.STATE_STOPPED)
        #self.assertTrue(self.driver_removed)
        self.network = None

    def driver_ready_message(self, network, controller):
        self.driver_ready = True

    def driver_removed_message(self, network):
        self.driver_removed = True
开发者ID:bdfoster,项目名称:python-openzwave-1,代码行数:50,代码来源:test_network.py

示例11: init_zwave_network

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
def init_zwave_network(device=None, config_path=None, user_path=None, debug=False):
    options = ZWaveOption(device, config_path=config_path, user_path=user_path, cmd_line="")
    options.set_log_file(os.path.join(user_path, "OZW_Log.log"))
    options.set_append_log_file(False)
    options.set_console_output(False)
    options.set_save_log_level('Info')  # ('Info' if debug else 'Warning')
    options.set_logging(True)
    options.lock()

    zwave_network = ZWaveNetwork(options, autostart=False)

    # We connect to the louie dispatcher
    dispatcher.connect(zwave_network_started, ZWaveNetwork.SIGNAL_NETWORK_STARTED)
    dispatcher.connect(zwave_network_failed, ZWaveNetwork.SIGNAL_NETWORK_FAILED)
    dispatcher.connect(zwave_network_ready, ZWaveNetwork.SIGNAL_NETWORK_READY)

    return zwave_network
开发者ID:troolee,项目名称:zwave-agentx,代码行数:19,代码来源:agent.py

示例12: create_zwave_options

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
def create_zwave_options(
    device,
    config_path = "/usr/local/etc/openzwave", # TODO: Auto-discover
    user_path = ".",
    cmd_line = ""):
  try:
    options = ZWaveOption(
        device,
        config_path=config_path,
        user_path=user_path,
        cmd_line=cmd_line)

    options.set_console_output(False)
    options.set_logging(False)
    options.lock()
    return options
  except ZWaveOption:
    # TODO: Seems device can only be used by one process at the time. If so,
    # try to give a meaningful error message
    raise
开发者ID:cslarsen,项目名称:home-zwave,代码行数:22,代码来源:home.py

示例13: _init

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
    def _init(self, device, config, timeout):
        self.network = None
        self.status = 1
        self.timeout = timeout
        self.device = device
        self.config = config

        options = ZWaveOption(self.device, config_path=self.config, user_path=".", cmd_line="")
        options.set_log_file("OZW_Log.log")
        options.set_append_log_file(False)
        options.set_console_output(False)
        options.set_save_log_level('Debug')
        options.set_logging(True)

        options.lock()
        self.network = ZWaveNetwork(options, autostart=False)

        dispatcher.connect(louie_network_started, ZWaveNetwork.SIGNAL_NETWORK_STARTED)
        dispatcher.connect(louie_network_failed, ZWaveNetwork.SIGNAL_NETWORK_FAILED)
        dispatcher.connect(louie_network_ready, ZWaveNetwork.SIGNAL_NETWORK_READY)

        self.network.start()
开发者ID:RomanGrekov,项目名称:z_gateway,代码行数:24,代码来源:start_network.py

示例14: __init__

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
	def	__init__( self ):
		device="/dev/ttyUSB0"
	
		options = ZWaveOption( "/dev/ttyUSB0", \
			config_path=os.path.expanduser("~/.zwave/config/"), \
			#user_path='.', \
			user_path=os.path.expanduser("~/.zwave/"), \
			cmd_line="")

		options.set_append_log_file(False)
		options.set_console_output(False)
		options.set_save_log_level('Info')

		options.set_logging(True)
		options.lock()

		print "Initialize Z-Wave network"
		self.network = ZWaveNetwork(options, log=None)

		print "Wait for driver"
		# Waiting for driver
		for i in range(0,20):
			if self.network.state>=self.network.STATE_INITIALISED: break
			else: time.sleep(1.0)

		if self.network.state<self.network.STATE_INITIALISED:
			print "Can't initialise driver! Look at the logs in OZW_Log.log"
			quit(1)
	
		print "Wait for network ready"
		# Waiting for network ready
		for i in range(0,90):
			if self.network.state>=self.network.STATE_READY: break
			else: time.sleep(1.0)
		if not self.network.is_ready:
			print "Can't start network! Look at the logs in OZW_Log.log"
			quit(2)
开发者ID:wylieswanson,项目名称:automaton,代码行数:39,代码来源:automatond.py

示例15: print

# 需要导入模块: from openzwave.option import ZWaveOption [as 别名]
# 或者: from openzwave.option.ZWaveOption import set_console_output [as 别名]
    if arg.startswith("--device"):
        temp,device = arg.split("=")
    elif arg.startswith("--log"):
        temp,log = arg.split("=")
    elif arg.startswith("--help"):
        print("help : ")
        print("  --device=/dev/yourdevice ")
        print("  --log=Info|Debug")

#Define some manager options
options = ZWaveOption(device, \
  config_path="../openzwave/config", \
  user_path=".", cmd_line="")
options.set_log_file("OZW_Log.log")
options.set_append_log_file(False)
options.set_console_output(True)
options.set_save_log_level(log)
#options.set_save_log_level('Info')
options.set_logging(False)
options.lock()

print("Memory use : %s Mo" % (resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024.0))

#Create a network object
network = ZWaveNetwork(options, log=None)

time_started = 0
print "------------------------------------------------------------"
print "Waiting for network awaked : "
print "------------------------------------------------------------"
for i in range(0,300):
开发者ID:bdfoster,项目名称:python-openzwave-1,代码行数:33,代码来源:api_demo.py


注:本文中的openzwave.option.ZWaveOption.set_console_output方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。