Send Notifications with pmatic

The pmatic module can not only communicate with the CCU. It also comes with some handy tools which assist you developing your own scripts. For example there are some standard methods to send out notifications.

class pmatic.notify.Pushover[source]

This notification class is used to send out notifications using Pushover (pushover.net).

The API to this notification class is pretty simple. You normally only need to care about using the send() class method. One example:

Pushover.send("This is the message to send :-)",
              api_token="xdrvcc6svnbFQ0hmAx4tDhbWU8nDK6",
              user_token="go8cCpgmWdAmbj2jpm4TmdzoHpVUjH")

For details take a look below.

classmethod send(message, title=None, api_token=None, user_token=None)[source]

Send a notification via pushover.net.

This class method can be used to send out custom notifiations to your tablet or mobile phone using pushover.net. To be able to send such notifications you need to register with pushover.net, register your appliation to obtaion an API token and a user or group token.

If you have both, you can use this class method to send a notification containing only a message. But you can also provide an optional title.

It returns True when the notification has been sent or raises a pmatic.PMUserError when either an invalid message or title is provided. In case of errors during sending the notification, a pmatic.PMException is raised.

classmethod set_default_tokens(api_token, user_token)[source]

Set default pushover credentials.

They can be set e.g. on startup of your program. If you set the default tokens here, you don’t need to provide the tokens on every send() call. The tokens provided as arguments to send() are overriding the tokens set with this method.