Push Notification - Printable Version +- SIP (https://nosack.com/sipforum) +-- Forum: SIP (Sustainable Irrigation Platform) (https://nosack.com/sipforum/forumdisplay.php?fid=1) +--- Forum: Plugin suggestions (https://nosack.com/sipforum/forumdisplay.php?fid=7) +--- Thread: Push Notification (/showthread.php?tid=72) |
Push Notification - chrisbaer10 - 2017 Apr 19 I'm going to try to start working on a push notification plugin... has anyone else done this? I use Pushover (there are many other options) and they have an API and python library, so just have to put it all together... https://github.com/Thibauth/python-pushover RE: Push Notification - dan - 2017 Apr 19 Hi Chris, Sounds interesting. I'm not aware of anyone else using pushover with SIP. How would it be used? There is already blinker included with SIP that provides notifications as demonstrated in the signaling_examples.py in the plugins directory. There is also an MQTT suite of plugins that can provide communication between different devices and even with a JavaScript client using websockets. Dan RE: Push Notification - chrisbaer10 - 2017 Apr 19 (2017 Apr 19, 02:42 PM)dan Wrote: Hi Chris,Hey Dan - I put a few files together following your proto example, but also needed to add a new blinker event for "station_completed" in helpers.py: station_completed = signal('station_completed') def report_station_completed(txt=None): """ Send blinker signal indicating that station has completed. """ station_completed.send() Then I added the report_station_completed function in the section that adds the logging. lines = [] report_station_completed() lines.append(logline + '\n') Attached are the new plugin python file and the html template. Edit: Can't figure out how to attach python file. Here's the contents: Code: # !/usr/bin/env python This also requires you do the following steps beforehand: pip install python-pushover root@baergarden:~# cat /root/.pushoverrc [Default] api_token=<your_api_key> user_key=<your_user_key> As you can see in the python file, I was only really interested in getting push notifications from certain stations. Ideally this would be read from the config file, but I think I would need to add an attribute to a json config in data. Work in progress... but figured I would show you what I was doing to see if you had any suggestions. Let me know what you think. Chris RE: Push Notification - dan - 2017 Apr 20 Cool! I'll take a look and get back to you. I will be traveling for a couple of days so it won't be till I get back. Dan RE: Push Notification - dan - 2017 Apr 23 I loaded your plugin and was able to access the set-up page but only after a couple of tweaks. Initially python would not load "from pushover import Client". I'm not sure what the problem is since I could load it from the Python command line. I changed the import to "import pushover" and changed each "Client" reference to "pushover.Client" then it worked. Also in the "urls.extend" function on line 16 of pushover.py I had to change both references from "pushoverNotif" to "pushover" to get the setup page to load. It looks like you are off to a great start and I think this will be a very useful plugin. I will add the "station_completed" blinker event to the main SIP branch on GitHub. Let me know if there any other events that would be useful. Perhaps the config for your plugin could offer a list of events that a user could select to be notified about. Maybe a list of active stations with check boxes for the available events. When you get things a little farther along I will purchase the android PushOver app for testing. It might be good if you get a free GitHub account and post the files there. It would be easier to update. If you are willing to share the plugin with the SIP community I will be happy to add it to the SIP plugin repository when you are ready. Dan RE: Push Notification - msev - 2017 Jun 27 For some other project (Mycroft virtual assistant) I made a Pushetta "skill". Would be cool if Pushetta would also be an option in SIP. The bonus of Pushetta is that it is free...I will take a look at how these plugins work, if I manage to write one... |