Page 1 of 1

Failed to open the device: 'AlarmDecoder' object has no attr

PostPosted: Tue May 15, 2018 10:43 pm
by wls-canada
Having a very old version of the webapp for an AD2USB, I installed the latest from Git https://github.com/nutechsoftware/alarmdecoder-webapp

However, after setting the AlarmDecoder settings, Device Testing fails thus:

Opening device ✘ Failed to open the device: 'AlarmDecoder' object has no attribute 'on_ready_changed'
Saving device configuration ✘ There was an error sending the command to the device.
Keypad communication (Send) ✘ There was an error sending the command to the device.
Keypad communication (Receive) ✘ There was an error sending the command to the device.

I can't find anything on that first critical bit... here is the gunicorn log

May 16 02:35:45 flamen gunicorn[16065]: ERROR in decoder [/opt/alarmdecoder-webapp/ad2web/decoder.py:927]:
May 16 02:35:45 flamen gunicorn[16065]: Error while testing device open.
May 16 02:35:45 flamen gunicorn[16065]: --------------------------------------------------------------------------------
May 16 02:35:45 flamen gunicorn[16065]: Traceback (most recent call last):
May 16 02:35:45 flamen gunicorn[16065]: File "/opt/alarmdecoder-webapp/ad2web/decoder.py", line 919, in _test_open
May 16 02:35:45 flamen gunicorn[16065]: self._alarmdecoder.open()
May 16 02:35:45 flamen gunicorn[16065]: File "/opt/alarmdecoder-webapp/ad2web/decoder.py", line 292, in open
May 16 02:35:45 flamen gunicorn[16065]: self.bind_events()
May 16 02:35:45 flamen gunicorn[16065]: File "/opt/alarmdecoder-webapp/ad2web/decoder.py", line 323, in bind_events
May 16 02:35:45 flamen gunicorn[16065]: self.device.on_ready_changed += build_message_handler('ready')
May 16 02:35:45 flamen gunicorn[16065]: AttributeError: 'AlarmDecoder' object has no attribute 'on_ready_changed'

Re: Failed to open the device: 'AlarmDecoder' object has no

PostPosted: Wed May 16, 2018 12:06 am
by wls-canada
Found the problem in https://github.com/nutechsoftware/alarmdecoder

The pip install for alarmdecoder installs an older version that does not have the class definitions for the latest alarmdecoder-webapp. I had to go to the source.

Re: Failed to open the device: 'AlarmDecoder' object has no

PostPosted: Wed May 16, 2018 8:24 pm
by jasonsf
Can you give some detail on how you fixed this. I'm using the current docker image and getting the same issue. I'm not familiar enough with python.pip to know what the solution is.

Jason

EDIT: After looking a bit more, I don't think I'm having the same issue. I didn't instal Alarmdecoder through pip. I have the latest from the git repo.

Re: Failed to open the device: 'AlarmDecoder' object has no

PostPosted: Fri May 18, 2018 8:55 am
by wls-canada
Jason,

I'm no python programmer either, but take a look in your alarmdecoder source for decoder.py, for the class AlarmDecoder(object) definition. Verify that you see the on_ready_ changed. (Note, this is a different file than the similarly-named decoder.py that exists in your webapp source).

Code: Select all
class AlarmDecoder(object):
    """
    High-level wrapper around `AlarmDecoder`_ (AD2) devices.
    """

    # High-level Events
    on_arm = event.Event("This event is called when the panel is armed.\n\n**Callback definition:** *def callback(device, stay)*")
    on_disarm = event.Event("This event is called when the panel is disarmed.\n\n**Callback definition:** *def callback(device)*")
    on_power_changed = event.Event("This event is called when panel power switches between AC and DC.\n\n**Callback definition:** *def callback(device, status)*")
    on_ready_changed = event.Event("This event is called when panel ready state changes.\n\n**Callback definition:** *def callback(device, status)*")

Re: Failed to open the device: 'AlarmDecoder' object has no

PostPosted: Sun May 20, 2018 11:08 am
by jasonsf
Thanks for the response, wls-canada. I've reinstalled from the pre-configured docker image and am getting a different issue now. I posted here: viewtopic.php?f=3&t=809

Jason