ParadoxAlarmInterface / pai

Paradox Magellan, Spectra and EVO, with MQTT, Signal, Pushbullet, Pushover and others
https://gitter.im/paradox-alarm-interface
Eclipse Public License 2.0
351 stars 94 forks source link

ERROR: Caught exception in on_disconnect: _on_disconnect_cb() takes 4 positional arguments but 5 were given #280

Closed fdcastel closed 6 months ago

fdcastel commented 2 years ago

Alarm system

EVO192 + IP150

Environment

Describe the bug

I did notice the following error every time I stop my pai docker container:

ERROR    - PAI.paradox.interfaces.mqtt.core - Caught exception in on_disconnect: _on_disconnect_cb() takes 4 positional arguments but 5 were given: _on_disconnect_cb() takes 4 positional arguments but 5 were given

It seems to be harmless, except for the log spam.

To Reproduce

  1. Start docker container
  2. Stop docker container

Logs (redacted)

Attempting to load configuration from /etc/pai/pai.conf
2022-02-10 15:36:42,732 - INFO     - PAI - Starting Paradox Alarm Interface 2.7.1
2022-02-10 15:36:42,732 - INFO     - PAI - Config loaded from /etc/pai/pai.conf
2022-02-10 15:36:42,732 - INFO     - PAI - Console Log level set to 20
2022-02-10 15:36:42,752 - INFO     - PAI.paradox.interfaces - Starting BasicMQTTInterface Interface
2022-02-10 15:36:42,753 - INFO     - PAI.paradox.interfaces.mqtt.core - MQTT loop started
2022-02-10 15:36:42,754 - INFO     - PAI.paradox.interfaces - Starting HomeAssistantMQTTInterface Interface
2022-02-10 15:36:42,754 - INFO     - PAI - Starting...
2022-02-10 15:36:42,754 - INFO     - PAI.paradox.paradox - Connecting to interface
2022-02-10 15:36:42,754 - INFO     - PAI.paradox.paradox - Using IP Connection
2022-02-10 15:36:42,800 - INFO     - PAI.paradox.connections.ip.connection - Connecting. Try 1/3
2022-02-10 15:36:42,801 - INFO     - PAI.paradox.connections.connection - Connection established
2022-02-10 15:36:42,801 - INFO     - PAI.paradox.connections.ip.commands - Authenticating with IP Module
2022-02-10 15:36:42,803 - INFO     - PAI.paradox.connections.ip.commands - Authentication Success. IP(IP150) Module version 20, firmware: 1.34, serial: ********
2022-02-10 15:36:42,810 - INFO     - PAI.paradox.connections.ip.commands - Session successfully established with IP Module
2022-02-10 15:36:42,810 - INFO     - PAI.paradox.paradox - Connecting to Panel
2022-02-10 15:36:42,833 - INFO     - PAI.paradox.paradox - Panel Identified EVO192 version 7.52 build 1
2022-02-10 15:36:42,833 - INFO     - PAI.paradox.paradox - Initiating panel connection
2022-02-10 15:36:42,865 - INFO     - PAI.paradox.hardware.evo.panel - Installer login
2022-02-10 15:36:42,885 - INFO     - PAI.paradox.hardware.evo.panel - Authentication Success
2022-02-10 15:36:42,886 - INFO     - PAI.paradox.paradox - Connection OK
2022-02-10 15:36:42,886 - INFO     - PAI.paradox.paradox - Loading data from panel memory
2022-02-10 15:36:42,886 - INFO     - PAI.paradox.hardware.panel - Loading definitions
2022-02-10 15:36:42,886 - INFO     - PAI.paradox.hardware.panel - Updating Definitions from Panel
2022-02-10 15:36:43,112 - INFO     - PAI.paradox.hardware.panel - Zone definitions loaded (0.23s)
2022-02-10 15:36:43,123 - INFO     - PAI.paradox.hardware.panel - Partition definitions loaded (0.01s)
2022-02-10 15:36:43,789 - INFO     - PAI.paradox.interfaces.mqtt.core - MQTT Broker Connected
2022-02-10 15:36:47,680 - INFO     - PAI.paradox.hardware.panel - User definitions loaded (4.56s)
2022-02-10 15:36:47,743 - INFO     - PAI.paradox.hardware.panel - Loading labels
2022-02-10 15:36:47,743 - INFO     - PAI.paradox.hardware.panel - Updating Labels from Panel
2022-02-10 15:36:47,865 - INFO     - PAI.paradox.hardware.panel - Zone labels loaded (0.12s): ************************
2022-02-10 15:36:47,865 - INFO     - PAI.paradox.hardware.panel - Pgm labels loaded (0.0s):
2022-02-10 15:36:47,893 - INFO     - PAI.paradox.hardware.panel - Partition labels loaded (0.03s): ********, ********
2022-02-10 15:36:47,911 - INFO     - PAI.paradox.hardware.panel - User labels loaded (0.02s): ********, ********
2022-02-10 15:36:49,614 - INFO     - PAI.paradox.hardware.panel - Module labels loaded (1.7s): ****************************************
2022-02-10 15:36:49,614 - INFO     - PAI.paradox.hardware.panel - Door labels loaded (0.0s):
2022-02-10 15:36:49,614 - INFO     - PAI.paradox.paradox - Running
2022-02-10 16:07:11,980 - ERROR    - PAI.paradox.lib.handlers - No handler for message 4
Detail: Container:
    fields = Container:
        data = b'G\x80\x00\x009\x00' (total 6)
        value = Container:
            po = Container:
                command = 4
                status = Container:
                    reserved = False
                    alarm_reporting_pending = True
                    Winload_connected = True
                    NeWare_connected = True
            packet_length = 128
        offset1 = 0
        offset2 = 6
        length = 6
    checksum = b'\x00' (total 1)
2022-02-10 16:41:52,604 - ERROR    - PAI.paradox.hardware.evo.panel - ChecksumError Error in path (parsing) -> checksum
wrong checksum, read b'00', computed b'c9', message: b'4780000002000000000000808000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
2022-02-10 18:53:58,526 - ERROR    - PAI.paradox.hardware.evo.panel - ChecksumError Error in path (parsing) -> checksum
wrong checksum, read b'00', computed b'c9', message: b'4780000002000000000000808000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'

Then, after stopping docker container:

2022-02-10 19:56:44,687 - INFO     - PAI - Captured signal SIGTERM. Exiting
2022-02-10 19:56:44,687 - INFO     - PAI.paradox.paradox - Disconnecting from the Alarm Panel
2022-02-10 19:56:44,688 - INFO     - PAI.paradox.paradox - Clean Session
2022-02-10 19:56:44,688 - INFO     - PAI.paradox.paradox - Cleaning previous session. Closing connection
2022-02-10 19:56:44,688 - ERROR    - PAI.paradox.connections.protocols - Connection was closed: None
2022-02-10 19:56:44,689 - ERROR    - PAI.paradox.connections.connection - Connection was lost
2022-02-10 19:56:44,689 - INFO     - PAI.paradox.paradox - Disconnected from the Alarm Panel
2022-02-10 19:56:44,692 - INFO     - PAI.paradox.interfaces.interface_manager - Stopping all interfaces
2022-02-10 19:56:44,692 - INFO     - PAI.paradox.interfaces.interface_manager - Stopping BasicMQTTInterface
2022-02-10 19:56:44,693 - INFO     - PAI.paradox.interfaces.interface_manager - Stopping HomeAssistantMQTTInterface
2022-02-10 19:56:44,693 - ERROR    - PAI.paradox.interfaces.mqtt.core - Caught exception in on_disconnect: _on_disconnect_cb() takes 4 positional arguments but 5 were given: _on_disconnect_cb() takes 4 positional arguments but 5 were given
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3591, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
    rc = self._loop(timeout)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1181, in _loop
    rc = self.loop_write()
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1577, in loop_write
    rc = self._packet_write()
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 2504, in _packet_write
    self._do_on_disconnect(MQTT_ERR_SUCCESS)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3472, in _do_on_disconnect
    on_disconnect(
TypeError: _on_disconnect_cb() takes 4 positional arguments but 5 were given
2022-02-10 19:56:44,700 - INFO     - PAI.paradox.interfaces.mqtt.core - MQTT loop stopped
2022-02-10 19:56:44,700 - INFO     - PAI - Good bye!
fdcastel commented 2 years ago

@yozik04 🙌

yozik04 commented 2 years ago

Only in dev for now. =)

fdcastel commented 2 years ago

Hehehe. I understand. Thanks anyway for the quick fix. 😄

I will wait for the next release.

P.s.: You guys rock! Thank you for the fantastic work!!!

yozik04 commented 2 years ago

It is quite tough with next release as branches have diverged too much and I do not like some parts in dev still to decide to merge it finally.

erpalma commented 2 years ago

I guess this issue is still not fixed by c67ee36aa. I'm on dev and I get:

TypeError: MQTTConnection._on_disconnect_cb() takes from 3 to 4 positional arguments but 5 were given

yozik04 commented 6 months ago

I think it was fixed a long time ago.

fdcastel commented 6 months ago

@yozik04 Sorry to be the bearer of bad news but I've been using 3.4.0 for some months now, and the problem still persists.

Some examples:

2024-03-30 11:16:40,919 - ERROR    - PAI.paradox.hardware.evo.panel - ChecksumError Error in path (parsing) -> checksum
wrong checksum, read b'00', computed b'cd', message: b'4780000006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
2024-03-30 14:12:28,917 - ERROR    - PAI.paradox.hardware.evo.panel - ChecksumError Error in path (parsing) -> checksum
wrong checksum, read b'00', computed b'ca', message: b'4780000003000000000000000000000000000000000000000000000000000000000000000000010000001f00010000001f00010000000000010000000000010000000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
2024-03-30 15:09:12,004 - ERROR    - PAI.paradox.hardware.evo.panel - ChecksumError Error in path (parsing) -> checksum
wrong checksum, read b'00', computed b'cb', message: b'478000000400000000000100000000000100000000003d09a5063d0900000000000000000000000000000000000000000000000000000000000000000000000000000000005652525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252'
2024-03-30 15:21:32,854 - ERROR    - PAI.paradox.hardware.evo.panel - ChecksumError Error in path (parsing) -> checksum
wrong checksum, read b'00', computed b'cc', message: b'4780000005000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
2024-03-30 17:43:19,288 - ERROR    - PAI.paradox.hardware.evo.panel - ChecksumError Error in path (parsing) -> checksum
wrong checksum, read b'00', computed b'cf', message: b'4780000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
2024-03-30 18:17:11,157 - ERROR    - PAI.paradox.hardware.evo.panel - ChecksumError Error in path (parsing) -> checksum
wrong checksum, read b'00', computed b'd2', message: b'478000000b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002403030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303'
2024-03-29 21:15:01,901 - ERROR    - PAI.paradox.lib.handlers - No handler for message 5
Detail: Container:
    fields = Container:
        data = b'RG\x80\x00\x00\x10\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00'... (truncated, total 70)
        value = Container:
            po = Container:
                command = 5
                status = Container:
                    reserved = False
                    alarm_reporting_pending = False
                    Winload_connected = True
                    NeWare_connected = False
            packet_length = 71
            control = Container:
                ram_access = True
            bus_address = 0
            address = 16
            data = b'\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'... (truncated, total 64)
        offset1 = 0
        offset2 = 70
        length = 70
    checksum = b'O' (total 1)
fdcastel commented 6 months ago

Sorry. My bad. The errors above are actually related to #126 and #427.

The original problem of this issue appears to be fixed. I don't have any occurences of

ERROR    - PAI.paradox.interfaces.mqtt.core - Caught exception in on_disconnect: _on_disconnect_cb() takes 4 positional arguments but 5 were given: _on_disconnect_cb() takes 4 positional arguments but 5 were given

anymore.

Thanks for the great work!