Notification plugin (presence and frequency enabled)

Posted on
Mon Mar 14, 2016 7:20 pm
krissh offline
Posts: 105
Joined: Nov 18, 2012
Location: Norway

Notification plugin (presence and frequency enabled)

My first plugin is ready for release and testing. Feedback, testers or suggestions for development is appreciated :)

Introduction
The notification plugin allows you to deliver notifications by a number of methods and with a great deal of flexibility, simultaneously. It focuses on using presence and configurable delivery frequency.

For now the plugin supports the following methods of delivery:
  • E-mail
  • Push notification (growl)
  • Notification to personal variable
  • Indigo log
  • Plugin log, writes to detailed csv files that can be opened in excel
  • Speak notification

Plugin is built with expansion for other methods in mind. Delivery method to present and non-present persons may be specified separately.

You can also choose between the following delivery interval / frequencies:
  • Always
  • Hourly
  • 12 hourly
  • Daily
  • Weekly
  • Monthly

Say you have a periodic check that runs every hour (check battery status for example). You would like to receive the notification as soon as possible, but you wouldn't like to receive the notification every hours.

The plugin is built so that you spend some time setting up "contact" information for the persons in your home and your categories/types of notification. Then the configuration to each notification is minimal and the important options like e-mail addresses etc. can be changed in only one 'central' place.

Installation
Simply download the latest release from github and double-click the notification.indigoPlugin package to install in Indigo

Configuration
Plugin configuration
From within Indigo, go to Plugins menu, choose Notfication plugin and Configure...
Plugin config.png
Plugin config dialog
Plugin config.png (58.62 KiB) Viewed 6085 times

This should be pretty straight-forward. The plugin will in some cases (if you configure it later on) use variables for storing notification history, or if you choose the option to always use variables. For this a specified variable folder will be used.

Setting up persons
First, you should set up the persons in your home, the ones that will receive notifications.
Add a new device in Indigo, choose type Notification plugin and model Person notification settings
Add person.png
Add person device dialog
Add person.png (32.25 KiB) Viewed 6085 times

Person configuration.png
Person configuration dialog
Person configuration.png (75.68 KiB) Viewed 6085 times

Now we're on to the "contact" settings for the person. The idea is that you only have to set up this one place, and if something changes you don't have to go through all your notification actions to update settings.
Presence variable should be set to a value that is true when person is present, false if the person is not present, updated by the presence tracking system of your choice. If you don't specify a variable, person will always be treated as present.
E-mail address is the personal e-mail address
Growl notification types needs a little explaining. Choosing the growl types here does not mean directly that notifications are delivered to this person. This creates a link to "personal" growl types that will be used when sending out notifications (which will be specified later). This is better to explain under the notification category section.
Notification variable. If you choose to select a variable here, notifications for this person will be written to the specified variable, which yoy may create your own triggers off etc.

Setting up notification categories / types
This is where most of the configuration is done. Idea is that you create different categories/types of notification and specify the delivery options there. When you later on create the notification action, all you have to do is select the category, enter the notification text and you're set to go. Again, one central place to change the relevant settings etc. To start, choose to add a new Indigo device, type Notification plugin and model Notification category
Configure notification category.png
Notification category configuration
Configure notification category.png (113.69 KiB) Viewed 6085 times

Title / log type is used to name log entries and/or e-mail subjects, growl notification titles etc., if not overriden later on.
Recipients. Select the persons to notify for this category. Use cmd button to select/deselect multiple
Notify all if none present. Meaning that if no-one is actually present when the notification is triggered, all persons selected above will be notified instead.
Delivery frequency. Selecting this means that no notifications of this category will be delivered for the specified interval (log entries will always be written regardless). It is generally better and recommended to specified this on the notification action level (later on)
Deliver to present and non-present options. Select what methods you would like to use for notification of present vs non-present persons. If both present and non-present should be notified, choose your method(s) in both lists.
Log and speech: Select the options you would like used
Always deliver to: Here you may specify additional e-mail recipients that will always be notified regardless of presence settings etc., but have to be within chosen delivery frequency (if specified). Reason for email: syntax is future-proofing for adding other delivery methods.
Growl notification types needs a little explaining wrt logic. The logic is as follows:
- Initially, the growl notification types selected here are used for delivery
- If you have chosen to only deliver growl to present persons, and one or more of the chosen growl types are "linked" to non-present persons, those groups will be excluded from delivery
You may specify growl priority and sticky properties.
Log: You may choose to always log or only if someone is present. You can also choose to log notification as an error in Indigo log.
Speak: Same as above, choose to always speak or only if someone is present. You can also (optionally) specify action group(s) for execution before and/or after speak

So, that's the notification category. A lot of settings and tweaking is possible, but the idea is that you have to do less settings for each of the notifcations as most settings are changed in the category.

Notification action
On to the actual notification action. From a trigger or action group etc., select action type Notification actions -> Notification (notification plugin) and select the notification category you would like to use. The only mandatory field is notification text, others may be left as-is to use the settings given by the notification category.
Action configuration.png
Action configuration
Action configuration.png (77.52 KiB) Viewed 6085 times

Notification text: Enter your text for the notification. You may use %%d:DEVICEID:STATEKEY%% to get device state substitued, and %%v:VARID%% to get variable value, as described here (substitute function)
Title is optional.
Identifier allows you to set a unique identifier for this particular notification. This again allows the plugin to determine when this notification was last sent, and is required for the delivery frequency to work.
Delivery frequency allows you to specify how often the notification should be delivered (log entries will always be made). Note that this is independent from the setting in category, and it is generally a better option to specify it here on the action rather than on the category level.
Override section allows you to override the category settings. If left as-is, settings from the category will be used.

That's it when it comes to settings.

Plugin log files
The plugin will (by default, but can be disabled) log all notifications to its separate log files, formatted as csv (comma-separated values) that can be opened in Excel or other spreadsheet program. This gives you a detailed log of your notifications, the following is logged:
  • Date
  • Time
  • Identifier
  • Notification
  • Log type
  • Title
  • Is error
  • Category
  • Persons
  • Number present
  • E-mail recipients
  • Growl types
  • Growl priority
  • Growl sticky
  • Variables
The log files are stored in a Notifications folder within the Indigo Logs folder.

Sending notification via python script
It is possible to send notifications via python scripts.

Minimum syntax is:
Code: Select all
nId = "com.kris10an.indigoplugin.notification"
nPlug = indigo.server.getPlugin(nId)
nPlug.executeAction("sendNotification", deviceId=1189998967, props={
   'text' :            'This is a notification',
   'identifier' :         'identifier92'})


All options are:
Code: Select all
nId = "com.kris10an.indigoplugin.notification"
nPlug = indigo.server.getPlugin(nId)
nPlug.executeAction("sendNotification", deviceId=1189998967, props={
   'text' :            'This is a notification',
   'title' :            'Optional title for e-mail subject etc.',
   'identifier' :         'notification2',
   'sendEvery'   :         'always',
   'additionalRecipients' :'email: personaladdress1@gmail.com, email:personaladdress2@gmail.com',
   'speak' :            'always',
   'logAsError' :         'true',
   'logType' :            'Indigo log type'
   })


Settings: (default value in bold)
sendEvery: always | 1 hour | 12 hours | 1 day | 1 week | 1 month
speak: default | always | never | ifPresent ('default' will use setting from category)
logAsError: default | true | false ('default' will use setting from category)

Posted on
Wed Mar 16, 2016 10:12 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Notification plugin (presence and frequency enabled)

Great contribution, thanks!

One favor: can you change the name of your action to "Notification Plugin Notification"? While it sounds a little redundant, I think putting the plugin name up front in the title will help users understand what it is. Using Notification in the plugin name will cause some confusion I expect, but this will help people more easily recognize what the action is.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Mar 16, 2016 10:26 am
krissh offline
Posts: 105
Joined: Nov 18, 2012
Location: Norway

Re: Notification plugin (presence and frequency enabled)

Thanks Jay,

The name of the action is actually Notification (notification plugin), this was meant to reduce the confusion :) But Notification plugin notification might be even clearer I guess.

I did have some thoughts reg. the use of the name Notification for the plugin (with regards to your point when it comes to possible confusion among others), but it is meant as a way of sending several types of notifications etc. (and more could be added) so I couldn't really think of a better name :) Suggestions? :roll:
To reduce possible confusion reg. this, the plugin was named "Notification plugin" rather than "Notification", so I believe it should be clear from all dialogs that actions and devices etc. are related to the plugin, not Indigo natively.

I emphasize that it is released as a pre-relase, but feedback and testers is appreciated :)

Posted on
Wed Mar 16, 2016 10:39 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Notification plugin (presence and frequency enabled)

How about Notifier? We're consistent in our use of the word "Notification" (I believe), so perhaps that change would reduce confusion while maintaining a clear expression of what it does. Just a thought...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Mar 19, 2016 1:43 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Notification plugin (presence and frequency enabled)

I wanted to also comment I like how this plugin rolls the different notifications into a single plugin. Very neat!

Image

Posted on
Mon Jun 27, 2016 2:39 pm
jmdraper offline
Posts: 103
Joined: Sep 11, 2014
Location: Surrey, UK

Re: Notification plugin (presence and frequency enabled)

Hi krissh

Thanks for the plugin - this looks absolutely ideal for what I need. Only trouble is that pretty much the only two messaging plugins not on your supported list are the ones I use! Namely Pushover and gazally's Messages app plugin. You say this one has been written to make it relatively easy to extend. Is extending it something the community can do, or are you able to spare the time to extend to these?

Thanks!
Jon

Posted on
Mon Jun 27, 2016 2:46 pm
krissh offline
Posts: 105
Joined: Nov 18, 2012
Location: Norway

Re: Notification plugin (presence and frequency enabled)

Glad that you like the plugin. Right now I'm traveling for a few weeks but I might be able to look into this after that. And possibly change the name of the plugin. Idea was to extend with different notification methods over time. If someone in the community feel like extending it, please feel free to do so :) Probably best to make a github branch for that.

Posted on
Fri Jul 01, 2016 3:18 am
jmdraper offline
Posts: 103
Joined: Sep 11, 2014
Location: Surrey, UK

Re: Notification plugin (presence and frequency enabled)

Thanks Krissh

I'm a very novice developer when it comes to Python but with a desire to learn and experiment and I have previously adapted an Indigo plugin for another purpose once before. So if I get a chance I will take a look and see if I can understand it all enough to be able to make the additions. And I'll try to teach myself how GitHub works as I'm new to that too.

Jon

Posted on
Fri Jul 01, 2016 5:10 am
Japple55 offline
Posts: 224
Joined: Sep 26, 2015
Location: NE Tennessee

Re: Notification plugin (presence and frequency enabled)

+1 for supporting Pushover!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest