diff --git a/examples/alarm_email.py b/examples/alarm_email.py index 87ee83a..bc9ed46 100644 --- a/examples/alarm_email.py +++ b/examples/alarm_email.py @@ -26,9 +26,6 @@ def main(): device.on_alarm += handle_alarm device.open() - # Retrieve the device configuration - device.get_config() - # Wait for events while True: time.sleep(1) diff --git a/examples/basics.py b/examples/basics.py index 3ce9073..701765e 100644 --- a/examples/basics.py +++ b/examples/basics.py @@ -13,7 +13,6 @@ def main(): # Set up an event handler and open the device device.on_message += handle_message device.open() - device.get_config() # Wait for events. while True: diff --git a/examples/rf_device.py b/examples/rf_device.py index 23f30bd..0d76321 100644 --- a/examples/rf_device.py +++ b/examples/rf_device.py @@ -23,7 +23,6 @@ def main(): # Set up an event handler and open the device device.on_rfx_message += handle_rfx device.open() - device.get_config() # Wait for events. while True: diff --git a/examples/serialport.py b/examples/serialport.py index 583d39c..e2420ae 100644 --- a/examples/serialport.py +++ b/examples/serialport.py @@ -17,7 +17,6 @@ def main(): # Set up an event handler and open the device device.on_message += handle_message device.open(baudrate=BAUDRATE) # Override the default SerialDevice baudrate. - device.get_config() # Wait for events. while True: diff --git a/examples/socket_example.py b/examples/socket_example.py index f0fb4e2..fec811f 100644 --- a/examples/socket_example.py +++ b/examples/socket_example.py @@ -18,7 +18,6 @@ def main(): # Set up an event handler and open the device device.on_message += handle_message device.open() - device.get_config() # Wait for events. while True: diff --git a/examples/ssl_socket.py b/examples/ssl_socket.py index d6eff02..e93d345 100644 --- a/examples/ssl_socket.py +++ b/examples/ssl_socket.py @@ -33,9 +33,6 @@ def main(): device.on_message += handle_message device.open() - time.sleep(1) # Allow time for SSL handshake to complete. - device.get_config() - # Wait for events. while True: time.sleep(1) diff --git a/examples/virtual_zone_expander.py b/examples/virtual_zone_expander.py index 930eef3..1cdcecb 100644 --- a/examples/virtual_zone_expander.py +++ b/examples/virtual_zone_expander.py @@ -35,7 +35,6 @@ def main(): device.on_zone_restore += handle_zone_restore device.open() - device.get_config() # Wait for events. last_update = time.time() diff --git a/pyad2/ad2.py b/pyad2/ad2.py index d7c8f6e..f937e09 100644 --- a/pyad2/ad2.py +++ b/pyad2/ad2.py @@ -105,6 +105,7 @@ class AD2(object): """ self._wire_events() self._device.open(baudrate=baudrate, no_reader_thread=no_reader_thread) + self.get_config() def close(self): """ diff --git a/pyad2/devices.py b/pyad2/devices.py index 927b397..4938428 100644 --- a/pyad2/devices.py +++ b/pyad2/devices.py @@ -880,6 +880,9 @@ class SocketDevice(Device): self._device.connect((self._host, self._port)) + if self._use_ssl: + self._device.do_handshake() + self._id = '{0}:{1}'.format(self._host, self._port) except socket.error, err: