WebThingsIO / schemas

A Web of Things schema repository
https://webthings.io/schemas/
5 stars 8 forks source link

NotificationAction #43

Closed tim-hellhake closed 4 years ago

tim-hellhake commented 5 years ago

As a user i would like trigger a notification on my device. The notification may contain a message of type string. It may also contain an urgency level like INFO or ALERT.

rzr commented 5 years ago

Could make sense, what do you have in mind ? Like a popup or log entry ?

May this relate to some (naives) experiments made using properties at: https://github.com/rzr/mastodon-lite/tree/master/example

raidnet-ms commented 5 years ago

What about Mozilla notification API?. In this way they would be shown on the operating system GUI of the client running the web browser.

tim-hellhake commented 5 years ago

Could make sense, what do you have in mind ? Like a popup or log entry ?

Actually something similar to what you have done. I'm currently working on an addon to send slack notifications. But i think actions are the appropriate choice for that.

tim-hellhake commented 5 years ago

What about Mozilla notification API?. In this way they would be shown on the operating system GUI of the client running the web browser.

It would be nice to have them but i think this would an ui thing. Im talking about connecting messaging services and devices which could present you a notification.

mrstegeman commented 5 years ago

This seems like it’s probably a duplicate of https://github.com/mozilla-iot/gateway/issues/1758

tim-hellhake commented 5 years ago

For webservices this is true. However, there are also devices which provide a notification mechanism.

benfrancis commented 5 years ago

However, there are also devices which provide a notification mechanism.

Can you provide examples?

This doesn't seem like an action performed on a physical device itself, rather a potential output of a rule performed with an external software service as a result of a change in state of the device.

tim-hellhake commented 5 years ago

https://lametric.com There would be one adapter which would discover n devices. Also the devices would have properties.

benfrancis commented 5 years ago

Some people have built web things with an LCD which has a string property you can set to display the string on the screen.

Perhaps I'm missing something but is the any particular reason this should be an action rather than a property?

mrstegeman commented 5 years ago

Notifications are typically temporary, so it makes sense for it to be an action. You could set a notification level and length. This seems kind of like an extension to the Alarm capability, in a way.

tim-hellhake commented 5 years ago

Additionally, they might be queued. Even if you could read the display contents it's not guaranteed that it's your notification.

benfrancis commented 5 years ago

OK, yes that is sounding more like an action.

A few of things to think about:

  1. The name of an action is usually contains a verb
  2. An action is usually something carried out on a device, rather than carried out on a user by a device (i.e. the device is the object, not the subject)
  3. The action schema should be generic enough to be widely applicable to a range of devices

So what's a good name for the kinds of use cases you have in mind? Maybe something like DisplayMessageAction?

And what kind of input should a Thing expect to the action? Just a simple string? Or is there some other input which would be widely applicable enough to be part of the schema? (e.g. For "level", are "info" and "alert" too arbitrary? We had a similar discussion about the AlarmCapability.

tim-hellhake commented 5 years ago

How about NotifyAction?

I think the message parameter should be required. As for the urgency level: The Desktop Notifications Specification specifies three urgency levels:

benfrancis commented 5 years ago

How about NotifyAction?

I would argue that would make the user the object rather than the device.

I think the message parameter should be required

Makes sense.

Note that Web Notifications have a title and a body (amongst many other types of metadata).

tim-hellhake commented 5 years ago

I see that's what you meant by

the device is the object

Well then DisplayMessageAction or better DisplayNotificationAction would be fine.

tim-hellhake commented 4 years ago

Fixed by https://github.com/mozilla-iot/gateway/issues/1758