Skip to content

IM Class

Tom Harris edited this page Jun 12, 2018 · 12 revisions

Overview

The IM class is the an abstract class representing an Insteon Modem that handles reading and writing to the physical modem. The two concrete classes are:

The IM class inherits from the Insteon Device class and implements the asyncio.Protocol interface.

The IM class contains the following public properties:

  • devices: An instance of LinkedDevices that contains the list of Insteon and X10 devices that the IM can communicate to.
  • loop: The asyncio loop used to provide asynchronous handling of Insteon messages.
  • message_callbacks: An instance of MessageCallbacks used to define how inbound messages are processed by the module.

The IM class contains the following public methods:

  • connection_made: An asyncio.protocol interface method which is called after a connection is made to the physical device. The connection_made method takes the following parameters:

    • transport: An asyncio.transport object representing a communication transport to the physical device.
  • data_received: An asyncio.protocol interface method which is called when the underlying transport receives data from the physical device. The data_received method takes the following parameters:

    • data: A byte string of data received from the transport.
  • connection_lost: An asyncio.protocol interface method which is called after the connection to the physical device is lost. The connection_lost method takes the following parameters:

    • exc: The argument is either an exception or None. If None, a regular EOF has been received, or the connection was aborted or closed by this side of the connection.
  • add_device_callback: Used by the control software to register a callback which is called when a new device is added to the IM.devices list. During startup devices are added to the IM.devices list automatically from saved devices or from the links in the ALDB. The registered callback is called each time a new device is added. The add_device_callback method takes the following parameters:

    • callback: The method to callback when a new device is added. The registered callback must implement the following interface: callback(device)where device is an Insteon Device or an X10Device.
  • add_all_link_done_callback: Used by the control software to register a callback which is called when the All-Link database is loaded into the IM. The add_all_link_done_callback takes the following parameters:

    • callback: The method to callback when the All-Link database is fully loaded into the IM.aldb. The registered callback must implement the following interface: callback().
  • add_device_not_active_callback: Used by the control software to register a callback which is called when a device in the All-Link database does not respond to a device information request. During startup, each device is queried for its device information. If a device does not respond after five attempts, the device is determined to be unavailable and the registered callback is called to notify the control software of the unresponsive device. The add_all_link_done_callback takes the following parameters:

    • callback: The method to callback when a device is deemed to be unresponsive during startup. The callback implements the following interface: callback(device_address) where device_address is an Address instance representing the device's Insteon address.
  • poll_devices: Poll each device state for its status. The polling is an asynchronous process and therefore is non-blocking. This method is not a coroutine.

  • start_all_linking: Places the IM in linking mode. The start_all_linking method takes the following parameters:

    • mode: Determines if the mode is Responder, Controller, Either or Delete. Possible values of mode are 0 | 1 | 3 | 255
      • 0 - PLM is responder
      • 1 - PLM is controller
      • 3 - Device that initiated All-Linking is Controller
      • 255 = Delete All-Link
    • group : All-Link group number (0 - 255)

PLM Class

Hub Class

Startup Process

IM Class

  • PLM Class

  • Hub Class

Clone this wiki locally