-
Notifications
You must be signed in to change notification settings - Fork 19
Connection class
Tom Harris edited this page Jun 9, 2018
·
4 revisions
The Connection class is an asyncio.transport
class. Specifically it is either a serial.aio
class if the Insteon Modem is a PLM or a aiohttp.trasport
class if the Inteon Modem is a Hub. It has the following properties:
- device: The posix path to the PLM USB or serial port.
- host: The host name or IP address of the Hub
- password: The local connection password of the Hub
- port: The IP port number of the Hub
- protocol: An asyncio Protocolclass. This is also the Insteon Modem (i.e. PLM or Hub)
- username: The local connection username of the Hub
-
transport: An asyncio Transport. This is either a
serial.aio
serial transport or a custominsteonplm.HttpTransport
.
The `Connection class supports the following methods:
create
is a factory method and returns a Connection
class. It accepts the following parameters:
- auto_reconnect: Boolean value to tell the Connection class to reconnect if the connection is lost
- device: path to the USB or serial port where the PLM device is attached. The default is '/dev/ttyUSB0'
- host: Host name or IP address of a Hub. If this parameter is set, the module assumes the Insteon Modem is a hub even if the device parameter is set above.
- loop: asyncio loop.
- password: Password of the local Hub connection.
- port: IP port number for the Hub connection. Default is 25105.
- username: Username of the local Hub connection.
-
workdir: Working director to store the device information found during startup. If this value is set a file will be saved in this directory called
insteon_plm_device_info.dat
. This file will be read on subsequent startups to improve startup time. - poll_devices: Boolean value to tell the Insteon Modem to poll the device status.
The close
method closes the protocol
transport
. In other words it closes the serial connection to the PLM or the HTTP session to the Hub.
The halt
method closes the protocol
transport
and prevents reconnecting until a resume
call is made.
The resume
method allows the protocol.transport
to reconnect after a halt
command is sent.
Startup Process
IM Class
-
PLM Class
-
Hub Class