def __init__(self): super(Driver, self).__init__() self.options = openzwave.PyOptions() self.options.create("src/libs/ZwaveLib/config/", "src/libs/ZwaveLib/user/", "") self.options.lock() self.manager = openzwave.PyManager() self.manager.create() self.manager.addWatcher(self.receive) self.manager.addDriver( '/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0' ) self.actions = { "on": self._turnOn, "off": self._turnOff, "variate": self._variate, } self.notifications = { "NodeNew": self._updateNode, "NodeAdded": self._updateNode, "ValueAdded": self._updateValue, "ValueChanged": self._updateValue, }
def __init__(self): self._homeid = None self._controllerNodeId = None self._controller = None self._nodes = dict() options = openzwave.PyOptions() # TODO locate this... options.create("/home/steve/py-openzwave/openzwave/config/", "", "") options.lock() self._manager = openzwave.PyManager() self._manager.create() self._manager.addWatcher(self.zwcallback)
def __init__(self, device='/dev/keyspan-2', configDir="openzwave/config/"): """ calls will fail until the homeid is known. You may have to retry them. """ self.options = openzwave.PyOptions() # Specify the open-zwave config path here self.options.create(configDir, "", "") self.options.lock() self.manager = openzwave.PyManager() self.manager.create() self._homeId = None self.manager.addWatcher(self.callback) self.manager.addDriver(device)
def __init__( self, device='/dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_D-if00-port0', configDir="openzwave/config/"): """ calls will fail until the homeid is known. You may have to retry them. """ self.options = openzwave.PyOptions() # Specify the open-zwave config path here self.options.create(configDir, "", "") self.options.lock() self.manager = openzwave.PyManager() self.manager.create() self._homeId = None self.manager.addWatcher(self.callback) self.manager.addDriver(device)
def __init__(self, device, config, log=None): self._log = log if self._log is None: self._log = logging.getLogger(__name__) self._log.addHandler(NullHandler()) self._initialized = False self._homeId = None self._controllerNodeId = None self._controller = None self._nodes = dict() self._libraryTypeName = 'Unknown' self._libraryVersion = 'Unknown' self._device = device options = openzwave.PyOptions() options.create(config, '', '--logging false') options.lock() self._manager = openzwave.PyManager() self._manager.create() self._manager.addWatcher(self.zwcallback) self._manager.addDriver(device)
import openzwave from openzwave import PyManager options = openzwave.PyOptions() # Specify the open-zwave config path here options.create("openzwave/config/", "", "") options.lock() manager = openzwave.PyManager() manager.create() # callback order: (notificationtype, homeid, nodeid, ValueID, groupidx, event) def callback(args): print('\n%s\n[%s]:\n' % ('-' * 20, args['notificationType'])) if args: print('homeId: 0x%.8x' % args['homeId']) print('nodeId: %d' % args['nodeId']) v = args['valueId'] print('valueID: %s' % v['id']) if v.has_key('groupIndex') and v['groupIndex'] != 0xff: print('GroupIndex: %d' % v['groupIndex']) if v.has_key('event') and v['event'] != 0xff: print('Event: %d' % v['event']) if v.has_key('value'): print('Value: %s' % str(v['value'])) if v.has_key('label'): print('Label: %s' % v['label']) if v.has_key('units'): print('Units: %s' % v['units']) if v.has_key('readOnly'): print('ReadOnly: %s' % v['readOnly']) print('%s\n' % ('-' * 20, ))