UniversalDevicesInc-PG3 / udi-poly-ELK

MIT License
2 stars 1 forks source link

Fix support for All Alarm Status #71

Closed jimboca closed 2 years ago

jimboca commented 2 years ago
2022-03-06 15:47:01,440 Thread-3   udi_interface      INFO     Area:callback: area_1:Area 1: cs={'alarm_state': ';', 'alarm_memory': '1', 'arm_up_state': '0'}
2022-03-06 15:47:01,440 Thread-3   udi_interface      INFO     Area:set_alarm_state: area_1:Area 1: ;
2022-03-06 15:47:01,441 Thread-3   elkm1_lib.elk      ERROR    elk:_got_data: Invalid message '1EAS0000000001111111;00000000004'
Traceback (most recent call last):
  File "/var/polyglot/.local/lib/python3.8/site-packages/elkm1_lib/message.py", line 67, in decode
    self.call_handlers(cmd, decoder(msg))
  File "/var/polyglot/.local/lib/python3.8/site-packages/elkm1_lib/message.py", line 55, in call_handlers
    handler(**decoded_msg)
  File "/var/polyglot/.local/lib/python3.8/site-packages/elkm1_lib/areas.py", line 80, in _as_handler
    area.setattr("alarm_state", alarm_states[area.index], True)
  File "/var/polyglot/.local/lib/python3.8/site-packages/elkm1_lib/elements.py", line 56, in setattr
    self._call_callbacks()
  File "/var/polyglot/.local/lib/python3.8/site-packages/elkm1_lib/elements.py", line 45, in _call_callbacks
    callback(self, self._changeset)
  File "/var/polyglot/pg3/ns/00:0d:b9:53:c6:f0_4/nodes/Area.py", line 88, in callback
    self.set_alarm_state(changeset['alarm_state'])
  File "/var/polyglot/pg3/ns/00:0d:b9:53:c6:f0_4/nodes/Area.py", line 171, in set_alarm_state
    val = self.elk.alarm_state if val is None else int(val)
ValueError: invalid literal for int() with base 10: ';'

The above exception was the direct cause of the following exception:

From ELK-M1_RS232_PROTOCOL.pdf 4.2.13 Reply - Arming Status Report (AS) ‘0’ No Alarm Active M1 Control RS-232 ASCII String Protocol Page 12 of 58 Rev. 1.86 Mar 6, 2017 ‘1’ Entrance Delay is Active ‘2’ Alarm Abort Delay Active ‘3’ to ‘B’ Area is in Full Alarm, see ASCII alarm table values below: FireAlarm = ‘3’, MedicalAlarm = ‘4’, PoliceAlarm = ‘5’, BurglarAlarm = ‘6’, Aux1Alarm = ‘7’, Aux2Alarm = ‘8’, Aux3Alarm = ‘9’, //not used Aux4Alarm = ‘:’, //not used CarbonMonoxideAlarm = ‘;’, EmergencyAlarm = ‘<’, FreezeAlarm= ‘=’, GasAlarm = ‘>’, HeatAlarm = ‘?’, WaterAlarm = ‘@’, FireSupervisory = ‘A’, VerifyFire = ‘B’,