Skip to content

Commit

Permalink
Implement alert message handler
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Feb 6, 2024
1 parent ed97350 commit 9d8cbf6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions neon_iris/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ def handle_neon_response(self, channel, method, _, body):
self.handle_error_response(message)
elif message.msg_type == "neon.languages.get.response":
self._handle_supported_languages(message)
elif message.msg_type == "neon.alert_expired":
self.handle_alert(message)
elif message.msg_type.endswith(".response"):
self.handle_api_response(message)
else:
Expand Down Expand Up @@ -231,6 +233,12 @@ def clear_media(self, message: Message):
Override this method to handle requests to clear media (photos, etc)
"""

@abstractmethod
def handle_alert(self, message: Message):
"""
Override this method to handle alerts (timers, alarms, reminders)
"""

def _handle_profile_update(self, message: Message):
updated_profile = message.data["profile"]
if updated_profile['user']['username'] == \
Expand Down Expand Up @@ -469,6 +477,9 @@ def handle_api_response(self, message: Message):
def clear_caches(self, message: Message):
print("Cached Responses Cleared")

def handle_alert(self, message: Message):
print(f"\nAlert Expired: {message.data.get('alert_name')}")

def clear_media(self, message: Message):
pass

Expand Down

0 comments on commit 9d8cbf6

Please sign in to comment.