-
Notifications
You must be signed in to change notification settings - Fork 19
IM Class
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
LinkedDevicesthat 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
MessageCallbacksused to define how inbound messages are processed by the module.
The IM class contains the following public methods:
-
connection_made: An
asyncio.protocolinterface method which is called after a connection is made to the physical device. Theconnection_mademethod takes the following parameters:-
transport: An
asyncio.transportobject representing a communication transport to the physical device.
-
transport: An
-
data_received: An
asyncio.protocolinterface method which is called when the underlying transport receives data from the physical device. Thedata_receivedmethod takes the following parameters:-
data: A byte string of data received from the
transport.
-
data: A byte string of data received from the
-
connection_lost: An
asyncio.protocolinterface method which is called after the connection to the physical device is lost. Theconnection_lostmethod 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.deviceslist. During startup devices are added to theIM.deviceslist automatically from saved devices or from the links in the ALDB. The registered callback is called each time a new device is added. Theadd_device_callbackmethod 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)wheredeviceis an InsteonDeviceor anX10Device.
-
callback: The method to callback when a new device is added. The registered callback must implement the following interface:
-
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_callbacktakes 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().
-
callback: The method to callback when the All-Link database is fully loaded into the
-
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_callbacktakes 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)wheredevice_addressis anAddressinstance representing the device's Insteon address.
-
callback: The method to callback when a device is deemed to be unresponsive during startup. The callback implements the following interface:
-
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.
-
send_msg: Send an Insteon message to the IM or device. The message is place in a send queue which is cycled through asynchronously. Messages are sent from the queue in the order they are entered (FIFO) This method is non-blocking and this method is not a coroutine. The
send_msgmethod takes the following parameters:-
msg: An Insteon
Messageinstance that represents the message to send. -
wait_nak: (Optional) Instructs the
IMclass to wait for an ACK/NAK response from the PLM. The default isTrue. If an ACK or a NAK is not received from the IM, the assumption is made that the message was not sent and the message is put back in the send queue. -
wait_timeout: (Optional) Instructs the
IMclass to waitnnumber of seconds, or partial seconds, for an ACK or a NAK response from the IM. If no ACK or NAK message is received within thewait_timeoutperiod, the message is assumed to have not been sent and the message is placed back in the send queue. The default value is1.5seconds.
-
msg: An Insteon
-
start_all_linking: Places the IM in linking mode. The
start_all_linkingmethod takes the following parameters:-
mode: Determines if the mode is Responder, Controller, Either or Delete. Possible values of
modeare 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)
-
mode: Determines if the mode is Responder, Controller, Either or Delete. Possible values of
-
add_x10_device: Add an X10 device to the
IM.deviceslist. Theadd_x10_devicemethod takes- housecode: The X10 houscode (A - P)
- unitcode: The X10 unitcode (1 - 16)
-
feature: The X10 feature set to support. The default feature code is
OnOffThe available feature sets are:-
OnOff: A device which supports
onandoffcommands. -
Dimmable: A device which supports
on,off,brightanddimcommands. -
Sensor: A device that sends
onandoffcommands. -
AllUnitsOff: A device that sends the
all_units_offcommand -
AllLightsOn: A device that sends the
all_lights_oncommand -
AllLightsOff: A device that sends the
all_lights_offcommand
-
OnOff: A device which supports
Startup Process
IM Class
-
PLM Class
-
Hub Class