athombv / homey-web-api-issues

This issue tracker is for Homey Developers using the Web API.
4 stars 1 forks source link

Filtering Notifications and subscribing on new ones #10

Closed ismarslomic closed 5 years ago

ismarslomic commented 5 years ago

athom-api version: 2.1.196 Homey software version: 2.5.1

Use case Im trying to retrieve Notifications by using HomeyAPI in a reactive Web Application and can successfully retrieve those with Homey.notifications.getNotifications().

Usage question

  1. getNotifications() returns all notifications, where Im only interested in getting notifications after given date (for instance only for today). I can filter response myself, but the response is quite large which slows down request and processing time. This method takes a Notification as filter parameter, but I guess you cant use filter expressions?

  2. are there any possibilities to subscribe on Notifications and get these pushed, like using event emitters for device capabilities (makeCapabilityInstance())?

If the answer on these two questions is that it is not possible to filter on dateCreated property and it is not possible to subscribe on new notifications, it will mean that I need to do polling every 5 seconds or so (as Notifications are important to me) and potentially unnecessary overload HomeyAPI - and deal with slow performance.

I would like some advices from the Athom core team on this.

ismarslomic commented 5 years ago

Sharing response from @WeeJeWel on Slack: Q1 no Q2 yes, Homey.notifications.on('notification.create', notification => {})

Hope this is useful. Closing the issue.