Skip to content

Startup Process

Tom Harris edited this page Jun 9, 2018 · 11 revisions

To startup up the InsteonPLM module create a call to insteonplm.Connection.create. Ideally this is wrapped in an asyncio loop. A simple startup example would be:

import asyncio
import insteonplm


@asyncio.coroutine
def start_insteonplm(loop):
    connection = yield from insteonplm.Connection.create(
            device='/dev/some_device',
            loop=loop)


loop = asyncio.get_event_loop()
asyncio.ensure_future(start_insteonplm(loop))
loop.run_forever()

insteonplm.Connection.create returns a Connection class and 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 Connection class 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 an aiohttp HTTP transport.

The `Connection class supports the following methods:

Startup Process

IM Class

  • PLM Class

  • Hub Class

Clone this wiki locally