コード例 #1
0
    def __init__(self, dev_address, name):
        super(ZWTransport, self).__init__(dev_address, name)
        try:
            pyzwave.setVerbose(0)
            pyzwave.setdebug(0)
        except:
            print "PyZwave module has been updated. Please RE-INSTALL the pyzwave module in the wukong/tools/python/pyzwave"
            print "Using command: sudo python setup.py install"
            exit(-1)

        pyzwave.init(dev_address)

        try:
            _addr = pyzwave.getAddr()
        except:
            print "PyZwave module has been updated. Please RE-INSTALL the pyzwave module in the wukong/tools/python/pyzwave"
            print "Using command: sudo python setup.py install"
            exit(-1)

        b = _addr[:4]
        self._network_id = sum(b[i] << ((len(b) - 1 - i) * 8)
                               for i in range(len(b)))
        self._node_id = _addr[4]

        logger.info(
            "transport interface %s initialized on %s with Network ID %s and Node ID %s"
            % (name, dev_address, hex(self._network_id), hex(self._node_id)))
コード例 #2
0
    def __init__(self):
        self._mode = 'stop'

        # pyzwave
        try:
            pyzwave.init(ZWAVE_GATEWAY_IP)
        except IOError as e:
            return False

        TransportAgent.__init__(self)
コード例 #3
0
    def __init__(self):
        self._mode = 'stop'

        # pyzwave
        try:
            pyzwave.init(ZWAVE_GATEWAY_IP)
        except IOError as e:
            return False

        TransportAgent.__init__(self)
コード例 #4
0
ファイル: transport.py プロジェクト: HuangZhenQiu/NanoKong
    def __init__(self):
        logging.info('ZwaveAgent constructor')
        self._mode = 'stop'

        # pyzwave
        try:
            pyzwave.init(ZWAVE_GATEWAY_IP)
        except IOError as e:
            return False

        TransportAgent.__init__(self)
コード例 #5
0
ファイル: pynvc.py プロジェクト: jim841019g/IotTeam09
def init(option, debug=False):
    global pymodule
    if option == 'zwave' or option == 0:
        try:
            pyzwave.init(ZWAVE_GATEWAY_IP)
            pymodule = pyzwave
        except IOError as e:
            print e
            return None
    elif option == 'zigbee' or option == 1:
        pyzigbee.init()
        pymodule = pyzigbee
    print 'pynvc debugging'
    pymodule.setdebug(debug)
    return True
コード例 #6
0
ファイル: pynvc.py プロジェクト: HuangZhenQiu/NanoKong
def init(option, debug=False):
    global pymodule
    if option == 'zwave' or option == 0:
        try:
            pyzwave.init(ZWAVE_GATEWAY_IP)
            pymodule = pyzwave
        except IOError as e:
            print e
            return None
    elif option == 'zigbee' or option == 1:
        pyzigbee.init()
        pymodule = pyzigbee
    print 'pynvc debugging'
    pymodule.setdebug(debug)
    return True
コード例 #7
0
    def __init__(self):
        self._mode = 'stop'

        pyzwave.init(ZWAVE_GATEWAY_IP)

        TransportAgent.__init__(self)
コード例 #8
0
ファイル: transport.py プロジェクト: BigstarPie/WuKongProject
    def __init__(self):
        self._mode = 'stop'

        pyzwave.init(ZWAVE_GATEWAY_IP)

        TransportAgent.__init__(self)
コード例 #9
0
 def __init__(self, com_port):
     pyzwave.init(com_port)
コード例 #10
0
import sys

if len(sys.argv) < 2:
    print "Usagae: python testpyzwave.py port command..."
    print "\tcommand:"
    print "\t\treset\t: Factory reset controller"
    print "\t\tdiscover\t: Print discovered zwaveIDs"
    print "\t\tgetaddr\t: Get itself zwaveID"
    print "\t\tbasicset zwaveID value\t: Set certain value onto node with zwaveID"
    print "\t\tisnodefail zwaveID\t: Test if the node with zwaveID fails"
    print "\t\tremovefail zwaveID\t: Remove node with zwaveID if it fails"
    exit(-1)

pyzwave.setVerbose(0)
pyzwave.setdebug(0)
pyzwave.init(sys.argv[1])
gevent.sleep(1)

# print "sending packet"
# while True:
# 	pyzwave.send(5, [0x88]+[0, 19, 5, 2, 32, 2, 1, 0x1e])
# 	gevent.sleep(3)
# for i in [1,2,3,4,5]:
# 	print "got device type %s from device radio address %X" % (str(pyzwave.getDeviceType(i)), i)

if sys.argv[2] == "reset":
    print "-" * 10 + "pyzwave.hardReset"
    print str(pyzwave.hardReset())

elif sys.argv[2] == "discover":
    print "-" * 10 + "pyzwave.discover"
コード例 #11
0
ファイル: pynvc.py プロジェクト: HuangZhenQiu/NanoKong
def init():
  pyzwave.init(ZWAVE_GATEWAY_IP)