Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Notifiers #38

Open
bewee opened this issue Jan 31, 2021 · 3 comments
Open

Support for Notifiers #38

bewee opened this issue Jan 31, 2021 · 3 comments
Labels
class Concerns one class only (things, sun, variables, ...) enhancement New feature or request

Comments

@bewee
Copy link
Owner

bewee commented Jan 31, 2021

It would be great if one could use macros to send notifications, just as rules can. This includes browser notifications as well as adapter specific notifications (as in #37).
Unfortunately, I have no clue how to implement this, and the W3C Web Thing API draft (where I looked up some stuff for the implementation of interaction with things) is not helpful this time. Maybe @mrstegeman can help?

@bewee bewee added the enhancement New feature or request label Jan 31, 2021
@mrstegeman
Copy link
Contributor

There is a REST API to create new notifications. However, it requires a user JWT, rather than an OAuth token, so it's not super practical for an add-on to use it.

Of note, though, is that the LG TV adapter (which I created) actually does have a separate action for the toast message, in addition to the notifier, so you could easily support that by adding support for action inputs.

https://github.com/WebThingsIO/lg-tv-adapter/blob/master/lib/lg-tv-device.js#L56-L64

@bewee
Copy link
Owner Author

bewee commented Feb 1, 2021

That sounds perfect! Then we should be able to get toasts for the LG TV adapter running soon.

However, I still think that notifiers are really worth implementing, so the problem with the user token remains.
#32 aims to add support for importing rules. I haven't yet had a look into this, but I guess this would require a user token too?
Another thing: I would like to be able to execute a macro externally (e.g. whenever my phone enters my home's WiFi, or an NFC tag was scanned). Best-case I would just have a link I can call up. Currently, I use curl to interact with the macrozilla extension API - which requires a user mode token too.
I don't know how much sense this makes, but may it be possible to add more versatile options for creating local authorizations to the gateway? So that you could say that the token you generate should also be able to make notifications, access rules or interact with extension APIs?
On the other hand, at the public meeting, it was also mentioned that it's not the most user-friendly procedure to have the user copy and paste a token into the add-on's config anyway. Maybe there's a different option to think about? What are your thoughts?

@mrstegeman
Copy link
Contributor

#32 aims to add support for importing rules. I haven't yet had a look into this, but I guess this would require a user token too?

You could technically do this by reading them directly from the database, if you're just importing.

Another thing: I would like to be able to execute a macro externally (e.g. whenever my phone enters my home's WiFi, or an NFC tag was scanned). Best-case I would just have a link I can call up. Currently, I use curl to interact with the macrozilla extension API - which requires a user mode token too.

Correct, this requires a user JWT.

I don't know how much sense this makes, but may it be possible to add more versatile options for creating local authorizations to the gateway? So that you could say that the token you generate should also be able to make notifications, access rules or interact with extension APIs?

That's an interesting question. This probably ties into WebThingsIO/gateway#787

On the other hand, at the public meeting, it was also mentioned that it's not the most user-friendly procedure to have the user copy and paste a token into the add-on's config anyway. Maybe there's a different option to think about? What are your thoughts?

See WebThingsIO/gateway#2249

@bewee bewee added the class Concerns one class only (things, sun, variables, ...) label Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
class Concerns one class only (things, sun, variables, ...) enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants