apearson / insteon-plm

Insteon PLM is a TypeScript/JavaScript library for the Insteon PowerLinc Modem family of devices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating Device Classes

apearson opened this issue · comments

What

Need to separate the device specific information and command into their own classes.

Why

This will simply the modem interface quite a bit, allowing each device to keep track of their own request queues, timeouts, and link databases. The modem class already contains some device specific commands that are useless on other devices.

How

  • Device Classes will use the sendRawCommand function on the modem.
  • Device Classes will listen to the modem's on events for replies.
  • Device Classes will have the following infomation
    • Address
    • Firmware Version
    • on()
    • toString() for debug
    • toJSON() for parsing all information
  • The modem class will either keep track of all devices in another array or will utilize link database 0 for storage of these devices. This allows the user of the library to talk directly to the device class instance.

Started this, closing for more specific issues