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.

Once the connection to the Insteon Modem is made, the IM class method connection_made is called.

Startup Process

IM Class

  • PLM Class

  • Hub Class

Clone this wiki locally