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
347 stars 92 forks source link

KeyError: 'devices' when enabling Pushover notifications #299

Closed ovidiulixandru closed 2 years ago

ovidiulixandru commented 2 years ago

Alarm system

Magellan MG5050 version 4.84, IP150+ firmware 5.5

Environment

PAI HASS add-on on a self-hosted HASS.io KVM VM, latest versions available for each

Git branch

3.0.1

Describe the bug

Can't make Pushover integration to work. When PAI tries to send a notification, it outputs an exception in the log and nothing gets sent.

To Reproduce

Steps to reproduce the behavior:

  1. Configure Pushover notifications as per wiki:
    PUSHOVER_KEY: my_pushover_app_key
    PUSHOVER_ENABLE: true
    PUSHOVER_MIN_EVENT_LEVEL: INFO
    PUSHOVER_EVENT_FILTERS:
    - live,alarm,-restore
    - live,trouble,-clock
    - live,tamper
    - live,fire
    - disarm
    - arm
    PUSHOVER_BROADCAST_KEYS:
    - user_key: my_pushover_user_key
    - devices: '*'

my_app_key and my_user_key are the keys generated in the Pushover settings (individual user, paid account).

  1. Trigger an event
  2. See error in log

Logs

2022-06-02 15:31:05,578 - ERROR    - PAI.paradox.exceptions - Unhandled exception in async loop(<_UnixSelectorEventLoop running=True closed=False debug=False>): 'devices'
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/paradox/lib/ps.py", line 58, in sendMessage
    return await asyncio.gather(
  File "/usr/local/lib/python3.9/site-packages/paradox/lib/ps.py", line 28, in call
    result = self.callback(**kwargs2)
  File "/usr/local/lib/python3.9/site-packages/paradox/interfaces/text/core.py", line 45, in handle_panel_event
    self.send_message(event.message, event.level)
  File "/usr/local/lib/python3.9/site-packages/paradox/interfaces/text/pushover.py", line 51, in send_message
    devices_raw = settings["devices"]
KeyError: 'devices'
Task exception was never retrieved
future: <Task finished name='Task-4912' coro=<PubSub.sendMessage() done, defined at /usr/local/lib/python3.9/site-packages/paradox/lib/ps.py:57> exception=KeyError('devices')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/paradox/lib/ps.py", line 58, in sendMessage
    return await asyncio.gather(
  File "/usr/local/lib/python3.9/site-packages/paradox/lib/ps.py", line 28, in call
    result = self.callback(**kwargs2)
  File "/usr/local/lib/python3.9/site-packages/paradox/interfaces/text/core.py", line 45, in handle_panel_event
    self.send_message(event.message, event.level)
  File "/usr/local/lib/python3.9/site-packages/paradox/interfaces/text/pushover.py", line 51, in send_message
    devices_raw = settings["devices"]
KeyError: 'devices'
yozik04 commented 2 years ago

I guess you have solved the issue?

ovidiulixandru commented 2 years ago

Yep, thank you, it was an extra dash which caused it. Should have been

PUSHOVER_BROADCAST_KEYS:
  - user_key: my_pushover_user_key
    devices: '*'

instead of

PUSHOVER_BROADCAST_KEYS:
  - user_key: my_pushover_user_key
  - devices: '*'

Small, but important mistake. Cheers and have a great weekend!