Module: Alula::DeviceAttributeTranslations

Included in:
Device
Defined in:
lib/alula/helpers/device_attribute_translations.rb

Overview

Relies on the implementing class having reader properties of ‘program_id` and `auto_cfg`. Translates those values into usable strings

Constant Summary collapse

PROGRAM_ID_MAP =
{
  32 => 'CONNECT+',
  35 => 'BAT-FIRE',
  34 => 'BAT-CONNECT',
  211 => 'CLARE-D3',
  4096 => 'CAMERA',
  783 => 'BAT-LTE',
  0 => 'IPD-BAT',
  1 => 'IPD-BAT',
  2 => 'IPD-BAT',
  3 => 'IPD-BAT-ZKI',
  4 => 'IPD-BAT',
  8 => 'IPD-BAT',
  6 => 'IPD-ZGW',
  9 => 'IPD-BAT-U',
  11 => 'IPD-ZGW',
  15 => 'IPD-BAT-CDMA',
  16 => 'IPD-BAT-WIFI',
  17 => 'IPD-BAT-CDMA-L',
  18 => 'IPD-MPWC',
  19 => 'IPD-CAT-CDMA',
  20 => 'IPD-BAT-CDMA-WIFI',
  22 => 'IPD-CAT-XT',
  33 => 'IGM',
  271 => 'IPD-BAT-CDMA1'
}.freeze
PANEL_NAME_MAP =
{
  0 => 'Honeywell/Vista',
  1 => 'Honeywell/Vista+Passive',
  2 => 'Honeywell/Lynx',
  3 => 'Honeywell/Lynx+Passive',
  4 => 'DSC/Depricated',
  5 => 'GE-Interlogix/Caddx',
  6 => 'DSC/Alexor',
  7 => 'DSC/PowerSeries',
  8 => 'Dialer Capture or Keyswitch',
  9 => 'GE-Interlogix/Concord',
  10 => '',
  11 => 'Gateway',
  12 => 'GE Simon XT/XTi',
  13 => 'Cinch',
  14 => 'Helix',
  15 => 'Clare D3',
  19 => 'No Panel',
}.freeze

Instance Method Summary collapse

Instance Method Details

#device_nameObject



54
55
56
# File 'lib/alula/helpers/device_attribute_translations.rb', line 54

def device_name
  self.class::PROGRAM_ID_MAP[self.program_id] || "Unknown (#{self.program_id})"
end

#panel_nameObject

autoCfg contains multiple pieces of information depending on how you examine it. Doing a bitwise operation with 0xff takes the last 8 bits, which is the connected panel ID. ipdatatel.atlassian.net/wiki/spaces/SYS/pages/16482314/auto+cfg



63
64
65
66
# File 'lib/alula/helpers/device_attribute_translations.rb', line 63

def panel_name
  panel_id = auto_cfg.to_i & 0xff
  self.class::PANEL_NAME_MAP[panel_id] || "Unknown (#{panel_id})"
end